edu.udo.cs.ie.cowbots.arch.massim
Class MassimAgent

Package class diagram package MassimAgent
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.arch.massim.AbstractAgent
      extended by edu.udo.cs.ie.cowbots.arch.massim.MassimAgent

public class MassimAgent
extends AbstractAgent

Implementation of the abstract class AbstractAgent, wich represents an agent in the massim environment. It is used to percieve data from massim and set the next action performed by the agent. The methods provided by the AbstractAgent are used to connect and login to the server and to communicate via xml documents.


Field Summary
(package private)  java.io.BufferedReader in
           
private  MassimAdapter massimAdapter
          Massim adapter, which can be called if new perceptions arrive.
private  java.lang.String nextAction
          The next action performed by the agent
 int posX
          Help vars, to store the relative agents position
 int posY
           
 
Fields inherited from class edu.udo.cs.ie.cowbots.arch.massim.AbstractAgent
actDoc, actEl, actID, actLock, documentbuilderfactory, logger, username
 
Constructor Summary
MassimAgent()
          Empty constructor, without information about the massim server
MassimAgent(MassimAdapter massimAdapter, java.lang.String host, java.lang.String username, java.lang.String pass, int port)
          Creates a new instance of a MassimAgent
 
Method Summary
 void processLogIn()
          Processes information about the log in process.
 void processRequestAction(org.w3c.dom.Element perception, org.w3c.dom.Element target, long currenttime, long deadline)
          Processes xml formated new perceptions and sends the next action to the massim environment.
 void processSimulationEnd(org.w3c.dom.Element perception, long currenttime)
          Processes information about the end of a simulation.
 void processSimulationStart(org.w3c.dom.Element perception, long currenttime)
          Processes information about the start of a simulation.
 void setNextAction(java.lang.String action)
          Sets the next action performed by the agent
 
Methods inherited from class edu.udo.cs.ie.cowbots.arch.massim.AbstractAgent
agentThread, doAuthentication, getDate, getHost, getPassword, getPort, getUsername, processMessage, receiveAuthenticationResult, receiveDocument, receivePacket, sendAuthentication, sendDocument, sendResponseAction, 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

nextAction

private java.lang.String nextAction
The next action performed by the agent


massimAdapter

private MassimAdapter massimAdapter
Massim adapter, which can be called if new perceptions arrive.


posX

public int posX
Help vars, to store the relative agents position


posY

public int posY

in

java.io.BufferedReader in
Constructor Detail

MassimAgent

public MassimAgent()
Empty constructor, without information about the massim server


MassimAgent

public MassimAgent(MassimAdapter massimAdapter,
                   java.lang.String host,
                   java.lang.String username,
                   java.lang.String pass,
                   int port)
Creates a new instance of a MassimAgent

Parameters:
massimAdapter - The adapter which can be called if new perceptions arrive
host - The host massim is running on
username - The agents username
pass - The agents password
port - The port massim is listening to
Method Detail

setNextAction

public void setNextAction(java.lang.String action)
Sets the next action performed by the agent

Parameters:
action - Action performed by the agent Possible actions are: skip, north, south, east, west, northwest, northeast, southwest, southeast

processRequestAction

public void processRequestAction(org.w3c.dom.Element perception,
                                 org.w3c.dom.Element target,
                                 long currenttime,
                                 long deadline)
Processes xml formated new perceptions and sends the next action to the massim environment. This method is called by the abstract class.

Overrides:
processRequestAction in class AbstractAgent

processSimulationEnd

public void processSimulationEnd(org.w3c.dom.Element perception,
                                 long currenttime)
Processes information about the end of a simulation. This method is called by the abstract class.

Overrides:
processSimulationEnd in class AbstractAgent

processSimulationStart

public void processSimulationStart(org.w3c.dom.Element perception,
                                   long currenttime)
Processes information about the start of a simulation. This method is called by the abstract class.

Overrides:
processSimulationStart in class AbstractAgent

processLogIn

public void processLogIn()
Processes information about the log in process. This method is called by the abstract class.

Overrides:
processLogIn in class AbstractAgent