Class RemoteAgent

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    IONRemoteAgent, WorldSimulatorRemoteAgent

    public abstract class RemoteAgent
    extends SocketListener
    Connection to the virtual world as a RemoteAgent. Implements the architecture Sensors and Effectors
    Author:
    Joao Dias, Samuel Mascarenhas
    • Constructor Detail

      • RemoteAgent

        protected RemoteAgent​(java.lang.String host,
                              int port,
                              AgentCore agent,
                              java.util.Map<java.lang.String,​java.lang.String> arguments)
                       throws java.net.UnknownHostException,
                              java.io.IOException
        Throws:
        java.net.UnknownHostException
        java.io.IOException
    • Method Detail

      • waitForServerAck

        protected void waitForServerAck()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getInitializationMessage

        public abstract java.lang.String getInitializationMessage​(java.util.Map<java.lang.String,​java.lang.String> arguments)
      • AddAction

        public final void AddAction​(ValuedAction action)
        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

        public final void ExecuteNextAction​(AgentModel am)
        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()
      • sendCancelActionMsg

        protected abstract void sendCancelActionMsg​(RemoteAction ra)
      • Send

        protected final boolean Send​(java.lang.String msg)
      • SendAction

        protected abstract boolean SendAction​(RemoteAction ra)
      • ReportInternalPropertyChange

        public abstract void ReportInternalPropertyChange​(java.lang.String agentName,
                                                          Name property,
                                                          java.lang.Object value)
      • ReportInternalState

        public void ReportInternalState​(EmotionalState es)
      • ExpressEmotion

        public void ExpressEmotion​(java.lang.String emotion)
        Expresses a given emotion in the virtual world
        Parameters:
        emotion - - the emotion to be expressed
      • SendEmotionalState

        public void SendEmotionalState​(java.lang.String emotionalStateDescription)
      • 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

        public void SaveState​(java.lang.String fileName)
      • LoadState

        public void LoadState​(java.lang.String fileName)
      • PropertyChangedPerception

        protected abstract void PropertyChangedPerception​(java.lang.String perc)
      • PropertyRemovedPerception

        protected abstract void PropertyRemovedPerception​(java.lang.String perc)
      • UserSpeechPerception

        protected abstract void UserSpeechPerception​(java.lang.String perc)
      • ActionStartedPerception

        protected abstract void ActionStartedPerception​(java.lang.String perc)
      • ActionFinishedPerception

        protected abstract void ActionFinishedPerception​(java.lang.String perc)
      • ActionFailedPerception

        protected abstract void ActionFailedPerception​(java.lang.String perc)
      • ShutDownPerception

        protected void ShutDownPerception​(java.lang.String perc)
      • IdentifyUserPerception

        protected void IdentifyUserPerception​(java.lang.String perc)
      • CmdPerception

        protected void CmdPerception​(java.lang.String perc)
      • AgentsPerception

        protected void AgentsPerception​(java.lang.String perc)
      • LookAtPerception

        protected void LookAtPerception​(java.lang.String perc)
      • EntityAddedPerception

        protected void EntityAddedPerception​(java.lang.String perc)
      • EntityRemovedPerception

        protected void EntityRemovedPerception​(java.lang.String perc)
      • AdvanceTimePerception

        protected void AdvanceTimePerception​(java.lang.String perc)
      • StopTimePerception

        protected void StopTimePerception​(java.lang.String perc)
      • ResumeTimePerception

        protected void ResumeTimePerception​(java.lang.String perc)