public class MotorCommandHandler extends AbstractCommandHandlerDelegate
Constructor and Description |
---|
MotorCommandHandler() |
Modifier and Type | Method and Description |
---|---|
void |
abort(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
called to abort the command
|
void |
aborted(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
called when the command abort is completed
|
IActuator |
getActuator() |
ICommandTimingEquation |
getTimingEquation(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
return the timing equation used
|
boolean |
isInterestedIn(IEfferentCommand command)
return true if this delegate should process this type of command
|
void |
rejected(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent) |
void |
setActuator(IActuator actuator) |
void |
setTimingEquation(ICommandTimingEquation equation) |
java.lang.Object |
shouldAccept(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
only accept motor commands where the source matched the provided efferent
|
java.lang.Object |
shouldStart(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
return Boolean.TRUE if the command should be started.
|
void |
start(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
actually start the processing of the command.
|
void |
started(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
called once the start is complete
|
shouldAbort
public void setTimingEquation(ICommandTimingEquation equation)
public void setActuator(IActuator actuator)
public IActuator getActuator()
public java.lang.Object shouldAccept(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler handler)
shouldAccept
in interface ICommandHandlerDelegate
shouldAccept
in class AbstractCommandHandlerDelegate
public java.lang.Object shouldStart(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler handler)
ICommandHandlerDelegate
EfferentCommandHandler
will next
call ICommandHandlerDelegate.start(IEfferentCommand, IAgentObject, EfferentCommandHandler)
and then send a state update for the command noting that the actual state
is running.shouldStart
in interface ICommandHandlerDelegate
shouldStart
in class AbstractCommandHandlerDelegate
public void start(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler parent)
ICommandHandlerDelegate
EfferentCommandHandler
is passed along as well so that later
EfferentCommandHandler.completed(IEfferentCommand, Object)
may be
called. However, it should not be called from within here. The
reason is simple, after returning from start,
EfferentCommandHandler
will set the state of the command as
RUNNING. If you call
EfferentCommandHandler.completed(IEfferentCommand, Object)
from
within start, the states will be inconsistent. Any state changes
must occur after start returns.public void abort(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler parent)
ICommandHandlerDelegate
public ICommandTimingEquation getTimingEquation(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler handler)
ICommandHandlerDelegate
public boolean isInterestedIn(IEfferentCommand command)
ICommandHandlerDelegate
public void aborted(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler parent)
ICommandHandlerDelegate
public void rejected(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler parent)
public void started(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler parent)
ICommandHandlerDelegate