Package HAL.GridsAndAgents
Class AgentBase<T>
- java.lang.Object
-
- HAL.GridsAndAgents.AgentBase<T>
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
Agent0D,AgentBaseSpatial
public abstract class AgentBase<T> extends java.lang.Object implements java.io.SerializableAgentBase functions are shared amongst all agent types- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AgentBase()
-
Method Summary
Modifier and Type Method Description abstract intAge()returns the age of the agent, in ticks.intBirthTick()returns the tick on which the agent was bornabstract voidDispose()removes the agent from the gridbooleanIsAlive()Returns whether the agent is alive or has been disposedvoidSetBirthTick(int tick)sets the agent's birthtick value, which is used for the Age calculation
-
-
-
Field Detail
-
G
public final T G
returns the grid that the agent belongs to (this is a permanent agent property, not a function)
-
-
Method Detail
-
IsAlive
public boolean IsAlive()
Returns whether the agent is alive or has been disposed
-
BirthTick
public int BirthTick()
returns the tick on which the agent was born
-
SetBirthTick
public void SetBirthTick(int tick)
sets the agent's birthtick value, which is used for the Age calculation
-
Age
public abstract int Age()
returns the age of the agent, in ticks. Be sure to use IncTick on the AgentGrid appropriately for this function to work.
-
Dispose
public abstract void Dispose()
removes the agent from the grid
-
-