massim.agent
Class DemoGridAgent

java.lang.Object
  extended by massim.agent.AbstractAgent
      extended by massim.agent.DemoGridAgent

public class DemoGridAgent
extends AbstractAgent

Description of an agent for the simulation


Field Summary
 
Fields inherited from class massim.agent.AbstractAgent
documentbuilderfactory, logger, username
 
Constructor Summary
DemoGridAgent()
           
DemoGridAgent(java.lang.String host, java.lang.String username, java.lang.String pass)
           
DemoGridAgent(java.lang.String host, java.lang.String username, java.lang.String pass, int port)
           
 
Method Summary
 java.lang.String determineDirection(int north, int west, int south, int east)
          Computation of the better direction (shortest way) to the depot
static void main(java.lang.String[] args)
          Main method of this class
 void processLogIn()
           
 java.lang.String processPerception(org.w3c.dom.Element a)
           
 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
 java.lang.String push()
           
 java.lang.String randomAction()
          Determination of random action
 java.lang.String surround()
           
 
Methods inherited from class massim.agent.AbstractAgent
agentThread, doAuthentication, getDate, getHost, getPassword, getPort, getUsername, processMessage, 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
 

Constructor Detail

DemoGridAgent

public DemoGridAgent()

DemoGridAgent

public DemoGridAgent(java.lang.String host,
                     java.lang.String username,
                     java.lang.String pass,
                     int port)

DemoGridAgent

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

main

public static void main(java.lang.String[] args)
Main method of this class

Parameters:
args - username, Password and optional Host

processRequestAction

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

processPerception

public java.lang.String processPerception(org.w3c.dom.Element a)

randomAction

public java.lang.String randomAction()
Determination of random action

Returns:
new action Random action

surround

public java.lang.String surround()

push

public java.lang.String push()

determineDirection

public java.lang.String determineDirection(int north,
                                           int west,
                                           int south,
                                           int east)
Computation of the better direction (shortest way) to the depot

Parameters:
north - Distance to the depot (from the adjacent north cell)
west - Distance to the depot (from the adjacent west cell)
south - Distance to the depot (from the adjacent south cell)
east - Distance to the depot (from the adjacent east cell)
Returns:
The better direction

processLogIn

public void processLogIn()
Overrides:
processLogIn in class AbstractAgent

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 © 2012. All Rights Reserved.