vitro.grid
Class MoveAction

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

public class MoveAction
extends GridAction

A MoveAction encapsulates the process of Moving an Actor from one Location to another.


Field Summary
 Actor actor
          The Actor that is moved.
 Location end
          The final Location of the Actor.
 Location start
          The initial Location of the Actor.
 
Fields inherited from class vitro.grid.GridAction
model
 
Constructor Summary
MoveAction(Grid model, Location destination, Actor actor)
          Create a new MoveAction.
 
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

start

public final Location start
The initial Location of the Actor.


end

public final Location end
The final Location of the Actor.


actor

public final Actor actor
The Actor that is moved.

Constructor Detail

MoveAction

public MoveAction(Grid model,
                  Location destination,
                  Actor actor)
Create a new MoveAction.

Parameters:
model - the Grid within which to move an Actor.
destination - the Location to which the Actor will be moved.
actor - the Actor to move.
Method Detail

apply

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


undo

public void undo()
Roll back this Action. The Actor must be at the Location where this Action left it.


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