massim.monitor
Class DemoControlledAgent

java.lang.Object
  extended by massim.agent.AbstractAgent
      extended by massim.monitor.DemoControlledAgent

public class DemoControlledAgent
extends AbstractAgent

Description of an agent for the simulation


Field Summary
 boolean actionRequested
          Main method of this class
 long deadline
           
 java.lang.String replyID
           
 
Fields inherited from class massim.agent.AbstractAgent
documentbuilderfactory, logger, username
 
Constructor Summary
DemoControlledAgent()
           
DemoControlledAgent(java.lang.String host, java.lang.String username, java.lang.String pass)
           
 
Method Summary
 void processLogIn()
           
 boolean processMessage(org.w3c.dom.Element el_message)
          This method parses the message received from the server and selects the right action to do next.
 void processPong(java.lang.String pong)
           
 void processRequestAction(org.w3c.dom.Element perception, org.w3c.dom.Element target, long currenttime, long deadline)
           
 void processSimulationEnd(org.w3c.dom.Element perception, long currenttime)
           
 void processSimulationStart(org.w3c.dom.Element perception, long currenttime)
          Initialisation of main variables and vectors
 void sendAction(java.lang.String action)
           
 
Methods inherited from class massim.agent.AbstractAgent
agentThread, doAuthentication, getDate, getHost, getPassword, getPort, getUsername, receiveAuthenticationResult, receiveDocument, receivePacket, sendAuthentication, sendDocument, setHost, setPassword, setPort, setUsername, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actionRequested

public boolean actionRequested
Main method of this class


replyID

public java.lang.String replyID

deadline

public long deadline
Constructor Detail

DemoControlledAgent

public DemoControlledAgent()

DemoControlledAgent

public DemoControlledAgent(java.lang.String host,
                           java.lang.String username,
                           java.lang.String pass)
Method Detail

processMessage

public boolean processMessage(org.w3c.dom.Element el_message)
Description copied from class: AbstractAgent
This method parses the message received from the server and selects the right action to do next. The messages must be of the type:
  1. request-action
  2. sim-start
  3. sim-end
If the type is one of the first three, it builds a valid response envelop and calls the method related with the actual request wich will build the correct response content for the server. The responsible of sending such response is this method also, after it is builded.

Overrides:
processMessage in class AbstractAgent
Parameters:
el_message - XML Element object containing the message to process.
Returns:
true always
See Also:
processRequestAction, processSimulationStart, processSimulationEnd, sendDocument

sendAction

public void sendAction(java.lang.String action)

processRequestAction

public void processRequestAction(org.w3c.dom.Element perception,
                                 org.w3c.dom.Element target,
                                 long currenttime,
                                 long deadline)
Overrides:
processRequestAction in class AbstractAgent

processLogIn

public void processLogIn()
Overrides:
processLogIn in class AbstractAgent

processPong

public void processPong(java.lang.String pong)

processSimulationEnd

public void processSimulationEnd(org.w3c.dom.Element perception,
                                 long currenttime)
Overrides:
processSimulationEnd in class AbstractAgent

processSimulationStart

public void processSimulationStart(org.w3c.dom.Element perception,
                                   long currenttime)
Initialisation of main variables and vectors

Overrides:
processSimulationStart in class AbstractAgent


Copyright © 2011. All Rights Reserved.