Package FAtiMA.Core.sensorEffector
Class RemoteAgent
java.lang.Object
java.lang.Thread
FAtiMA.Core.util.parsers.SocketListener
FAtiMA.Core.sensorEffector.RemoteAgent
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
IONRemoteAgent,WorldSimulatorRemoteAgent
Connection to the virtual world as a RemoteAgent. Implements the architecture
Sensors and Effectors
- Author:
- Joao Dias, Samuel Mascarenhas
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<ValuedAction>protected AgentCoreprotected booleanprotected ValuedActionprotected IProcessActionStrategyprotected booleanprotected Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class FAtiMA.Core.util.parsers.SocketListener
maxSize, socket, stoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidActionFailedPerception(String perc) protected abstract voidprotected abstract voidfinal voidAddAction(ValuedAction action) Add an action to an execution list.protected voidAdvanceTimePerception(String perc) protected voidAgentsPerception(String perc) voidfinal voidClear()Clears all the actions that an agent has in the execution listprotected voidCmdPerception(String perc) protected voidEntityAddedPerception(String perc) protected voidfinal voidSends for execution the next available actionvoidExpressEmotion(String emotion) Expresses a given emotion in the virtual worldfinal booleanindicates if the agent has finished the execution of the last action, and thus it can perform another actionabstract StringgetInitializationMessage(Map<String, String> arguments) protected voidIdentifyUserPerception(String perc) final booleanindicates if the RemoteAgent is running normally or if it was stopped by an explicit stop command send by the virtual worldfinal booleanindicates if the remote agent is running properly or if has been shut down either by an explicit shut down command or by a closed socket connectionvoidprotected voidLookAtPerception(String perc) voidprocessMessage(String msg) protected abstract voidprotected abstract voidabstract voidReportInternalPropertyChange(String agentName, Name property, Object value) voidprotected voidResumeTimePerception(String perc) voidprotected final booleanprotected abstract booleanprotected abstract voidvoidSendEmotionalState(String emotionalStateDescription) voidfinal voidShutDown()Orders the remote agent to shutdown and disconnect from the virtual worldprotected voidShutDownPerception(String perc) protected final voidStartAction(AgentModel am, ValuedAction vAction) protected voidStopTimePerception(String perc) protected abstract voidUserSpeechPerception(String perc) protected voidMethods inherited from class FAtiMA.Core.util.parsers.SocketListener
close, handleSocketException, initializeSocket, isStopped, runMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
SHUTDOWN
- See Also:
-
CMD
- See Also:
-
AGENTS
- See Also:
-
LOOK_AT
- See Also:
-
ENTITY_ADDED
- See Also:
-
ENTITY_REMOVED
- See Also:
-
PROPERTY_CHANGED
- See Also:
-
PROPERTY_REMOVED
- See Also:
-
USER_SPEECH
- See Also:
-
ACTION_STARTED
- See Also:
-
ACTION_FINISHED
- See Also:
-
ACTION_FAILED
- See Also:
-
ADVANCE_TIME
- See Also:
-
STOP_TIME
- See Also:
-
RESUME_TIME
- See Also:
-
GET_STATE
- See Also:
-
SET_STATE
- See Also:
-
CANCEL_ACTION
- See Also:
-
IDENTIFY_USER
- See Also:
-
_actions
-
_agent
-
_canAct
protected boolean _canAct -
_lookAtList
-
_running
protected boolean _running -
_userName
-
_currentAction
-
_processActionStrategy
-
-
Constructor Details
-
RemoteAgent
protected RemoteAgent(String host, int port, AgentCore agent, Map<String, String> arguments) throws UnknownHostException, IOException- Throws:
UnknownHostExceptionIOException
-
-
Method Details
-
waitForServerAck
- Throws:
IOException
-
getInitializationMessage
-
AddAction
Add an action to an execution list. The action will be executed as soon as possible.- Parameters:
action- - the ValuedAction to execute
-
Clear
public final void Clear()Clears all the actions that an agent has in the execution list -
ExecuteNextAction
Sends for execution the next available action -
FinishedExecuting
public final boolean FinishedExecuting()indicates if the agent has finished the execution of the last action, and thus it can perform another action- Returns:
- true if the agent has finished execution and can perform another action, false otherwise
-
isRunning
public final boolean isRunning()indicates if the RemoteAgent is running normally or if it was stopped by an explicit stop command send by the virtual world- Returns:
- true if the agent is running normally, false if the agent must pause its normal functioning
-
cancelAction
public void cancelAction() -
setProcessActionStrategy
-
sendCancelActionMsg
-
processMessage
- Specified by:
processMessagein classSocketListener
-
Send
-
SendAction
-
ReportInternalPropertyChange
-
ReportInternalState
-
ExpressEmotion
Expresses a given emotion in the virtual world- Parameters:
emotion- - the emotion to be expressed
-
SendEmotionalState
-
StartAction
-
isShutDown
public final boolean isShutDown()indicates if the remote agent is running properly or if has been shut down either by an explicit shut down command or by a closed socket connection- Returns:
- false if the remote agent is running properly and connected to the virtual world, true otherwise
-
ShutDown
public final void ShutDown()Orders the remote agent to shutdown and disconnect from the virtual world -
SaveState
-
LoadState
-
PropertyChangedPerception
-
PropertyRemovedPerception
-
UserSpeechPerception
-
ActionStartedPerception
-
ActionFinishedPerception
-
ActionFailedPerception
-
ShutDownPerception
-
IdentifyUserPerception
-
CmdPerception
-
AgentsPerception
-
LookAtPerception
-
EntityAddedPerception
-
EntityRemovedPerception
-
AdvanceTimePerception
-
StopTimePerception
-
ResumeTimePerception
-