|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.commonreality.sensors.handlers.EfferentCommandHandler
public class EfferentCommandHandler
general handler to deal with IEfferentCommands. After instantiating
a sensor, this can be attached to the IEfferentCommandManager by
using the constructor and providing the appropriate Executor.
By default, all methods ignore all IEfferentCommands. To change this
behavior override any of the shouldXXXX methods. If you overload the actual
state change methods, be sure to call the super method as well as it
invariably sets specific state variables in the IEfferentCommand. At
the termination of a command's run be sure to call the
completed(IEfferentCommand, Object) or
aborted(IEfferentCommand, Object) methods.
The processing of efferent commands should usually be done on the thread that
received the event (the io executor). This is because most participants
expect that the state change requests will be processed immediately, as
opposed to queued up on a clock limited thread. The easiest way to do this is
to set the Executor to be InlineExecutor.get().
| Constructor Summary | |
|---|---|
EfferentCommandHandler(ISensor sensor)
|
|
| Method Summary | |
|---|---|
void |
aborted(IEfferentCommand command,
java.lang.Object extraInfo)
called when a command is aborted on the sensor side (not at the request of the agent). |
void |
add(ICommandHandlerDelegate delegate)
|
void |
completed(IEfferentCommand command,
java.lang.Object extraInfo)
called upon the completion of a command |
java.util.Collection<ICommandHandlerDelegate> |
getDelegates()
|
ISensor |
getSensor()
|
void |
objectsAdded(IObjectEvent<IEfferentCommand,?> addEvent)
|
void |
objectsRemoved(IObjectEvent<IEfferentCommand,?> removeEvent)
|
void |
objectsUpdated(IObjectEvent<IEfferentCommand,?> updateEvent)
|
void |
processNewEfferentCommand(IEfferentCommand command)
process a new efferent command, checking shouldAccept(IEfferentCommand) and either
accept(DeltaTracker) or #reject(DeltaTracker) |
void |
remove(ICommandHandlerDelegate delegate)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EfferentCommandHandler(ISensor sensor)
| Method Detail |
|---|
public java.util.Collection<ICommandHandlerDelegate> getDelegates()
public void add(ICommandHandlerDelegate delegate)
public void remove(ICommandHandlerDelegate delegate)
public ISensor getSensor()
public void objectsAdded(IObjectEvent<IEfferentCommand,?> addEvent)
objectsAdded in interface IObjectListener<IEfferentCommand>public void objectsRemoved(IObjectEvent<IEfferentCommand,?> removeEvent)
objectsRemoved in interface IObjectListener<IEfferentCommand>public void objectsUpdated(IObjectEvent<IEfferentCommand,?> updateEvent)
objectsUpdated in interface IObjectListener<IEfferentCommand>public void processNewEfferentCommand(IEfferentCommand command)
shouldAccept(IEfferentCommand) and either
accept(DeltaTracker) or #reject(DeltaTracker)
command -
public void aborted(IEfferentCommand command,
java.lang.Object extraInfo)
command - extraInfo - will be stored under IEfferentCommand.RESULT
public void completed(IEfferentCommand command,
java.lang.Object extraInfo)
command - extraInfo -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||