Class AgentGrid3D<T extends AgentBaseSpatial>

  • Type Parameters:
    T - the type of agent that the AgentGrid3D will hold
    All Implemented Interfaces:
    Grid3D, java.io.Serializable, java.lang.Iterable<T>

    public class AgentGrid3D<T extends AgentBaseSpatial>
    extends java.lang.Object
    implements Grid3D, java.lang.Iterable<T>, java.io.Serializable
    AgentGrid3Ds can hold any type of 3D Agent
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AgentGrid3D​(int x, int y, int z, java.lang.Class<T> agentClass)
      pass to the constructor the dimensions of the grid and the agent class type, written T.type where T is the name of the occupying agent class.
      AgentGrid3D​(int x, int y, int z, java.lang.Class<T> agentClass, boolean wrapX, boolean wrapY, boolean wrapZ)
      pass to the constructor the dimensions of the grid and the agent class type, written T.type where T is the name of the occupying agent class.
    • Method Summary

      Modifier and Type Method Description
      void _PassAgentConstructor​(java.lang.Class<T> agentClass)
      meant to be used specifically in conjunction with the LoadState Utils function.
      java.util.List<T> AllAgents()
      returns the list of all agents as an unmodifiable list
      java.util.List<T> AllDeads()
      returns the list of all dead agents as an unmodifiable list
      int ApplyAgentsRad​(double rad, double x, double y, double z, AgentRadDispToAction3D<T> action)
      applies AgentRadDispToAction2D function to all agents within radius
      void CleanAgents()
      cleans the list of agents, removing dead ones, may improve the efficiency of the agent iteration if many agents have died do not call this while in the middle of iteration
      void CleanShuffle​(Rand rn)
      calls CleanAgents, then ShuffleAgents
      T GetAgent​(int index)
      Gets a single agent at the specified grid square, beware using this function with stackable agents, as it will only return one of the stack of agents.
      T GetAgent​(int x, int y, int z)
      Gets a single agent at the specified grid square, beware using this function with stackable agents, as it will only return one of the stack of agents.
      void GetAgents​(java.util.ArrayList<T> retAgentList, int index)
      appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      void GetAgents​(java.util.ArrayList<T> retAgentList, int x, int y, int z)
      appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      void GetAgents​(java.util.ArrayList<T> retAgentList, int x, int y, int z, AgentToBool<T> evalAgent)
      appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      void GetAgents​(java.util.ArrayList<T> retAgentList, int i, AgentToBool<T> evalAgent)
      appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      T GetAgentSafe​(int x, int y, int z)
      Same as GetAgent above, but if x or y are outside the domain, it will apply wrap around if wrapping is enabled, or return null.
      void GetAgentsHood​(java.util.ArrayList<T> retAgentList, int[] hood, int centerX, int centerY, int centerZ)
      gets all agents within the given neighborhood and adds them to the ArrayList argument
      void GetAgentsHood​(java.util.ArrayList<T> retAgentList, int[] hood, int centerX, int centerY, int centerZ, AgentToBool<T> EvalAgent)
      gets all agents within the given neighborhood forwhich EvalAgent returns true and adds them to the ArrayList argument
      void GetAgentsHoodMapped​(java.util.ArrayList<T> retAgentList, int[] hood, int hoodLen)
      gets all agents in the provided neighborhood, assumes that the neighborhood has already been mapped to a location
      void GetAgentsHoodMapped​(java.util.ArrayList<T> retAgentList, int[] hood, int hoodLen, AgentToBool<T> EvalAgent)
      gets all agents in the provided neighborhood, assumes that the neighborhood has already been mapped to a location
      void GetAgentsRad​(java.util.ArrayList<T> retAgentList, double x, double y, double z, double rad)
      gets all agents that are within rad, and adds them to the ArrayList
      void GetAgentsRad​(java.util.ArrayList<T> retAgentList, double x, double y, double z, double rad, AgentToBool<T> EvalAgent)
      gets all agents that are within rad forwhich EvalAgent returns true, and adds them to the ArrayList
      void GetAgentsRad​(java.util.ArrayList<T> retAgentList, java.util.ArrayList<double[]> displacementInfo, double x, double y, double z, double rad)
      gets all agents that are within rad, and adds them to the ArrayList
      void GetAgentsRad​(java.util.ArrayList<T> retAgentList, java.util.ArrayList<double[]> displacementInfo, double x, double y, double z, double rad, AgentToBool<T> EvalAgent)
      gets all agents that are within rad forwhich EvalAgent returns true, and adds them to the ArrayList
      void GetAgentsRect​(java.util.ArrayList<T> retAgentList, int x, int y, int z, int width, int height, int depth)
      gets all agents within the rectangle argument defined by the bottom corner and the dimension arguments
      void GetAgentsRect​(java.util.ArrayList<T> retAgentList, int x, int y, int z, int width, int height, int depth, AgentToBool<T> EvalAgent)
      gets all agents forwhich evalAgent returns true within the rectangle argument defined by the bottom corner and the dimension arguments
      void GetAgentsSafe​(java.util.ArrayList<T> retAgentList, int x, int y, int z)
      appends to the provided arraylist all agents on the square at the specified coordinates, will apply wraparound if the coordinates are outside the domain
      void GetAgentsSafe​(java.util.ArrayList<T> retAgentList, int x, int y, int z, AgentToBool<T> EvalAgent)
      appends to the provided arraylist all agents on the square at the specified coordinates forwhich EvalAgent returns true, will apply wraparound if the coordinates are outside the domain
      int GetTick()
      gets the current grid timestep.
      void IncTick()
      increments the internal grid tick counter by 1, used with the Age() and BirthTick() functions to get age information about the agents on an AgentGrid.
      boolean IsWrapX()  
      boolean IsWrapY()  
      boolean IsWrapZ()  
      java.lang.Iterable<T> IterAgents​(int i)
      iterates over all agents at position
      java.lang.Iterable<T> IterAgents​(int x, int y, int z)
      iterates over all agents at position
      java.lang.Iterable<T> IterAgentsHood​(int[] hood, int centerI)
      iterates over all agents found in a neighborhood after mapping
      java.lang.Iterable<T> IterAgentsHood​(int[] hood, int centerX, int centerY, int centerZ)
      iterates over all agents found in a neighborhood after mapping
      java.lang.Iterable<T> IterAgentsHoodMapped​(int[] hood, int hoodLen)
      iterates over all agents found in an already mapped neighborhood
      java.lang.Iterable<T> IterAgentsRad​(double x, double y, double z, double rad)
      iterates over all agents within radius
      java.lang.Iterable<T> IterAgentsRadApprox​(double x, double y, double z, double rad)
      iterates over all agents within radius, will include some over rad as well, use a second distance check to filter these
      java.lang.Iterable<T> IterAgentsRect​(int x, int y, int z, int width, int height, int depth)
      iterates over all agents in the rectangle defined by (x,y) as the lower left corner, and (x+width,y+height) as the top right corner.
      java.lang.Iterable<T> IterAgentsSafe​(int x, int y, int z)
      Same as IterAgents above, but will apply wraparound if x,y fall outside the grid dimensions.
      java.util.Iterator<T> iterator()  
      int Length()  
      int MapEmptyHood​(int[] hood, int centerI)
      similar to the MapHood function, but will only include indices of locations that are empty
      int MapEmptyHood​(int[] hood, int centerX, int centerY, int centerZ)
      similar to the MapHood function, but will only include indices of locations that are empty
      int MapOccupiedHood​(int[] hood, int centerI)
      similar to the MapHood function, but will only include indices of locations that are occupied
      int MapOccupiedHood​(int[] hood, int centerX, int centerY, int centerZ)
      similar to the MapHood function, but will only include indices of locations that are occupied
      T NewAgentPT​(double x, double y, double z)
      returns an uninitialized agent at the specified coordinates
      T NewAgentPTSafe​(double newX, double newY, double newZ)
      returns an uninitialized agent at the specified coordinates, will apply wraparound if the coordinates are outside the domain
      T NewAgentPTSafe​(double newX, double newY, double newZ, double fallbackX, double fallbackY, double fallbackZ)
      returns an uninitialized agent at the specified coordinates, will apply wraparound or use the fallback if the coordinates are outside the domain
      T NewAgentSQ​(int index)
      returns an uninitialized agent at the specified index
      T NewAgentSQ​(int x, int y, int z)
      returns an uninitialized agent at the specified coordinates
      int Pop()
      returns the number of agents that are alive in the grid
      int PopAt​(int i)
      gets the population at a specific location
      int PopAt​(int x, int y, int z)
      gets the population at a specific location
      int PopAt​(int x, int y, int z, AgentToBool EvalAgent)
      gets the population at a specific location, subsetting to only those for which EvalAgent returns true
      int PopAt​(int i, AgentToBool EvalAgent)
      gets the population at a specific location, subsetting to only those for which EvalAgent returns true
      T RandomAgent​(int x, int y, int z, Rand rn)
      returns a single random agent from the provided coordinates
      T RandomAgent​(int x, int y, int z, Rand rn, AgentToBool<T> EvalAgent)
      returns a single random agent from the provided coordinates forwhich EvalAgent returns true
      T RandomAgent​(int i, Rand rn)
      returns a single random agent from the provided coordinates
      T RandomAgent​(int i, Rand rn, AgentToBool<T> EvalAgent)
      returns a single random agent from the provided coordinates forwhich EvalAgent returns true
      T RandomAgent​(Rand rn)
      gets a random agent from the grid, be careful not to use this during iteration over the grid
      T RandomAgentHood​(int[] hood, int x, int y, int z, Rand rn)
      returns a single random agent from the set of all agents within the specified neighborhood
      T RandomAgentHood​(int[] hood, int x, int y, int z, Rand rn, AgentToBool<T> EvalAgent)
      returns a single random agent from the set of all agents within the specified neighborhood forwhich EvalAgent returns true
      T RandomAgentHoodMapped​(int[] hood, int hoodLen, Rand rn)
      returns a single random agent from the set of all agents within the specified neighborhood, assumes the neighborhood has already been mapped
      T RandomAgentHoodMapped​(int[] hood, int hoodLen, Rand rn, AgentToBool<T> EvalAgent)
      returns a single random agent from the set of all agents within the specified neighborhood forwhich EvalAgent returns true, assumes the neighborhood has already been mapped
      T RandomAgentRad​(double x, double y, double z, double rad, Rand rn)
      returns a single random agent from the set of all agents within the specified radius
      T RandomAgentRad​(double x, double y, double z, double rad, Rand rn, AgentToBool<T> EvalAgent)
      returns a single random agent from the set of all agents within the specified radius
      T RandomAgentRect​(int x, int y, int z, int width, int height, int depth, Rand rn)
      returns a single random agent from the set of all agents within the specified rectangle
      T RandomAgentRect​(int x, int y, int z, int width, int height, int depth, Rand rn, AgentToBool<T> EvalAgent)
      returns a single random agent from the set of all agents within the specified rectangle forwhich EvalAgent returns true
      T RandomAgentSafe​(int x, int y, int z, Rand rn)
      returns a single random agent, will apply wraparound if the coordiantes are outside of the grid
      T RandomAgentSafe​(int x, int y, int z, Rand rn, AgentToBool<T> EvalAgent)
      returns a single random agent that satisfies EvalAgent, will apply wraparound if the coordiantes are outside of the grid
      void Reset()
      calls dispose on all agents in the typeGrid, resets the tick timer to 0.
      void ResetHard()
      calls dispose on all agents and completely resets the internal agentlist, also resets the tick timer to 0.
      void ResetTick()
      sets the tick to 0.
      void ShuffleAgents​(Rand rn)
      shuffles the agent list to randomize iteration.
      int Xdim()  
      int Ydim()  
      int Zdim()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • xDim

        public final int xDim
      • yDim

        public final int yDim
      • zDim

        public final int zDim
      • length

        public final int length
      • wrapX

        public boolean wrapX
      • wrapY

        public boolean wrapY
      • wrapZ

        public boolean wrapZ
    • Constructor Detail

      • AgentGrid3D

        public AgentGrid3D​(int x,
                           int y,
                           int z,
                           java.lang.Class<T> agentClass,
                           boolean wrapX,
                           boolean wrapY,
                           boolean wrapZ)
        pass to the constructor the dimensions of the grid and the agent class type, written T.type where T is the name of the occupying agent class. the wrap booleans specify whether to domain should use wraparound or stop at the boundary
      • AgentGrid3D

        public AgentGrid3D​(int x,
                           int y,
                           int z,
                           java.lang.Class<T> agentClass)
        pass to the constructor the dimensions of the grid and the agent class type, written T.type where T is the name of the occupying agent class.
    • Method Detail

      • _PassAgentConstructor

        public void _PassAgentConstructor​(java.lang.Class<T> agentClass)
        meant to be used specifically in conjunction with the LoadState Utils function. LoadState won't by default setup the grid constructor, so this function must be called as well for the loaded grid to be able to create more agents. pass in the same class argument as is normally used by the grid constructor
      • NewAgentSQ

        public T NewAgentSQ​(int x,
                            int y,
                            int z)
        returns an uninitialized agent at the specified coordinates
      • NewAgentPT

        public T NewAgentPT​(double x,
                            double y,
                            double z)
        returns an uninitialized agent at the specified coordinates
      • NewAgentSQ

        public T NewAgentSQ​(int index)
        returns an uninitialized agent at the specified index
      • NewAgentPTSafe

        public T NewAgentPTSafe​(double newX,
                                double newY,
                                double newZ)
        returns an uninitialized agent at the specified coordinates, will apply wraparound if the coordinates are outside the domain
      • NewAgentPTSafe

        public T NewAgentPTSafe​(double newX,
                                double newY,
                                double newZ,
                                double fallbackX,
                                double fallbackY,
                                double fallbackZ)
        returns an uninitialized agent at the specified coordinates, will apply wraparound or use the fallback if the coordinates are outside the domain
      • CleanShuffle

        public void CleanShuffle​(Rand rn)
        calls CleanAgents, then ShuffleAgents
      • ShuffleAgents

        public void ShuffleAgents​(Rand rn)
        shuffles the agent list to randomize iteration. do not call this while in the middle of iteration
      • CleanAgents

        public void CleanAgents()
        cleans the list of agents, removing dead ones, may improve the efficiency of the agent iteration if many agents have died do not call this while in the middle of iteration
      • MapEmptyHood

        public int MapEmptyHood​(int[] hood,
                                int centerX,
                                int centerY,
                                int centerZ)
        similar to the MapHood function, but will only include indices of locations that are empty
      • MapEmptyHood

        public int MapEmptyHood​(int[] hood,
                                int centerI)
        similar to the MapHood function, but will only include indices of locations that are empty
      • MapOccupiedHood

        public int MapOccupiedHood​(int[] hood,
                                   int centerX,
                                   int centerY,
                                   int centerZ)
        similar to the MapHood function, but will only include indices of locations that are occupied
      • MapOccupiedHood

        public int MapOccupiedHood​(int[] hood,
                                   int centerI)
        similar to the MapHood function, but will only include indices of locations that are occupied
      • AllAgents

        public java.util.List<T> AllAgents()
        returns the list of all agents as an unmodifiable list
      • AllDeads

        public java.util.List<T> AllDeads()
        returns the list of all dead agents as an unmodifiable list
      • GetAgent

        public T GetAgent​(int x,
                          int y,
                          int z)
        Gets a single agent at the specified grid square, beware using this function with stackable agents, as it will only return one of the stack of agents. This function is recommended for the Unstackable Agents, as it tends to perform better than the other methods for single agent accesses.
      • GetAgentSafe

        public T GetAgentSafe​(int x,
                              int y,
                              int z)
        Same as GetAgent above, but if x or y are outside the domain, it will apply wrap around if wrapping is enabled, or return null.
      • GetAgent

        public T GetAgent​(int index)
        Gets a single agent at the specified grid square, beware using this function with stackable agents, as it will only return one of the stack of agents. This function is recommended for the Unstackable Agents, as it tends to perform better than the other methods for single agent accesses.
      • GetAgentsRect

        public void GetAgentsRect​(java.util.ArrayList<T> retAgentList,
                                  int x,
                                  int y,
                                  int z,
                                  int width,
                                  int height,
                                  int depth)
        gets all agents within the rectangle argument defined by the bottom corner and the dimension arguments
      • GetAgentsRect

        public void GetAgentsRect​(java.util.ArrayList<T> retAgentList,
                                  int x,
                                  int y,
                                  int z,
                                  int width,
                                  int height,
                                  int depth,
                                  AgentToBool<T> EvalAgent)
        gets all agents forwhich evalAgent returns true within the rectangle argument defined by the bottom corner and the dimension arguments
      • GetAgentsHood

        public void GetAgentsHood​(java.util.ArrayList<T> retAgentList,
                                  int[] hood,
                                  int centerX,
                                  int centerY,
                                  int centerZ)
        gets all agents within the given neighborhood and adds them to the ArrayList argument
      • GetAgentsHood

        public void GetAgentsHood​(java.util.ArrayList<T> retAgentList,
                                  int[] hood,
                                  int centerX,
                                  int centerY,
                                  int centerZ,
                                  AgentToBool<T> EvalAgent)
        gets all agents within the given neighborhood forwhich EvalAgent returns true and adds them to the ArrayList argument
      • GetAgentsHoodMapped

        public void GetAgentsHoodMapped​(java.util.ArrayList<T> retAgentList,
                                        int[] hood,
                                        int hoodLen)
        gets all agents in the provided neighborhood, assumes that the neighborhood has already been mapped to a location
      • GetAgentsHoodMapped

        public void GetAgentsHoodMapped​(java.util.ArrayList<T> retAgentList,
                                        int[] hood,
                                        int hoodLen,
                                        AgentToBool<T> EvalAgent)
        gets all agents in the provided neighborhood, assumes that the neighborhood has already been mapped to a location
      • GetAgentsRad

        public void GetAgentsRad​(java.util.ArrayList<T> retAgentList,
                                 double x,
                                 double y,
                                 double z,
                                 double rad)
        gets all agents that are within rad, and adds them to the ArrayList
      • GetAgentsRad

        public void GetAgentsRad​(java.util.ArrayList<T> retAgentList,
                                 double x,
                                 double y,
                                 double z,
                                 double rad,
                                 AgentToBool<T> EvalAgent)
        gets all agents that are within rad forwhich EvalAgent returns true, and adds them to the ArrayList
      • GetAgentsRad

        public void GetAgentsRad​(java.util.ArrayList<T> retAgentList,
                                 java.util.ArrayList<double[]> displacementInfo,
                                 double x,
                                 double y,
                                 double z,
                                 double rad)
        gets all agents that are within rad, and adds them to the ArrayList
      • GetAgentsRad

        public void GetAgentsRad​(java.util.ArrayList<T> retAgentList,
                                 java.util.ArrayList<double[]> displacementInfo,
                                 double x,
                                 double y,
                                 double z,
                                 double rad,
                                 AgentToBool<T> EvalAgent)
        gets all agents that are within rad forwhich EvalAgent returns true, and adds them to the ArrayList
      • Reset

        public void Reset()
        calls dispose on all agents in the typeGrid, resets the tick timer to 0.
      • ResetHard

        public void ResetHard()
        calls dispose on all agents and completely resets the internal agentlist, also resets the tick timer to 0.
      • PopAt

        public int PopAt​(int i)
        gets the population at a specific location
      • PopAt

        public int PopAt​(int x,
                         int y,
                         int z)
        gets the population at a specific location
      • PopAt

        public int PopAt​(int i,
                         AgentToBool EvalAgent)
        gets the population at a specific location, subsetting to only those for which EvalAgent returns true
      • PopAt

        public int PopAt​(int x,
                         int y,
                         int z,
                         AgentToBool EvalAgent)
        gets the population at a specific location, subsetting to only those for which EvalAgent returns true
      • ApplyAgentsRad

        public int ApplyAgentsRad​(double rad,
                                  double x,
                                  double y,
                                  double z,
                                  AgentRadDispToAction3D<T> action)
        applies AgentRadDispToAction2D function to all agents within radius
      • RandomAgent

        public T RandomAgent​(Rand rn)
        gets a random agent from the grid, be careful not to use this during iteration over the grid
      • GetAgents

        public void GetAgents​(java.util.ArrayList<T> retAgentList,
                              int x,
                              int y,
                              int z)
        appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      • GetAgents

        public void GetAgents​(java.util.ArrayList<T> retAgentList,
                              int index)
        appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      • GetAgents

        public void GetAgents​(java.util.ArrayList<T> retAgentList,
                              int x,
                              int y,
                              int z,
                              AgentToBool<T> evalAgent)
        appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      • GetAgents

        public void GetAgents​(java.util.ArrayList<T> retAgentList,
                              int i,
                              AgentToBool<T> evalAgent)
        appends to the provided arraylist all agents on the square at the specified coordinates, will subset only agents for which EvalAgent returns true
      • GetAgentsSafe

        public void GetAgentsSafe​(java.util.ArrayList<T> retAgentList,
                                  int x,
                                  int y,
                                  int z)
        appends to the provided arraylist all agents on the square at the specified coordinates, will apply wraparound if the coordinates are outside the domain
      • GetAgentsSafe

        public void GetAgentsSafe​(java.util.ArrayList<T> retAgentList,
                                  int x,
                                  int y,
                                  int z,
                                  AgentToBool<T> EvalAgent)
        appends to the provided arraylist all agents on the square at the specified coordinates forwhich EvalAgent returns true, will apply wraparound if the coordinates are outside the domain
      • Pop

        public int Pop()
        returns the number of agents that are alive in the grid
      • IterAgents

        public java.lang.Iterable<T> IterAgents​(int x,
                                                int y,
                                                int z)
        iterates over all agents at position
      • IterAgentsSafe

        public java.lang.Iterable<T> IterAgentsSafe​(int x,
                                                    int y,
                                                    int z)
        Same as IterAgents above, but will apply wraparound if x,y fall outside the grid dimensions.
      • IterAgents

        public java.lang.Iterable<T> IterAgents​(int i)
        iterates over all agents at position
      • IterAgentsRadApprox

        public java.lang.Iterable<T> IterAgentsRadApprox​(double x,
                                                         double y,
                                                         double z,
                                                         double rad)
        iterates over all agents within radius, will include some over rad as well, use a second distance check to filter these
      • IterAgentsRad

        public java.lang.Iterable<T> IterAgentsRad​(double x,
                                                   double y,
                                                   double z,
                                                   double rad)
        iterates over all agents within radius
      • IterAgentsRect

        public java.lang.Iterable<T> IterAgentsRect​(int x,
                                                    int y,
                                                    int z,
                                                    int width,
                                                    int height,
                                                    int depth)
        iterates over all agents in the rectangle defined by (x,y) as the lower left corner, and (x+width,y+height) as the top right corner.
      • IterAgentsHood

        public java.lang.Iterable<T> IterAgentsHood​(int[] hood,
                                                    int centerX,
                                                    int centerY,
                                                    int centerZ)
        iterates over all agents found in a neighborhood after mapping
      • IterAgentsHood

        public java.lang.Iterable<T> IterAgentsHood​(int[] hood,
                                                    int centerI)
        iterates over all agents found in a neighborhood after mapping
      • IterAgentsHoodMapped

        public java.lang.Iterable<T> IterAgentsHoodMapped​(int[] hood,
                                                          int hoodLen)
        iterates over all agents found in an already mapped neighborhood
      • RandomAgentSafe

        public T RandomAgentSafe​(int x,
                                 int y,
                                 int z,
                                 Rand rn)
        returns a single random agent, will apply wraparound if the coordiantes are outside of the grid
      • RandomAgentSafe

        public T RandomAgentSafe​(int x,
                                 int y,
                                 int z,
                                 Rand rn,
                                 AgentToBool<T> EvalAgent)
        returns a single random agent that satisfies EvalAgent, will apply wraparound if the coordiantes are outside of the grid
      • RandomAgent

        public T RandomAgent​(int x,
                             int y,
                             int z,
                             Rand rn)
        returns a single random agent from the provided coordinates
      • RandomAgent

        public T RandomAgent​(int x,
                             int y,
                             int z,
                             Rand rn,
                             AgentToBool<T> EvalAgent)
        returns a single random agent from the provided coordinates forwhich EvalAgent returns true
      • RandomAgent

        public T RandomAgent​(int i,
                             Rand rn)
        returns a single random agent from the provided coordinates
      • RandomAgent

        public T RandomAgent​(int i,
                             Rand rn,
                             AgentToBool<T> EvalAgent)
        returns a single random agent from the provided coordinates forwhich EvalAgent returns true
      • RandomAgentRad

        public T RandomAgentRad​(double x,
                                double y,
                                double z,
                                double rad,
                                Rand rn)
        returns a single random agent from the set of all agents within the specified radius
      • RandomAgentRad

        public T RandomAgentRad​(double x,
                                double y,
                                double z,
                                double rad,
                                Rand rn,
                                AgentToBool<T> EvalAgent)
        returns a single random agent from the set of all agents within the specified radius
      • RandomAgentRect

        public T RandomAgentRect​(int x,
                                 int y,
                                 int z,
                                 int width,
                                 int height,
                                 int depth,
                                 Rand rn)
        returns a single random agent from the set of all agents within the specified rectangle
      • RandomAgentRect

        public T RandomAgentRect​(int x,
                                 int y,
                                 int z,
                                 int width,
                                 int height,
                                 int depth,
                                 Rand rn,
                                 AgentToBool<T> EvalAgent)
        returns a single random agent from the set of all agents within the specified rectangle forwhich EvalAgent returns true
      • RandomAgentHood

        public T RandomAgentHood​(int[] hood,
                                 int x,
                                 int y,
                                 int z,
                                 Rand rn)
        returns a single random agent from the set of all agents within the specified neighborhood
      • RandomAgentHood

        public T RandomAgentHood​(int[] hood,
                                 int x,
                                 int y,
                                 int z,
                                 Rand rn,
                                 AgentToBool<T> EvalAgent)
        returns a single random agent from the set of all agents within the specified neighborhood forwhich EvalAgent returns true
      • RandomAgentHoodMapped

        public T RandomAgentHoodMapped​(int[] hood,
                                       int hoodLen,
                                       Rand rn)
        returns a single random agent from the set of all agents within the specified neighborhood, assumes the neighborhood has already been mapped
      • RandomAgentHoodMapped

        public T RandomAgentHoodMapped​(int[] hood,
                                       int hoodLen,
                                       Rand rn,
                                       AgentToBool<T> EvalAgent)
        returns a single random agent from the set of all agents within the specified neighborhood forwhich EvalAgent returns true, assumes the neighborhood has already been mapped
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T extends AgentBaseSpatial>
      • Xdim

        public int Xdim()
        Specified by:
        Xdim in interface Grid3D
      • Ydim

        public int Ydim()
        Specified by:
        Ydim in interface Grid3D
      • Zdim

        public int Zdim()
        Specified by:
        Zdim in interface Grid3D
      • Length

        public int Length()
        Specified by:
        Length in interface Grid3D
      • IsWrapX

        public boolean IsWrapX()
        Specified by:
        IsWrapX in interface Grid3D
      • IsWrapY

        public boolean IsWrapY()
        Specified by:
        IsWrapY in interface Grid3D
      • IsWrapZ

        public boolean IsWrapZ()
        Specified by:
        IsWrapZ in interface Grid3D
      • IncTick

        public void IncTick()
        increments the internal grid tick counter by 1, used with the Age() and BirthTick() functions to get age information about the agents on an AgentGrid. can otherwise be used as a counter with the other grid types.
      • GetTick

        public int GetTick()
        gets the current grid timestep.
      • ResetTick

        public void ResetTick()
        sets the tick to 0.