jfreerails.move
Class AddItemToSharedListMove

java.lang.Object
  extended by jfreerails.move.AddItemToSharedListMove
All Implemented Interfaces:
java.io.Serializable, Move, FreerailsSerializable

public class AddItemToSharedListMove
extends java.lang.Object
implements Move

All moves that add an item to a shared list should extend this class.

Author:
Luke
See Also:
Serialized Form

Field Summary
private  int index
           
private  FreerailsSerializable item
           
private  SKEY listKey
           
private static long serialVersionUID
           
 
Constructor Summary
protected AddItemToSharedListMove(SKEY key, int i, FreerailsSerializable item)
           
 
Method Summary
 MoveStatus doMove(World w, FreerailsPrincipal p)
          Executes this move on the specifed world object.
 boolean equals(java.lang.Object o)
           
 FreerailsSerializable getAfter()
           
 FreerailsSerializable getBefore()
           
 int getIndex()
           
 SKEY getKey()
           
 int hashCode()
           
 java.lang.String toString()
           
 MoveStatus tryDoMove(World w, FreerailsPrincipal p)
          Tests whether this Move can be executed on the specifed world object, this method should leave the world object unchanged.
 MoveStatus tryUndoMove(World w, FreerailsPrincipal p)
          Tests whether this Move can be undone on the specifed world object, this method should leave the world object unchanged.
 MoveStatus undoMove(World w, FreerailsPrincipal p)
          If doMove has just been executed on the specified world object, calling this method changes the state of the world object back to how it was before doMove was called.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

listKey

private final SKEY listKey

index

private final int index

item

private final FreerailsSerializable item
Constructor Detail

AddItemToSharedListMove

protected AddItemToSharedListMove(SKEY key,
                                  int i,
                                  FreerailsSerializable item)
Method Detail

getIndex

public int getIndex()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getKey

public SKEY getKey()

tryDoMove

public MoveStatus tryDoMove(World w,
                            FreerailsPrincipal p)
Description copied from interface: Move
Tests whether this Move can be executed on the specifed world object, this method should leave the world object unchanged.

Specified by:
tryDoMove in interface Move

tryUndoMove

public MoveStatus tryUndoMove(World w,
                              FreerailsPrincipal p)
Description copied from interface: Move
Tests whether this Move can be undone on the specifed world object, this method should leave the world object unchanged.

Specified by:
tryUndoMove in interface Move

doMove

public MoveStatus doMove(World w,
                         FreerailsPrincipal p)
Description copied from interface: Move
Executes this move on the specifed world object.

Specified by:
doMove in interface Move

undoMove

public MoveStatus undoMove(World w,
                           FreerailsPrincipal p)
Description copied from interface: Move
If doMove has just been executed on the specified world object, calling this method changes the state of the world object back to how it was before doMove was called.

Specified by:
undoMove in interface Move

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getBefore

public FreerailsSerializable getBefore()

getAfter

public FreerailsSerializable getAfter()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object