vitro.grid
Class CreateAction

java.lang.Object
  extended by vitro.grid.GridAction
      extended by vitro.grid.CreateAction
All Implemented Interfaces:
Action

public class CreateAction
extends GridAction

A CreateAction encapsulates the process of spawning a new Actor at a specified location. Note that if two CreateActions are created with references to the same "spawned" Actor and then both applied, goofy things can happen.


Field Summary
 Actor actor
          The Actor that will be spawned.
 Location location
          The Location at which to spawn an Actor.
 
Fields inherited from class vitro.grid.GridAction
model
 
Constructor Summary
CreateAction(Grid model, Location location, Actor actor)
          Create a new CreateAction.
 
Method Summary
 void apply()
          Apply this Action.
 boolean equals(Object o)
           
 int hashCode()
           
 String toString()
           
 void undo()
          Roll back this Action.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

location

public final Location location
The Location at which to spawn an Actor.


actor

public final Actor actor
The Actor that will be spawned.

Constructor Detail

CreateAction

public CreateAction(Grid model,
                    Location location,
                    Actor actor)
Create a new CreateAction.

Parameters:
model - the Grid in which to spawn an Actor.
location - the location at which to spawn the Actor.
actor - the Actor to spawn.
Method Detail

apply

public void apply()
Apply this Action. The Actor cannot already exist in the Grid.


undo

public void undo()
Roll back this Action. The Actor must already exist in the Grid.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object