Package HAL.GridsAndAgents
Class AgentSQ1Dunstackable<T extends AgentGrid1D>
- java.lang.Object
-
- HAL.GridsAndAgents.AgentBase<T>
-
- HAL.GridsAndAgents.AgentBaseSpatial<T>
-
- HAL.GridsAndAgents.Agent1DBase<T>
-
- HAL.GridsAndAgents.AgentSQ1Dunstackable<T>
-
- Type Parameters:
T
- the extended Grid2unstackable class that the agents will live in Created by rafael on 11/18/16.
- All Implemented Interfaces:
java.io.Serializable
public class AgentSQ1Dunstackable<T extends AgentGrid1D> extends Agent1DBase<T> implements java.io.Serializable
extend the AgentSQ2Dunstackable class if you want agents that exist on a 2D discrete lattice without the possibility of stacking multiple agents on the same typeGrid square- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AgentSQ1Dunstackable()
-
Method Summary
Modifier and Type Method Description int
Age()
Gets the index of the square that the agent occupiesvoid
Dispose()
Deletes the agentvoid
GetAllOnSquare(java.util.ArrayList<AgentBaseSpatial> putHere)
int
Isq()
returns the index of the square that the agent is currently onvoid
MoveSafeSQ(int newX)
Moves the agent to the specified square, will apply wraparound if it is enabledvoid
MoveSQ(int x)
Moves the agent to the square with the specified indexvoid
SwapPosition(AgentSQ1Dunstackable<T> other)
swaps the positions of two agents.double
Xpt()
Gets the xDim coordinate agentint
Xsq()
Gets the xDim coordinate of the square that the agent occupies-
Methods inherited from class HAL.GridsAndAgents.Agent1DBase
DispX, Dist, DistSquared, MapEmptyHood, MapHood, MapHood, MapI, MapOccupiedHood, MapXpt, MapXsq
-
Methods inherited from class HAL.GridsAndAgents.AgentBase
BirthTick, IsAlive, SetBirthTick
-
-
-
-
Method Detail
-
MoveSQ
public void MoveSQ(int x)
Moves the agent to the square with the specified index- Specified by:
MoveSQ
in classAgentBaseSpatial<T extends AgentGrid1D>
-
MoveSafeSQ
public void MoveSafeSQ(int newX)
Moves the agent to the specified square, will apply wraparound if it is enabled
-
Xsq
public int Xsq()
Gets the xDim coordinate of the square that the agent occupies- Specified by:
Xsq
in classAgent1DBase<T extends AgentGrid1D>
-
Xpt
public double Xpt()
Gets the xDim coordinate agent- Specified by:
Xpt
in classAgent1DBase<T extends AgentGrid1D>
-
Dispose
public void Dispose()
Deletes the agent- Specified by:
Dispose
in classAgentBase<T extends AgentGrid1D>
-
GetAllOnSquare
public void GetAllOnSquare(java.util.ArrayList<AgentBaseSpatial> putHere)
-
Age
public int Age()
Gets the index of the square that the agent occupies- Specified by:
Age
in classAgentBase<T extends AgentGrid1D>
-
Isq
public int Isq()
Description copied from class:AgentBaseSpatial
returns the index of the square that the agent is currently on- Overrides:
Isq
in classAgentBaseSpatial<T extends AgentGrid1D>
-
SwapPosition
public void SwapPosition(AgentSQ1Dunstackable<T> other)
swaps the positions of two agents. useful for the AgentSQunstackable classes, which don't allow stacking of agents, making this maneuver otherwise impossible.
-
-