struct Example
private thistype next
private thistype prev
private integer parentKey
method destroy takes nothing returns nothing
set this.next.prev = this.prev // remove the node from the list
set this.prev.next = this.next
call this.deallocate()
endmethod
static method loopThrough takes nothing returns nothing
// this will demonstrate how to loop through the parent Keys
local thistype node = thistype(0).next
loop
exitwhen node == 0
call SaveUnitHandle(someHashTable, this.parentKey, 0, GetTriggerUnit())
// saves the trigger unit under each parent key
set node = node.next
endloop
endmethod
static method create takes unit u returns thistype
local thistype this = thistype.allocate()
set this.next = thistype(0).next // enter the node in the list
set this.prev = thistype(0)
set this.next.prev = this
set thistype(0).next = this
set this.parentKey = GetHandleId(u) // set the parent key to whatever
// just an example
return this
endmethod
endstruct