mas.agentsHempelsSofa.data
Class AgentToken

java.lang.Object
  extended by mas.agentsHempelsSofa.data.AgentToken
All Implemented Interfaces:
java.lang.Comparable<AgentToken>, Believable

public class AgentToken
extends java.lang.Object
implements Believable, java.lang.Comparable<AgentToken>

An implementation of an agent token which includes the following information about an agent:

It can be placed and moved on the Graph.

Author:
Hempels-Sofa

Field Summary
static int STRATEGY_ATTACKER
          Says that the agent takes part in an attack.
static int STRATEGY_EXPLORER
          Says that the agent takes part in an exploration.
static int STRATEGY_UNKNOWN
          The state is unknown (enemy tokens).
static int STRATEGY_ZONE_BUILDER
          Says that the agent takes part in building a zone.
 
Constructor Summary
AgentToken(java.lang.String name, java.lang.String team, Vertex position, java.lang.String state, int step)
          Constructor which sets name, team, position and state.
AgentToken(java.lang.String name, java.lang.String team, Vertex position, java.lang.String state, java.lang.String role, int energy, int health, int strength, int visibilityRange, int step)
          The constructor for an inspection.
AgentToken(java.lang.String name, java.lang.String team, Vertex position, Vertex targetVertex, java.lang.String state, java.lang.String role, int energy, int maxEnergy, int maxEnergyDisabled, int health, int maxHealth, int strength, int visibilityRange, int step)
          The complete constructor (for agents of same team).
AgentToken(java.lang.String name, java.lang.String team, Vertex position, Vertex targetVertex, java.lang.String state, java.lang.String role, int energy, int maxEnergy, int maxEnergyDisabled, int health, int maxHealth, int strength, int visibilityRange, int lastUpdate, int lastInspection)
          The complete constructor (for agents of same team).
 
Method Summary
 int compareTo(AgentToken t)
           
 boolean equals(java.lang.Object obj)
           
 int getEnergy()
           
 int getHealth()
           
 int getLastInspection()
           
 java.lang.String getLaststate()
           
 int getLastUpdate()
           
 int getMaxEnergy()
           
 int getMaxEnergyDisabled()
           
 int getMaxHealth()
           
 java.lang.String getName()
           
 Vertex getNextPosition()
           
 Vertex getPosition()
           
 java.lang.String getRole()
           
 java.lang.String getState()
           
 int getStrategyType()
           
 java.lang.String getStrategyTypeString()
           
 int getStrength()
           
 AgentToken getTargetAgent()
           
 Vertex getTargetVertex()
           
 java.lang.String getTeam()
           
 int getVisibilityRange()
           
 void inspection(java.lang.String role, int energy, int health, int strength, int visibilityRange, int step)
           
 boolean isAttacker()
           
 boolean isDisabled()
           
 boolean isOfTeam(java.lang.String team)
           
 boolean isStrategyKnown()
           
 boolean isZoneBuilder()
           
 void setEnergy(int energy)
           
 void setHealth(int health)
           
 void setLastInspection(int lastInspected)
           
 void setLaststate(java.lang.String laststate)
           
 void setLastUpdate(int lastUpdate)
           
 void setMaxEnergy(int maxEnergy)
           
 void setMaxEnergyDisabled(int maxEnergyDisabled)
           
 void setMaxHealth(int maxHealth)
           
 void setName(java.lang.String name)
          Sets the name of an agent token
 void setNextPosition(Vertex nextPosition)
           
 void setPosition(Vertex position)
           
 void setRole(java.lang.String role)
           
 void setState(java.lang.String state)
           
 void setStrategyType(int strategyType)
           
 void setStrength(int strength)
           
 void setTargetAgent(AgentToken targetAgent)
           
 void setTargetVertex(Vertex targetVertex)
           
 void setTeam(java.lang.String team)
           
 void setVisibilityRange(int visibilityRange)
           
 boolean stateChanged()
           
 apltk.interpreter.data.LogicBelief toBelief()
           
 java.lang.String toString()
           
 void update(Vertex position, java.lang.String state, int step)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STRATEGY_ZONE_BUILDER

public static final int STRATEGY_ZONE_BUILDER
Says that the agent takes part in building a zone.

See Also:
Constant Field Values

STRATEGY_ATTACKER

public static final int STRATEGY_ATTACKER
Says that the agent takes part in an attack.

See Also:
Constant Field Values

STRATEGY_EXPLORER

public static final int STRATEGY_EXPLORER
Says that the agent takes part in an exploration.

See Also:
Constant Field Values

STRATEGY_UNKNOWN

public static final int STRATEGY_UNKNOWN
The state is unknown (enemy tokens).

See Also:
Constant Field Values
Constructor Detail

AgentToken

public AgentToken(java.lang.String name,
                  java.lang.String team,
                  Vertex position,
                  java.lang.String state,
                  java.lang.String role,
                  int energy,
                  int health,
                  int strength,
                  int visibilityRange,
                  int step)
The constructor for an inspection.

Parameters:
name - the name of the agent
team - the team of the agent
position - the position of the agent
state - the current state of the agent
role - the role of the agent
energy - the current energy of the agent
health - the current health of the agent
strength - the strength of the agent
visibilityRange - the visibility range of the agent
step - the number of the actually executed step

AgentToken

public AgentToken(java.lang.String name,
                  java.lang.String team,
                  Vertex position,
                  Vertex targetVertex,
                  java.lang.String state,
                  java.lang.String role,
                  int energy,
                  int maxEnergy,
                  int maxEnergyDisabled,
                  int health,
                  int maxHealth,
                  int strength,
                  int visibilityRange,
                  int step)
The complete constructor (for agents of same team).

Parameters:
name - the name of the agent
team - the team of the agent
position - the position of the agent
state - the current state of the agent
role - the role of the agent
energy - the current energy of the agent
maxEnergy - the maximum energy of the agent
maxEnergyDisabled - the maximum energy of the agent if it is disabled
health - the current health of the agent
maxHealth - the maximum health of the agent
strength - the strength of the agent
visibilityRange - the visibility range of the agent
step - the number of the actually executed step

AgentToken

public AgentToken(java.lang.String name,
                  java.lang.String team,
                  Vertex position,
                  Vertex targetVertex,
                  java.lang.String state,
                  java.lang.String role,
                  int energy,
                  int maxEnergy,
                  int maxEnergyDisabled,
                  int health,
                  int maxHealth,
                  int strength,
                  int visibilityRange,
                  int lastUpdate,
                  int lastInspection)
The complete constructor (for agents of same team).

Parameters:
name - the name of the agent
team - the team of the agent
position - the position of the agent
state - the current state of the agent
role - the role of the agent
energy - the current energy of the agent
maxEnergy - the maximum energy of the agent
maxEnergyDisabled - the maximum energy of the agent if it is disabled
health - the current health of the agent
maxHealth - the maximum health of the agent
strength - the strength of the agent
visibilityRange - the visibility range of the agent
lastUpdate - the step of the last update
lastInspection - the step of the last inspection

AgentToken

public AgentToken(java.lang.String name,
                  java.lang.String team,
                  Vertex position,
                  java.lang.String state,
                  int step)
Constructor which sets name, team, position and state. The other values are set to null or -1.

Parameters:
name - the name of the agent
team - the team of the agent
position - the Position of the agent
state - the state of the agent
step - the number of the actually executed step
Method Detail

setName

public void setName(java.lang.String name)
Sets the name of an agent token

Parameters:
name - The new name of the agent

update

public void update(Vertex position,
                   java.lang.String state,
                   int step)

inspection

public void inspection(java.lang.String role,
                       int energy,
                       int health,
                       int strength,
                       int visibilityRange,
                       int step)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Returns:
the name of the agent

setRole

public void setRole(java.lang.String role)
Parameters:
role - the role to set

getRole

public java.lang.String getRole()
Returns:
the role

setTeam

