info.gridworld.actor
Class ActorWorld

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

public class ActorWorld
extends World<Actor>

A world that is occupied by actors.


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(Location loc, Actor occupant)
          Adds a actor to this world at a given location.
 Actor remove(Location loc)
          Removes an actor from 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
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()
Constructs an actor world with a default grid.


ActorWorld

public ActorWorld(Grid<Actor> grid)
Constructs an actor world with a given grid.

Parameters:
grid - the grid for this world.
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)
Adds a actor to this world at a given location.

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

remove

public Actor remove(Location loc)
Removes an actor from this world.

Overrides:
remove in class World<Actor>
Parameters:
loc - the location from which to remove an actor
Returns:
the removed actor, or null if there was no actor at the given location.