jfreerails.move
Class ChangeProductionAtEngineShopMove

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

public class ChangeProductionAtEngineShopMove
extends java.lang.Object
implements Move

This Move changes what is being built at an engine shop - when a client wants to build a train, it should send an instance of this class to the server.

Author:
Luke
See Also:
Serialized Form

Field Summary
private  ImList<PlannedTrain> after
           
private  ImList<PlannedTrain> before
           
private  FreerailsPrincipal principal
           
private static long serialVersionUID
           
private  int stationNumber
           
 
Constructor Summary
ChangeProductionAtEngineShopMove(ImList<PlannedTrain> b, ImList<PlannedTrain> a, int station, FreerailsPrincipal p)
           
 
Method Summary
 MoveStatus doMove(World w, FreerailsPrincipal p)
          Executes this move on the specifed world object.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 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.
private  MoveStatus tryMove(World w, ImList<PlannedTrain> stateA)
           
 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, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

before

private final ImList<PlannedTrain> before

after

private final ImList<PlannedTrain> after

stationNumber

private final int stationNumber

principal

private final FreerailsPrincipal principal
Constructor Detail

ChangeProductionAtEngineShopMove

public ChangeProductionAtEngineShopMove(ImList<PlannedTrain> b,
                                        ImList<PlannedTrain> a,
                                        int station,
                                        FreerailsPrincipal p)
Method Detail

equals

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

hashCode

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

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

tryMove

private MoveStatus tryMove(World w,
                           ImList<PlannedTrain> stateA)

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