Class Agent2DBase<T extends AgentGrid2D>

    • Field Summary

      • Fields inherited from class HAL.GridsAndAgents.AgentBase

        G
    • Constructor Summary

      Constructors 
      Constructor Description
      Agent2DBase()  
    • Method Summary

      Modifier and Type Method Description
      double DispX​(double x)
      gets the X displacement from this agent to a given x position
      double DispY​(double y)
      gets the Y displacement from this agent to a given y position
      double Dist​(double x, double y)
      gets the distance from this agent to another position
      double DistSquared​(double x, double y)
      gets the distance squared from this agent to another position, more efficient than Dist
      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.
      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, IndexCoords2DBool 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​(Grid2D 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​(Grid2D other)
      returns the provided coordinate scaled to the dimensions of the otherGrid.
      int MapXsq​(Grid2D other)
      returns the index of the center of the square in otherGrid that the coordinate maps to.
      double MapYpt​(Grid2D other)
      returns the provided coordinate scaled to the dimensions of the otherGrid.
      int MapYsq​(Grid2D 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.
      abstract double Ypt()
      returns the Y coordinate of the agent.
      abstract int Ysq()
      returns the Y index of the square that the agent is currently on.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Agent2DBase

        public Agent2DBase()
    • Method Detail

      • Xsq

        public abstract int Xsq()
        returns the X index of the square that the agent is currently on.
      • Ysq

        public abstract int Ysq()
        returns the Y 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.
      • Ypt

        public abstract 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.
      • MapXsq

        public int MapXsq​(Grid2D other)
        returns the index of the center of the square in otherGrid that the coordinate maps to.
      • MapYsq

        public int MapYsq​(Grid2D other)
        returns the index of the center of the square in otherGrid that the coordinate maps to.
      • MapI

        public int MapI​(Grid2D other)
        returns the index of the center of the square in otherGrid that the coordinate maps to.
      • MapXpt

        public double MapXpt​(Grid2D other)
        returns the provided coordinate scaled to the dimensions of the otherGrid.
      • MapYpt

        public double MapYpt​(Grid2D 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,
                           IndexCoords2DBool 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
      • DispY

        public double DispY​(double y)
        gets the Y displacement from this agent to a given y position
      • Dist

        public double Dist​(double x,
                           double y)
        gets the distance from this agent to another position
      • DistSquared

        public double DistSquared​(double x,
                                  double y)
        gets the distance squared from this agent to another position, more efficient than Dist