rails.game.move
Class ObjectMove

java.lang.Object
  extended by rails.game.move.Move
      extended by rails.game.move.ObjectMove

public class ObjectMove
extends Move

Author:
Erik Vos

Field Summary
(package private)  MoveableHolder from
           
(package private)  int[] fromPosition
           
(package private)  Moveable moveableObject
           
(package private)  java.lang.String objectClassName
           
(package private)  MoveableHolder to
           
(package private)  int[] toPosition
           
 
Fields inherited from class rails.game.move.Move
log, models
 
Constructor Summary
ObjectMove(Moveable moveableObject, MoveableHolder from, MoveableHolder to)
          Create a generic ObjectMove object.
ObjectMove(Moveable moveableObject, MoveableHolder from, MoveableHolder to, int[] toPosition)
          Create a generic ObjectMove object.
 
Method Summary
 boolean execute()
           
 java.lang.String toString()
           
 boolean undo()
           
 
Methods inherited from class rails.game.move.Move
registerModelToUpdate, updateModels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

moveableObject

Moveable moveableObject

from

MoveableHolder from

to

MoveableHolder to

objectClassName

java.lang.String objectClassName

fromPosition

int[] fromPosition

toPosition

int[] toPosition
Constructor Detail

ObjectMove

public ObjectMove(Moveable moveableObject,
                  MoveableHolder from,
                  MoveableHolder to)
Create a generic ObjectMove object. Any specific side effects must be implemented in the various addXxxx and removeXxxx methods of the 'from' and 'to' MoveableHolders, depending on the object type.

Parameters:
moveableObject - The object to be moved (e.g. a BaseToken).
from - Where the moveableObject is removed from (e.g. a PublicCompany charter).
to - Where the moveableObject is moved to (e.g. a MapHex). It is moved to the end of the List in which the moved object type is stored.

ObjectMove

public ObjectMove(Moveable moveableObject,
                  MoveableHolder from,
                  MoveableHolder to,
                  int[] toPosition)
Create a generic ObjectMove object. Any specific side effects must be implemented in the various addXxxx and removeXxxx methods of the 'from' and 'to' MoveableHolders, depending on the object type.

Parameters:
moveableObject - The object to be moved (e.g. a BaseToken).
from - Where the moveableObject is removed from (e.g. a PublicCompany charter).
to - Where the moveableObject is moved to (e.g. a MapHex).
toPosition - At which List index in the 'to' holder the object must be inserted, -1 means at the end.
Method Detail

execute

public boolean execute()
Specified by:
execute in class Move

undo

public boolean undo()
Specified by:
undo in class Move

toString

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