- Joined
- Jul 10, 2007
- Messages
- 6,306
* method clear takes nothing returns nothing
* - clears expressions
* method clearReferences takes nothing returns nothing
* - clears trigger references
* method clearBackReferences takes nothing returns nothing
* - removes references for all triggers referencing this trigger
/*
* readonly trigger triggger
*/
/*
* readonly trigger trigger
*/
loop
exitwhen globalNode == 0
loop
exitwhen localNode.priority > globalNode.priority
set expr = Or(expr, localNode.expr)
endloop
set expr = Or(expr, globalNode.expr)
set globalNode = globalNode .next
endloop
call myTrigger.clear()
call myExpr[this].destroy()
private struct myStruct extends array
implement Alloc
private static Table table
readonly static Trigger myTrigger
readonly static BooleanExpression array myExpr
private static method run takes nothing returns boolean
local integer id = //1, 2, Get any Integer used in method xy
local thistype this
set this = table[id]
call myTrigger.register(expr[this].expression)
call myTrigger.fire()
call myTrigger.clear()
call myExpr[this].destroy()
//call this.deallocate()
return false
endmethod
private static method xy takes integer id, boolexpr expr returns nothing
local thistype this = allocate()
set table[id] = this
set myExpr[this] = BooleanExpression.create()
call myExpr[this].register(expr)
endmethod
private static method onInit takes nothing returns nothing
set table = Table.create()
set myTrigger = Trigger.create()
call xy(1, Condition(function anyStruct.fire))
call xy(2, Condition(function anyStruct.fire2))
endmethod
endstruct
call myExpr.register(tb.boolexpr[id])
call myTrigger.register(myExpr.expression)
call myTrigger.fire()
call myExpr.clear()
call myTrigger.clear()
Ok I got it. Then I will store the boolexpr in table and register it to one BooleanExpression instead of using an array and clear it afterwards.
Don't do that, that'll kill the point of BooleanExpression, lol.