org.commonreality.sensors.motor
Class MotorCommandHandler
java.lang.Object
org.commonreality.sensors.handlers.AbstractCommandHandlerDelegate
org.commonreality.sensors.motor.MotorCommandHandler
- All Implemented Interfaces:
- ICommandHandlerDelegate
- Direct Known Subclasses:
- KeyboardMotorHandler
public class MotorCommandHandler
- extends AbstractCommandHandlerDelegate
- Author:
- harrison
|
Method Summary |
void |
abort(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
|
IActuator |
getActuator()
|
ICommandTimingEquation |
getTimingEquation(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
return the timing equation used |
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. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MotorCommandHandler
public MotorCommandHandler()
setTimingEquation
public void setTimingEquation(ICommandTimingEquation equation)
setActuator
public void setActuator(IActuator actuator)
getActuator
public IActuator getActuator()
shouldAccept
public java.lang.Object shouldAccept(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
- only accept motor commands where the source matched the provided efferent
- Specified by:
shouldAccept in interface ICommandHandlerDelegate- Overrides:
shouldAccept in class AbstractCommandHandlerDelegate
- Returns:
shouldStart
public java.lang.Object shouldStart(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
- Description copied from interface:
ICommandHandlerDelegate
- return Boolean.TRUE if the command should be started. Any other value will be returned as
the explanation for the rejection of the command start. If this returns Boolean.TRUE, the
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.
- Specified by:
shouldStart in interface ICommandHandlerDelegate- Overrides:
shouldStart in class AbstractCommandHandlerDelegate
- Returns:
start
public void start(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
- Description copied from interface:
ICommandHandlerDelegate
- actually start the processing of the command. The
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
abort
public void abort(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
getTimingEquation
public ICommandTimingEquation getTimingEquation(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
- Description copied from interface:
ICommandHandlerDelegate
- return the timing equation used
- Returns: