Class AgentSQ3Dunstackable<T extends AgentGrid3D>

  • Type Parameters:
    T - the extended AgentGrid3D class that the agents will live in Created by rafael on 11/18/16.
    All Implemented Interfaces:
    java.io.Serializable

    public class AgentSQ3Dunstackable<T extends AgentGrid3D>
    extends Agent3DBase<T>
    implements java.io.Serializable
    extend the AgentSQ3D class if you want agents that exist on a 3D discrete lattice with the possibility of stacking multiple agents on the same typeGrid square
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class HAL.GridsAndAgents.AgentBase

        G
    • Method Summary

      Modifier and Type Method Description
      int Age()
      returns the age of the agent, in ticks.
      void Dispose()
      deletes the agent
      void MoveSafeSQ​(int newX, int newY, int newZ)
      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.
      void MoveSQ​(int i)
      Moves the agent to the specified coordinates
      void MoveSQ​(int x, int y, int z)
      Moves the agent to the specified coordinates
      void SwapPosition​(AgentSQ3Dunstackable<T> other)
      swaps the positions of two agents.
      double Xpt()
      gets the xDim coordinate of the agent
      int Xsq()
      gets the xDim coordinate of the square that the agent occupies
      double Ypt()
      gets the yDim coordinate of the agent
      int Ysq()
      gets the yDim coordinate of the square that the agent occupies
      double Zpt()
      gets the z coordinate of the agent
      int Zsq()
      gets the z coordinate of the square that the agent occupies
      • Methods inherited from class java.lang.Object

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

      • AgentSQ3Dunstackable

        public AgentSQ3Dunstackable()
    • Method Detail

      • MoveSQ

        public void MoveSQ​(int x,
                           int y,
                           int z)
        Moves the agent to the specified coordinates
      • Xsq

        public int Xsq()
        gets the xDim coordinate of the square that the agent occupies
        Specified by:
        Xsq in class Agent3DBase<T extends AgentGrid3D>
      • Ysq

        public int Ysq()
        gets the yDim coordinate of the square that the agent occupies
        Specified by:
        Ysq in class Agent3DBase<T extends AgentGrid3D>
      • Zsq

        public int Zsq()
        gets the z coordinate of the square that the agent occupies
        Specified by:
        Zsq in class Agent3DBase<T extends AgentGrid3D>
      • MoveSafeSQ

        public void MoveSafeSQ​(int newX,
                               int newY,
                               int newZ)
        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.
      • 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:
        Age in class AgentBase<T extends AgentGrid3D>
      • SwapPosition

        public void SwapPosition​(AgentSQ3Dunstackable<T> other)
        swaps the positions of two agents. useful for the AgentSQunstackable classes, which don't allow stacking of agents, making this maneuver otherwise impossible.