public abstract class AbstractAgent extends Object implements Agent
| Modifier and Type | Field and Description |
|---|---|
protected Set<Cell> |
cells |
protected double |
currentCompetitiveness |
protected String |
id |
protected com.moseph.modelutils.fastdata.DoubleMap<Service> |
productivity |
protected Region |
region |
NOT_MANAGED, NOT_MANAGED_COMPETITION, NOT_MANAGED_ID| Constructor and Description |
|---|
AbstractAgent() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCell(Cell c)
Adds the cell to the cells this agent manages.
|
void |
die()
Called to remove the agent instance from the system.
|
int |
getAge()
Returns the agent's current age in years
|
Set<Cell> |
getCells()
Returns all the cells the agent manages
|
double |
getCompetitiveness()
Returns the agents current competitiveness.
|
Cell |
getHomeCell()
Return simply the first cell of an iterator of cells.
|
String |
getID()
Returns the agent's ID/type
|
Region |
getRegion() |
void |
giveUp() |
void |
removeCell(Cell c)
Removes the cell from the set the agent manages
|
void |
setAge(int a)
Sets the agent's current age
|
void |
setId(String id) |
void |
setRegion(Region r) |
void |
tickEndUpdate()
Called at the ending of each tick to allow the agent to do any internal
housekeeping
|
void |
tickStartUpdate()
Called at the beginning of each tick to allow the agent to do any internal housekeeping
|
boolean |
toRemove()
Returns true if this agent has lost all its cells and should be removed
|
String |
toString() |
void |
updateCompetitiveness()
Uses the current level of production in each Cell to update competitiveness (hence
independent of the Agent)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanTakeOver, considerGivingUp, getGivingIn, getGivingUp, getProductionModel, getType, infoString, setGivingIn, setGivingUp, supply, updateSupplyprotected String id
protected Region region
protected com.moseph.modelutils.fastdata.DoubleMap<Service> productivity
protected double currentCompetitiveness
public void addCell(Cell c)
AgentRegion.setOwnership(Agent, Cell...) to add cells since this
method is called by Region.setOwnership(Agent, Cell...)!public void removeCell(Cell c)
AgentremoveCell in interface Agentpublic double getCompetitiveness()
AgentgetCompetitiveness in interface Agentpublic Set<Cell> getCells()
Agentpublic Cell getHomeCell()
getHomeCell in interface AgentAgent.getHomeCell()public boolean toRemove()
Agentpublic void setId(String id)
public void tickStartUpdate()
AgenttickStartUpdate in interface Agentpublic void tickEndUpdate()
AgenttickEndUpdate in interface Agentpublic int getAge()
Agentpublic void setAge(int a)
Agentpublic void giveUp()
public void die()
Agentdie in interface AgentAgent.die()public void updateCompetitiveness()
updateCompetitiveness in interface Agent