com.collegeboard.gridworld.actor
Class ActorWorld

java.lang.Object
  extended by com.collegeboard.gridworld.world.World<Actor>
      extended by com.collegeboard.gridworld.actor.ActorWorld

public class ActorWorld
extends World<Actor>

A world that is occupied by actors.

copyright© 2005 Cay S. Horstmann (http://horstmann.com)

Author:
Cay Horstmann

Constructor Summary
ActorWorld()
           
ActorWorld(Grid<Actor> grid)
           
 
Method Summary
 void add(Location loc, Actor occupant)
          Adds an occupant at a given location.
 Actor remove(Location loc)
          Removes an occupant from a given location.
 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 com.collegeboard.gridworld.world.World
add, addGridClass, addOccupantClass, getGrid, getGridClasses, getMessage, getOccupantClasses, locationClicked, setGrid, setMessage, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActorWorld

public ActorWorld()

ActorWorld

public ActorWorld(Grid<Actor> grid)
Method Detail

step

public void step()
Description copied from class: World
This method is called when the user clicks on the step button, or when run mode has been activated by clicking the run button.

Overrides:
step in class World<Actor>

add

public void add(Location loc,
                Actor occupant)
Description copied from class: World
Adds an occupant at a given location. (This method is supplied so that beginners can make a world without having to know about Location objects.)

Overrides:
add in class World<Actor>
Parameters:
loc - the location
occupant - the occupant to add

remove

public Actor remove(Location loc)
Description copied from class: World
Removes an occupant from a given location.

Overrides:
remove in class World<Actor>
Parameters:
loc - the location
Returns:
the removed occupant, or null if the location was empty