Package HAL.GridsAndAgents
Class Agent1DBase<T extends AgentGrid1D>
- java.lang.Object
-
- HAL.GridsAndAgents.AgentBase<T>
-
- HAL.GridsAndAgents.AgentBaseSpatial<T>
-
- HAL.GridsAndAgents.Agent1DBase<T>
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AgentPT1D
,AgentSQ1D
,AgentSQ1Dunstackable
public abstract class Agent1DBase<T extends AgentGrid1D> extends AgentBaseSpatial<T> implements java.io.Serializable
Agent1DBase functions are shared amongst all 1D agent types- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Agent1DBase()
-
Method Summary
Modifier and Type Method Description double
DispX(double x)
gets the X displacement from this agent to a given x positiondouble
Dist(double x)
gets the distance from this agent to another positiondouble
DistSquared(double x)
gets the distance squared from this agent to another position, included for completenessint
MapEmptyHood(int[] hood)
These functions are similar to the the MapHood function, but they will only include valid empty or occupied indices, and skip the others.int
MapHood(int[] hood)
This function takes a neighborhood (As generated by the neighborhood Util functions, or using GenHood2D/GenHood3D), translates the neighborhood coordinates to be centered around the agent, and computes the set of indices that the translated coordinates map to.int
MapHood(int[] hood, Coords1DBool Eval)
This function takes a neighborhood and another mapping function as argument, the mapping function should return a boolean that specifies whether coordinates map to a valid location.int
MapI(Grid1D other)
returns the index of the center of the square in otherGrid that the coordinate maps to.int
MapOccupiedHood(int[] hood)
These functions are similar to the the MapHood function, but they will only include valid empty or occupied indices, and skip the others.double
MapXpt(Grid1D other)
returns the provided coordinate scaled to the dimensions of the otherGrid.int
MapXsq(Grid1D other)
returns the index of the center of the square in otherGrid that the coordinate maps to.abstract double
Xpt()
returns the X coordinate of the agent.abstract int
Xsq()
returns the X index of the square that the agent is currently on.-
Methods inherited from class HAL.GridsAndAgents.AgentBaseSpatial
Isq, MoveSQ
-
-
-
-
Method Detail
-
Xsq
public abstract int Xsq()
returns the X index of the square that the agent is currently on.
-
Xpt
public abstract 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.
-
MapXsq
public int MapXsq(Grid1D other)
returns the index of the center of the square in otherGrid that the coordinate maps to.
-
MapI
public int MapI(Grid1D other)
returns the index of the center of the square in otherGrid that the coordinate maps to.
-
MapXpt
public double MapXpt(Grid1D other)
returns the provided coordinate scaled to the dimensions of the otherGrid.
-
MapHood
public int MapHood(int[] hood)
This function takes a neighborhood (As generated by the neighborhood Util functions, or using GenHood2D/GenHood3D), translates the neighborhood coordinates to be centered around the agent, and computes the set of indices that the translated coordinates map to. The function returns the number of valid locations it set, which if wraparound is disabled may be less than the full set of coordinate pairs. this means that the passed in ret list will not be completely filled with valid entries. See the CellStep function in the Complete Model example for more information.
-
MapEmptyHood
public int MapEmptyHood(int[] hood)
These functions are similar to the the MapHood function, but they will only include valid empty or occupied indices, and skip the others.
-
MapOccupiedHood
public int MapOccupiedHood(int[] hood)
These functions are similar to the the MapHood function, but they will only include valid empty or occupied indices, and skip the others.
-
MapHood
public int MapHood(int[] hood, Coords1DBool Eval)
This function takes a neighborhood and another mapping function as argument, the mapping function should return a boolean that specifies whether coordinates map to a valid location. the function will only include valid indices, and skip the others.
-
DispX
public double DispX(double x)
gets the X displacement from this agent to a given x position
-
Dist
public double Dist(double x)
gets the distance from this agent to another position
-
DistSquared
public double DistSquared(double x)
gets the distance squared from this agent to another position, included for completeness
-
-