Package HAL.GridsAndAgents
Class AgentPT2D<T extends AgentGrid2D>
- java.lang.Object
-
- HAL.GridsAndAgents.AgentBase<T>
-
- HAL.GridsAndAgents.AgentBaseSpatial<T>
-
- HAL.GridsAndAgents.Agent2DBase<T>
-
- HAL.GridsAndAgents.AgentPT2D<T>
-
- Type Parameters:
T- the extended AgentGrid2D class that the agents will live in Created by rafael on 11/18/16.
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
SphericalAgent2D
public class AgentPT2D<T extends AgentGrid2D> extends Agent2DBase<T> implements java.io.Serializable
extend the AgentPT2D class if you want agents that exist on a 2D continuous lattice with the possibility of stacking multiple agents on the same typeGrid square- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AgentPT2D()
-
Method Summary
Modifier and Type Method Description intAge()returns the age of the agent, in ticks.voidDispose()removes the agent from the gridvoidMovePT(double newX, double newY)Moves the agent to the specified coordinatesvoidMoveSafePT(double newX, double newY)Similar to the move functions, only it will automatically either apply wraparound, or prevent moving along a partiular axis if movement would cause the agent to go out of bounds.voidMoveSafePT(double newX, double newY, Point2DBool IsValidMove)voidMoveSafeSQ(int newX, int newY)Similar to the move functions, only it will automatically either apply wraparound, or prevent moving along a partiular axis if movement would cause the agent to go out of bounds.voidMoveSafeSQ(int newX, int newY, Coords2DBool IsValidMove)voidMoveSQ(int i)Moves the agent to the center of the square at the specified coordinatesvoidMoveSQ(int newX, int newY)Moves the agent to the center of the square at the specified coordinatesdoubleXpt()returns the X coordinate of the agent.intXsq()returns the X index of the square that the agent is currently on.doubleYpt()returns the Y coordinate of the agent.intYsq()returns the Y index of the square that the agent is currently on.-
Methods inherited from class HAL.GridsAndAgents.Agent2DBase
DispX, DispY, Dist, DistSquared, MapEmptyHood, MapHood, MapHood, MapI, MapOccupiedHood, MapXpt, MapXsq, MapYpt, MapYsq
-
Methods inherited from class HAL.GridsAndAgents.AgentBaseSpatial
Isq
-
Methods inherited from class HAL.GridsAndAgents.AgentBase
BirthTick, IsAlive, SetBirthTick
-
-
-
-
Method Detail
-
MoveSQ
public void MoveSQ(int newX, int newY)Moves the agent to the center of the square at the specified coordinates
-
MoveSQ
public void MoveSQ(int i)
Moves the agent to the center of the square at the specified coordinates- Specified by:
MoveSQin classAgentBaseSpatial<T extends AgentGrid2D>
-
MovePT
public void MovePT(double newX, double newY)Moves the agent to the specified coordinates
-
MoveSafeSQ
public void MoveSafeSQ(int newX, int newY)Similar to the move functions, only it will automatically either apply wraparound, or prevent moving along a partiular axis if movement would cause the agent to go out of bounds.
-
MoveSafeSQ
public void MoveSafeSQ(int newX, int newY, Coords2DBool IsValidMove)
-
MoveSafePT
public void MoveSafePT(double newX, double newY)Similar to the move functions, only it will automatically either apply wraparound, or prevent moving along a partiular axis if movement would cause the agent to go out of bounds.
-
MoveSafePT
public void MoveSafePT(double newX, double newY, Point2DBool IsValidMove)
-
Xpt
public double Xpt()
returns the X coordinate of the agent. If the Agent is on-lattice, these functions will return the coordinates of the middle of the square that the agent is on.- Specified by:
Xptin classAgent2DBase<T extends AgentGrid2D>
-
Ypt
public double Ypt()
returns the Y coordinate of the agent. If the Agent is on-lattice, these functions will return the coordinates of the middle of the square that the agent is on.- Specified by:
Yptin classAgent2DBase<T extends AgentGrid2D>
-
Xsq
public int Xsq()
returns the X index of the square that the agent is currently on.- Specified by:
Xsqin classAgent2DBase<T extends AgentGrid2D>
-
Age
public int Age()
returns the age of the agent, in ticks. Be sure to use IncTick on the AgentGrid appropriately for this function to work.- Specified by:
Agein classAgentBase<T extends AgentGrid2D>
-
Ysq
public int Ysq()
returns the Y index of the square that the agent is currently on.- Specified by:
Ysqin classAgent2DBase<T extends AgentGrid2D>
-
Dispose
public void Dispose()
Description copied from class:AgentBaseremoves the agent from the grid- Specified by:
Disposein classAgentBase<T extends AgentGrid2D>
-
-