The Simulation engine is a simple engine that maintains nodes and links
its own time. (There is no graphics involved.)
Time progresses when the engine gets a step call.
Nodes are created with a listener. On every step the listener will be
invoked with a message about the current time and a list of any incomming
messages or notifications of lost links.
Links are created by specifying a link id, a from and a to node plus
specific link behaviour. To use the link send is called with the linkid and
a message of any format. Specific link behaviour is how many slots the link
should have and how messages should be shifted in these slots on each step.
Default behaviour is FIFO moving messages one slot forward on each step.
On each step the folloing happens in order:
1. The time is progressed
2. All links are traversed and shifted
3. All nodes are traversed and their listeners are informed of
the step and any messages.
Functor
SimulationEngine ("/home/annan/cvscode/isl/src/MozartMessageSimulator/SimulationEngine/SimulationEngine.oz")
Import
- Utils(takeDet:TakeDet assert:Assert mapMethod:MapMethod allMeth:AllMeth) at "../Utils.ozf"
Export
Define
class SimulationEngine
feat Nodes Links
- init()
- step()
- createNode(NodeId Listener)
- removeNode(NodeId)
- createLink(LinkId FromNodeId ToNodeId NofSlots Shifter)
- removeLink(L How DoneAlert)
- send(L Msg)
- getLinkStates($)
- getTime($)
end
End