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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidintgetCellX()intgetCellY()getDown()doublegetFineX()doublegetFineY()getGrid()getGridLayer(String gridLayerName) Get any grid layer that the grid knows aboutdoublegetLeft()getObjectFromLayer(String layerName) getObjectFromLayer(String layerName, int cellX, int cellY) getObjectFromLayer(String layerName, CellPoint2D point) getRight()getUp()booleanisAt(int cellX, int cellY) booleanisAt(HasGridPosition pos) booleanbooleanvoidmoveAlong(double distance, double direction) voidvoidvoidmoveBackward(double distance) voidmoveDelta(double deltaX, double deltaY) voidmoveDelta(int deltaX, int deltaY) voidmoveDown()voidvoidmoveForward(double distance) voidmoveLeft()voidvoidmoveRandomly(int maxDist) voidmoveRandomly(int maxDistX, int maxDistY) voidvoidmoveTo(int x, int y) voidvoidmoveToward(int destinationX, int destinationY) voidmoveToward(int destinationX, int destinationY, double speed) voidmoveToward(HasGridPosition point, double speed) voidmoveUp()voidplaceAt(int cellX, int cellY) I'm including placeAt because moveTo might imply actual movementvoidvoidplaceRandomly(int x1, int y1, int x2, int y2) Place this agent in a random position within the bounding rectangle provided in the parametersvoidrotateDelta(double deltaR) voidrotateTo(double r) voidvoidvoidsetCellX(int x) voidsetCellY(int y) voidsetFineX(double x) voidsetFineY(double y) voidsetHeading(double heading) voidstartMovingToward(int destinationX, int destinationY, double speed) voidstartMovingToward(HasGridPosition pos, double speed) voidvoidvoidturnLeft()voidMethods inherited from class org.baseagent.ui.DrawableAgent
draw, getColor, getColorOrUse, getDrawable, getDrawX, getDrawY, removeDrawable, setColor, setDrawable, setDrawX, setDrawYMethods 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, takeMethods inherited from class org.baseagent.sim.SimulationComponent
getSimulation, getUUID, setSimulationMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.baseagent.ui.Drawable
drawAfter, drawBeforeMethods 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:
getCellXin interfaceHasGridPosition
-
getCellY
public int getCellY()- Specified by:
getCellYin interfaceHasGridPosition
-
getFineX
public double getFineX()- Specified by:
getFineXin interfaceHasFineGridPosition
-
getFineY
public double getFineY()- Specified by:
getFineYin interfaceHasFineGridPosition
-
getGridPosition
-
getHeading
public double getHeading()- Specified by:
getHeadingin interfaceHasGridPosition
-
setCellX
public void setCellX(int x) - Specified by:
setCellXin interfaceHasGridPosition
-
setCellY
public void setCellY(int y) - Specified by:
setCellYin interfaceHasGridPosition
-
setFineX
public void setFineX(double x) - Specified by:
setFineXin interfaceHasFineGridPosition
-
setFineY
public void setFineY(double y) - Specified by:
setFineYin interfaceHasFineGridPosition
-
setHeading
public void setHeading(double heading) -
getGrid
-
getGridLayer
- Specified by:
getGridLayerin 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
-