|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.gridworld.world.World<Actor>
info.gridworld.actor.ActorWorld
public class ActorWorld
An ActorWorld
is occupied by actors.
This class is not tested on the AP CS A and AB exams.
Constructor Summary | |
---|---|
ActorWorld()
Constructs an actor world with a default grid. |
|
ActorWorld(Grid<Actor> grid)
Constructs an actor world with a given grid. |
Method Summary | |
---|---|
void |
add(Actor occupant)
Adds an occupant at a random empty location. |
void |
add(Location loc,
Actor occupant)
Adds an actor to this world at a given location. |
Actor |
remove(Location loc)
Removes an actor from this world. |
void |
show()
Constructs and shows a frame for this world. |
void |
step()
This method is called when the user clicks on the step button, or when run mode has been activated by clicking the run button. |
Methods inherited from class info.gridworld.world.World |
---|
addGridClass, addOccupantClass, getGrid, getGridClasses, getMessage, getOccupantClasses, getRandomEmptyLocation, keyPressed, locationClicked, setGrid, setMessage, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ActorWorld()
public ActorWorld(Grid<Actor> grid)
grid
- the grid for this world.Method Detail |
---|
public void show()
World
show
in class World<Actor>
public void step()
World
step
in class World<Actor>
public void add(Location loc, Actor occupant)
add
in class World<Actor>
loc
- the location at which to add the actoroccupant
- the actor to addpublic void add(Actor occupant)
occupant
- the occupant to addpublic Actor remove(Location loc)
remove
in class World<Actor>
loc
- the location from which to remove an actor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |