Class GridAgent

All Implemented Interfaces:
MessageListener, HasFineGridPosition, HasGridPosition, HasStep, SimulationListener, Drawable
Direct Known Subclasses:
Beacon, EmbodiedAgent

public class GridAgent extends DrawableAgent implements HasFineGridPosition
  • Constructor Details

    • GridAgent

      public GridAgent()
    • GridAgent

      public GridAgent(String gridLayerName)
    • GridAgent

      public GridAgent(Behavior... behaviors)
    • GridAgent

      public GridAgent(List<Behavior> behaviors)
  • Method Details

    • getCellX

      public int getCellX()
      Specified by:
      getCellX in interface HasGridPosition
    • getCellY

      public int getCellY()
      Specified by:
      getCellY in interface HasGridPosition
    • getFineX

      public double getFineX()
      Specified by:
      getFineX in interface HasFineGridPosition
    • getFineY

      public double getFineY()
      Specified by:
      getFineY in interface HasFineGridPosition
    • getGridPosition

      public GridPosition getGridPosition()
    • getHeading

      public double getHeading()
      Specified by:
      getHeading in interface HasGridPosition
    • setCellX

      public void setCellX(int x)
      Specified by:
      setCellX in interface HasGridPosition
    • setCellY

      public void setCellY(int y)
      Specified by:
      setCellY in interface HasGridPosition
    • setFineX

      public void setFineX(double x)
      Specified by:
      setFineX in interface HasFineGridPosition
    • setFineY

      public void setFineY(double y)
      Specified by:
      setFineY in interface HasFineGridPosition
    • setHeading

      public void setHeading(double heading)
    • getGrid

      public Grid getGrid()
    • getGridLayer

      public GridLayer getGridLayer()
      Specified by:
      getGridLayer in interface HasGridPosition
    • getGridLayer

      public GridLayer getGridLayer(String gridLayerName)
      Get any grid layer that the grid knows about
    • getObjectFromLayer

      public Object getObjectFromLayer(String layerName)
    • getObjectFromLayer

      public Object getObjectFromLayer(String layerName, int cellX, int cellY)
    • getObjectFromLayer

      public Object getObjectFromLayer(String layerName, CellPoint2D point)
    • startMovingToward

      public void startMovingToward(int destinationX, int destinationY, double speed)
    • startMovingToward

      public void startMovingToward(HasGridPosition pos, double speed)
    • continueMovingToward

      public boolean continueMovingToward()
    • moveToward

      public void moveToward(int destinationX, int destinationY)
    • moveToward

      public void moveToward(int destinationX, int destinationY, double speed)
    • moveToward

      public void moveToward(HasGridPosition point, double speed)
    • moveAlong

      public void moveAlong(Vector2D vector)
    • moveAlong

      public void moveAlong(double distance, double direction)
    • moveDelta

      public void moveDelta(double deltaX, double deltaY)
    • moveDelta

      public void moveDelta(int deltaX, int deltaY)
    • moveTo

      public void moveTo(HasGridPosition p)
    • moveTo

      public void moveTo(int x, int y)
    • isAt

      public boolean isAt(int cellX, int cellY)
    • isAt

      public boolean isAt(HasGridPosition pos)
    • rotateDelta

      public void rotateDelta(double deltaR)
    • rotateTo

      public void rotateTo(double r)
    • getLeft

      public CellPoint2D getLeft()
    • getRight

      public CellPoint2D getRight()
    • getUp

      public CellPoint2D getUp()
    • getDown

      public CellPoint2D getDown()
    • moveRandomly

      public void moveRandomly()
    • moveRandomly

      public void moveRandomly(int maxDist)
    • moveRandomly

      public void moveRandomly(int maxDistX, int maxDistY)
    • placeAt

      public void placeAt(int cellX, int cellY)
      I'm including placeAt because moveTo might imply actual movement
    • placeRandomly

      public void placeRandomly()
    • placeRandomly

      public void placeRandomly(int x1, int y1, int x2, int y2)
      Place this agent in a random position within the bounding rectangle provided in the parameters
    • turnLeft

      public void turnLeft()
    • turnRight

      public void turnRight()
    • turnAround

      public void turnAround()
    • moveLeft

      public void moveLeft()
    • moveRight

      public void moveRight()
    • moveUp

      public void moveUp()
    • moveDown

      public void moveDown()
    • moveForward

      public void moveForward()
    • moveForward

      public void moveForward(double distance)
    • moveBackward

      public void moveBackward()
    • moveBackward

      public void moveBackward(double distance)
    • isOn

      public boolean isOn(Object value)
    • isOn

      public boolean isOn(String gridLayerName, Object value)
    • setCell

      public void setCell(Object value)
    • setCell

      public void setCell(String gridLayerName, Object value)
    • take

      public void take(String layerName, Object thing, Object replacement)
    • drop

      public void drop(String layerName, Object thing)