vitro.grid
Class DestroyAction

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

public class DestroyAction
extends GridAction

A DestroyAction encapsulates the process of removing one or more Actors from a Grid.


Field Summary
 Map<Actor,Location> actors
          A mapping from the destroyed Actors to their original Locations.
 
Fields inherited from class vitro.grid.GridAction
model
 
Constructor Summary
DestroyAction(Grid model, Actor... targets)
          Create a new DestroyAction.
 
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

actors

public final Map<Actor,Location> actors
A mapping from the destroyed Actors to their original Locations.

Constructor Detail

DestroyAction

public DestroyAction(Grid model,
                     Actor... targets)
Create a new DestroyAction.

Parameters:
model - the Grid from which to remove Actors.
targets - one or more Actors to remove.
Method Detail

apply

public void apply()
Apply this Action. Every target Actor must be at the Location it was in when this Action was created.


undo

public void undo()
Roll back this Action. None of the actors removed by this Action can 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