public void setTeam(java.lang.String team)
Parameters:
team - the team to set

getTeam

public java.lang.String getTeam()
Returns:
the team

setPosition

public void setPosition(Vertex position)
Parameters:
position - the position to set

getPosition

public Vertex getPosition()
Returns:
the position

setState

public void setState(java.lang.String state)
Parameters:
state - the state to set

getState

public java.lang.String getState()
Returns:
the state

setEnergy

public void setEnergy(int energy)
Parameters:
energy - the energy to set

getEnergy

public int getEnergy()
Returns:
the energy

setMaxEnergy

public void setMaxEnergy(int maxEnergy)
Parameters:
maxEnergy - the maxEnergy to set

getMaxEnergy

public int getMaxEnergy()
Returns:
the maxEnergy

setMaxEnergyDisabled

public void setMaxEnergyDisabled(int maxEnergyDisabled)
Parameters:
maxEnergyDisabled - the maxEnergyDisabled to set

getMaxEnergyDisabled

public int getMaxEnergyDisabled()
Returns:
the maxEnergyDisabled

setHealth

public void setHealth(int health)
Parameters:
health - the health to set

getHealth

public int getHealth()
Returns:
the health

setMaxHealth

public void setMaxHealth(int maxHealth)
Parameters:
maxHealth - the maxHealth to set

getMaxHealth

public int getMaxHealth()
Returns:
the maxHealth

setStrength

public void setStrength(int strength)
Parameters:
strength - the strength to set

getStrength

public int getStrength()
Returns:
the strength

setVisibilityRange

public void setVisibilityRange(int visibilityRange)
Parameters:
visibilityRange - the visibilityRange to set

getVisibilityRange

public int getVisibilityRange()
Returns:
the visibilityRange

setLastInspection

public void setLastInspection(int lastInspected)
Parameters:
lastInspected - the lastInspected to set

getLastInspection

public int getLastInspection()
Returns:
the lastInspected

setTargetVertex

public void setTargetVertex(Vertex targetVertex)
Parameters:
targetVertex - the tar))getVertex to set

getTargetVertex

public Vertex getTargetVertex()
Returns:
the targetVertex

setLastUpdate

public void setLastUpdate(int lastUpdate)
Parameters:
lastUpdate - the lastUpdate to set

getLastUpdate

public int getLastUpdate()
Returns:
the lastUpdate

isOfTeam

public boolean isOfTeam(java.lang.String team)
Parameters:
team - the team which shall be checked
Returns:
  • true - if the agent is in the team,
  • false - otherwise.

toBelief

public apltk.interpreter.data.LogicBelief toBelief()
Specified by:
toBelief in interface Believable
Returns:
a logic belief which contains all information of the agent token.

setTargetAgent

public void setTargetAgent(AgentToken targetAgent)
Parameters:
targetAgent - the targetAgent to set

getTargetAgent

public AgentToken getTargetAgent()
Returns:
the targetAgent

setNextPosition

public void setNextPosition(Vertex nextPosition)
Parameters:
nextPosition - the nextPosition to set

getNextPosition

public Vertex getNextPosition()
Returns:
the nextPosition

isDisabled

public boolean isDisabled()

compareTo

public int compareTo(AgentToken t)
Specified by:
compareTo in interface java.lang.Comparable<AgentToken>

setLaststate

public void setLaststate(java.lang.String laststate)
Parameters:
laststate - the laststate to set

getLaststate

public java.lang.String getLaststate()
Returns:
the laststate

stateChanged

public boolean stateChanged()

setStrategyType

public void setStrategyType(int strategyType)
Parameters:
strategyType - the zoneBuildingState to set

getStrategyType

public int getStrategyType()
Returns:
the strategyType

isZoneBuilder

public boolean isZoneBuilder()

isAttacker

public boolean isAttacker()

isStrategyKnown

public boolean isStrategyKnown()

getStrategyTypeString

public java.lang.String getStrategyTypeString()
Returns:
the String representation of the strategy type.


Copyright © 2012. All Rights Reserved.