org.commonreality.sensors.handlers
Interface ICommandHandlerDelegate

All Known Implementing Classes:
AbstractCommandHandlerDelegate, KeyboardMotorHandler, MotorCommandHandler, VocalizationCommandHandler

public interface ICommandHandlerDelegate

delegatable command handler that processes specific types of IEfferentCommands. This in combination with the EfferentCommandHandler allows one to more readily extend the range of commands handled

Author:
harrison

Method Summary
 void abort(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler parent)
           
 ICommandTimingEquation getTimingEquation(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler handler)
          return the timing equation used
 boolean shouldAbort(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler handler)
          return Boolean.TRUE if the command should abort (it will already be running).
 java.lang.Object shouldAccept(IEfferentCommand command, IAgentObject agent, EfferentCommandHandler handler)
          return Boolean.TRUE if the command should be accepted for the specified agent.
 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.
 

Method Detail

shouldAccept

java.lang.Object shouldAccept(IEfferentCommand command,
                              IAgentObject agent,
                              EfferentCommandHandler handler)
return Boolean.TRUE if the command should be accepted for the specified agent. Any other value will be used as the explanation for the rejection of the command

Parameters:
command -
agent -
handler -
Returns:

shouldStart

java.lang.Object shouldStart(IEfferentCommand command,
                             IAgentObject agent,
                             EfferentCommandHandler handler)
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 start(IEfferentCommand, IAgentObject, EfferentCommandHandler) and then send a state update for the command noting that the actual state is running.

Parameters:
command -
agent -
handler -
Returns:

shouldAbort

boolean shouldAbort(IEfferentCommand command,
                    IAgentObject agent,
                    EfferentCommandHandler handler)
return Boolean.TRUE if the command should abort (it will already be running). If true, EfferentCommandHandler will next call abort(IEfferentCommand, IAgentObject, EfferentCommandHandler) and send a state update for the command with its actual state as ABORTED

Parameters:
command -
agent -
handler -
Returns:

getTimingEquation

ICommandTimingEquation getTimingEquation(IEfferentCommand command,
                                         IAgentObject agent,
                                         EfferentCommandHandler handler)
return the timing equation used

Parameters:
command -
agent -
handler -
Returns:

start

void start(IEfferentCommand command,
           IAgentObject agent,
           EfferentCommandHandler parent)
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

Parameters:
command -
agent -
parent -

abort

void abort(IEfferentCommand command,
           IAgentObject agent,
           EfferentCommandHandler parent)