Package org.baseagent.sim
Class GridAgent
java.lang.Object
org.baseagent.sim.SimulationComponent
org.baseagent.Agent
org.baseagent.ui.DrawableAgent
org.baseagent.sim.GridAgent
- All Implemented Interfaces:
MessageListener
,HasFineGridPosition
,HasGridPosition
,HasStep
,SimulationListener
,Drawable
- Direct Known Subclasses:
Beacon
,EmbodiedAgent
-
Nested Class Summary
Nested classes/interfaces inherited from class org.baseagent.sim.SimulationComponent
SimulationComponent.Type
-
Field Summary
Fields inherited from class org.baseagent.Agent
SIMPLE_ID_COUNTER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
int
getCellX()
int
getCellY()
getDown()
double
getFineX()
double
getFineY()
getGrid()
getGridLayer
(String gridLayerName) Get any grid layer that the grid knows aboutdouble
getLeft()
getObjectFromLayer
(String layerName) getObjectFromLayer
(String layerName, int cellX, int cellY) getObjectFromLayer
(String layerName, CellPoint2D point) getRight()
getUp()
boolean
isAt
(int cellX, int cellY) boolean
isAt
(HasGridPosition pos) boolean
boolean
void
moveAlong
(double distance, double direction) void
void
void
moveBackward
(double distance) void
moveDelta
(double deltaX, double deltaY) void
moveDelta
(int deltaX, int deltaY) void
moveDown()
void
void
moveForward
(double distance) void
moveLeft()
void
void
moveRandomly
(int maxDist) void
moveRandomly
(int maxDistX, int maxDistY) void
void
moveTo
(int x, int y) void
void
moveToward
(int destinationX, int destinationY) void
moveToward
(int destinationX, int destinationY, double speed) void
moveToward
(HasGridPosition point, double speed) void
moveUp()
void
placeAt
(int cellX, int cellY) I'm including placeAt because moveTo might imply actual movementvoid
void
placeRandomly
(int x1, int y1, int x2, int y2) Place this agent in a random position within the bounding rectangle provided in the parametersvoid
rotateDelta
(double deltaR) void
rotateTo
(double r) void
void
void
setCellX
(int x) void
setCellY
(int y) void
setFineX
(double x) void
setFineY
(double y) void
setHeading
(double heading) void
startMovingToward
(int destinationX, int destinationY, double speed) void
startMovingToward
(HasGridPosition pos, double speed) void
void
void
turnLeft()
void
Methods inherited from class org.baseagent.ui.DrawableAgent
draw, getColor, getColorOrUse, getDrawable, getDrawX, getDrawY, removeDrawable, setColor, setDrawable, setDrawX, setDrawY
Methods inherited from class org.baseagent.Agent
addBehavior, addBehavior, getBehavior, getBehaviorPolicy, getBehaviors, getInventory, getKnowledge, getSimpleID, getState, getType, give, isState, onMessageReceived, receive, removeBehavior, removeBehavior, sendDirectedMessage, sendMessage, setBehaviorPolicy, setKnowledge, setState, step, take
Methods inherited from class org.baseagent.sim.SimulationComponent
getSimulation, getUUID, setSimulation
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.baseagent.ui.Drawable
drawAfter, drawBefore
Methods inherited from interface org.baseagent.sim.SimulationListener
onAfterStepEnded, onAfterStepStarted, onBeforeStepEnded, onBeforeStepStarted, onSimulationComponentAdded, onSimulationComponentRemoved, onSimulationEnded, onSimulationPaused, onSimulationResumed, onSimulationStarted, onSimulationStopped, onStepEnded, onStepStarted
-
Constructor Details
-
GridAgent
public GridAgent() -
GridAgent
-
GridAgent
-
GridAgent
-
-
Method Details
-
getCellX
public int getCellX()- Specified by:
getCellX
in interfaceHasGridPosition
-
getCellY
public int getCellY()- Specified by:
getCellY
in interfaceHasGridPosition
-
getFineX
public double getFineX()- Specified by:
getFineX
in interfaceHasFineGridPosition
-
getFineY
public double getFineY()- Specified by:
getFineY
in interfaceHasFineGridPosition
-
getGridPosition
-
getHeading
public double getHeading()- Specified by:
getHeading
in interfaceHasGridPosition
-
setCellX
public void setCellX(int x) - Specified by:
setCellX
in interfaceHasGridPosition
-
setCellY
public void setCellY(int y) - Specified by:
setCellY
in interfaceHasGridPosition
-
setFineX
public void setFineX(double x) - Specified by:
setFineX
in interfaceHasFineGridPosition
-
setFineY
public void setFineY(double y) - Specified by:
setFineY
in interfaceHasFineGridPosition
-
setHeading
public void setHeading(double heading) -
getGrid
-
getGridLayer
- Specified by:
getGridLayer
in interfaceHasGridPosition
-
getGridLayer
Get any grid layer that the grid knows about -
getObjectFromLayer
-
getObjectFromLayer
-
getObjectFromLayer
-
startMovingToward
public void startMovingToward(int destinationX, int destinationY, double speed) -
startMovingToward
-
continueMovingToward
public boolean continueMovingToward() -
moveToward
public void moveToward(int destinationX, int destinationY) -
moveToward
public void moveToward(int destinationX, int destinationY, double speed) -
moveToward
-
moveAlong
-
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
-
moveTo
public void moveTo(int x, int y) -
isAt
public boolean isAt(int cellX, int cellY) -
isAt
-
rotateDelta
public void rotateDelta(double deltaR) -
rotateTo
public void rotateTo(double r) -
getLeft
-
getRight
-
getUp
-
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
-
isOn
-
setCell
-
setCell
-
take
-
drop
-