Package org.robwork.sdurwsim
Class ThreadSimulatorStepEventDispatcher
- java.lang.Object
-
- org.robwork.sdurwsim.ThreadSimulatorStepEventDispatcher
-
- All Implemented Interfaces:
ThreadSimulatorStepCallbackHandler
public class ThreadSimulatorStepEventDispatcher extends java.lang.Object implements ThreadSimulatorStepCallbackHandler
Register listeners for step events from theThreadSimulator. When this object is added to theThreadSimulator, it will dispatch aThreadSimulatorStepEventfor each callback from the stepper loop of the simulator. All registeredThreadSimulatorStepEventListeners will be notified. The dispatcher will first dispatch events when it is added to theThreadSimulatorusing the setStepCallBack method.- Since:
- 2013-11-22
- See Also:
ThreadSimulator.setStepCallBack(ThreadSimulatorStepCallbackEnv)
-
-
Constructor Summary
Constructors Constructor Description ThreadSimulatorStepEventDispatcher()Construct new dispatcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddThreadSimulatorStepEventListener(ThreadSimulatorStepEventListener listener)Add a listener that will be notified of new events.voidcallback(ThreadSimulator simulator, State state)The callback method that is called from the simulator.intgetNumberOfListeners()Get the number of listeners currently registered.voidremoveThreadSimulatorStepEventListener(ThreadSimulatorStepEventListener listener)Remove a registered listener that will then receive no more events.
-
-
-
Method Detail
-
addThreadSimulatorStepEventListener
public void addThreadSimulatorStepEventListener(ThreadSimulatorStepEventListener listener)
Add a listener that will be notified of new events.- Parameters:
listener- the listener to add.
-
removeThreadSimulatorStepEventListener
public void removeThreadSimulatorStepEventListener(ThreadSimulatorStepEventListener listener)
Remove a registered listener that will then receive no more events.- Parameters:
listener- the listener to remove.
-
getNumberOfListeners
public int getNumberOfListeners()
Get the number of listeners currently registered.- Returns:
- the number of listeners.
-
callback
public void callback(ThreadSimulator simulator, State state)
Description copied from interface:ThreadSimulatorStepCallbackHandlerThe callback method that is called from the simulator.- Specified by:
callbackin interfaceThreadSimulatorStepCallbackHandler- Parameters:
simulator- theThreadSimulatorthat makes the callback.state- the newStateafter the simulation cycle.- See Also:
ThreadSimulatorStepCallbackHandler.callback(org.robwork.sdurwsim.ThreadSimulator, org.robwork.sdurw_kinematics.State)
-
-