|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.commonreality.sensors.handlers.AbstractCommandHandlerDelegate
org.commonreality.sensors.speech.VocalizationCommandHandler
public class VocalizationCommandHandler
this generalized vocalization command handler can be used by any sensor that
wants to avoid vocal abilities. A few things to note: any agent that can
speak must have an IEfferentObject associated with it (by the sensor)
that has VocalConstants.CAN_VOCALIZE set to true. This
IEfferentObject must also have a VocalizationCommandTemplate
as a member of the collection IEfferentObject.COMMAND_TEMPLATES. The
sensor must also be able to track the vocalizations (recommend extending
#start(DeltaTracker)) and then set the command as completed upon
termination #completed(IEfferentCommand, Object) or
#aborted(IEfferentCommand, Object)
This class will then handle the commands on the provided executor. And when a
vocalization is actually executed it will be delegated to ISpeaker
| Constructor Summary | |
|---|---|
VocalizationCommandHandler(ICommandTimingEquation duration,
ISpeaker speaker)
|
|
| Method Summary | |
|---|---|
void |
abort(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
|
ISpeaker |
getSpeaker()
|
ICommandTimingEquation |
getTimingEquation(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
return the timing equation used |
void |
setSpeaker(ISpeaker speaker)
|
java.lang.Object |
shouldAccept(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
only accept vocalization 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 org.commonreality.sensors.handlers.AbstractCommandHandlerDelegate |
|---|
shouldAbort |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VocalizationCommandHandler(ICommandTimingEquation duration,
ISpeaker speaker)
| Method Detail |
|---|
public void setSpeaker(ISpeaker speaker)
public ISpeaker getSpeaker()
public java.lang.Object shouldAccept(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
shouldAccept in interface ICommandHandlerDelegateshouldAccept in class AbstractCommandHandlerDelegate
public java.lang.Object shouldStart(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
ICommandHandlerDelegateEfferentCommandHandler 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 ICommandHandlerDelegateshouldStart in class AbstractCommandHandlerDelegate
public void abort(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
public ICommandTimingEquation getTimingEquation(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler handler)
ICommandHandlerDelegate
public void start(IEfferentCommand command,
IAgentObject agent,
EfferentCommandHandler parent)
ICommandHandlerDelegateEfferentCommandHandler 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||