java.lang.Object
org.bzdev.scripting.ScriptListenerAdapter
org.bzdev.devqsim.DefaultSimAdapter
org.bzdev.drama.common.SimulationAdapter
- All Implemented Interfaces:
EventListener
,SimulationListener
This class provides the additional methods needed for drama-based
simulation flavors for an adapter for simulation-state events.
Most of the methods are provided by the superclass.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.scripting.ScriptListenerAdapter
ScriptListenerAdapter.ScriptMethodException
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.SimulationAdapter
(ScriptingContext context, Object scriptObject) Constructor given a scripting context and script object.SimulationAdapter
(ExpressionParser.ESPObject scriptObject) Constructor with only a script object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
messageReceiveEnd
(Simulation sim, MessageRecipient from, MessageRecipient to, Object msg) Indicate that an agent or group has completed receiving a message.void
messageReceiveStart
(Simulation sim, MessageRecipient from, MessageRecipient to, Object msg) Indicate that an agent or group is receiving a message.final void
Process a simulation-state-change event.Methods inherited from class org.bzdev.devqsim.DefaultSimAdapter
callEnd, callEndSimObject, callStart, callStartSimObject, serverCallable, serverCallableSimObject, serverInteraction, serverInteractionSimObject, serverRunnable, serverRunnableSimObject, serverSelected, serverTask, serverTaskSimObject, simulationStart, simulationStop, taskEnd, taskEndSimObject, taskPause, taskPauseSimObject, taskQueuePause, taskQueueResume, taskQueueStart, taskQueueStop, taskResume, taskResumeSimObject, taskStart, taskStartSimObject
Methods inherited from class org.bzdev.scripting.ScriptListenerAdapter
callScriptMethod
-
Constructor Details
-
SimulationAdapter
public SimulationAdapter()Constructor. This creates an adapter with no scripting support. -
SimulationAdapter
Constructor with only a script object. This creates an adapter for use with the ESP scripting language.Note: This is equivalent to using the constructor
SimulationAdapter(ScriptingContext,Object)
with a null first argument.- Parameters:
scriptObject
- the scripting-language object implementing the listener interface for this adapter.
-
SimulationAdapter
public SimulationAdapter(ScriptingContext context, Object scriptObject) throws IllegalArgumentException Constructor given a scripting context and script object. This constructor implements the adapter using a scripting language provided its arguments are not null. If a method is added to the script object after this constructor is called, that method will be ignored, so all of the methods the adapter implements must be defined by the script object when this constructor is called.If ESP is the scripting language, the context may be null provided that scriptObject is an ESP object. This special case is provided for use with
ObjectNamerLauncher
and the yrunner program.- Parameters:
context
- the scripting context for this adapterscriptObject
- the scripting-language object implementing the listener interface for this adapter.- Throws:
IllegalArgumentException
- the script object was ill formed
-
-
Method Details
-
stateChanged
Process a simulation-state-change event. The implementation dispatches the processing to the superclass and if the superclass does not respond to an event with the current event's type, the event-types handled by this class are tried. then other methods in this class, based on the event type.- Specified by:
stateChanged
in interfaceSimulationListener
- Overrides:
stateChanged
in classDefaultSimAdapter
- Parameters:
e
- the event
-
messageReceiveStart
public void messageReceiveStart(Simulation sim, MessageRecipient from, MessageRecipient to, Object msg) Indicate that an agent or group is receiving a message.- Parameters:
sim
- the simulationfrom
- the message senderto
- the message recipientmsg
- the message itself
-
messageReceiveEnd
public void messageReceiveEnd(Simulation sim, MessageRecipient from, MessageRecipient to, Object msg) Indicate that an agent or group has completed receiving a message.- Parameters:
sim
- the simulationfrom
- the message senderto
- the message recipientmsg
- the message itself
-