Class Agent1DBase<T extends AgentGrid1D>

    • Field Summary

      • Fields inherited from class HAL.GridsAndAgents.AgentBase

        G
    • 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 position
      double Dist​(double x)
      gets the distance from this agent to another position
      double DistSquared​(double x)
      gets the distance squared from this agent to another position, included for completeness
      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, 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 java.lang.Object

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

      • Agent1DBase

        public Agent1DBase()
    • 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