jfreerails.controller
Class AddTrainPreMove

java.lang.Object
  extended by jfreerails.controller.AddTrainPreMove
All Implemented Interfaces:
java.io.Serializable, PreMove, FreerailsSerializable

public class AddTrainPreMove
extends java.lang.Object
implements PreMove

Author:
Luke
See Also:
Serialized Form

Field Summary
private  int engineTypeId
           
private  ImPoint point
           
private  FreerailsPrincipal principal
           
private  ImmutableSchedule schedule
           
private static long serialVersionUID
           
private  ImInts wagons
           
 
Constructor Summary
AddTrainPreMove(int e, ImInts wags, ImPoint p, FreerailsPrincipal fp, ImmutableSchedule s)
           
 
Method Summary
private  int calTrainLength()
           
 boolean equals(java.lang.Object o)
           
 Move generateMove(ReadOnlyWorld w)
          Generates a move that does the following.
 int hashCode()
           
(package private)  PathOnTiles initPositionStep1(ReadOnlyWorld w)
           
(package private)  TrainMotion initPositionStep2(PathOnTiles path)
           
 
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

engineTypeId

private final int engineTypeId

wagons

private final ImInts wagons

point

private final ImPoint point

principal

private final FreerailsPrincipal principal

schedule

private final ImmutableSchedule schedule
Constructor Detail

AddTrainPreMove

public AddTrainPreMove(int e,
                       ImInts wags,
                       ImPoint p,
                       FreerailsPrincipal fp,
                       ImmutableSchedule s)
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

initPositionStep1

PathOnTiles initPositionStep1(ReadOnlyWorld w)

calTrainLength

private int calTrainLength()

initPositionStep2

TrainMotion initPositionStep2(PathOnTiles path)

generateMove

public Move generateMove(ReadOnlyWorld w)
Generates a move that does the following.
  1. Adds the train
  2. Adds a cargo bundle to represent the cargo the train is carrying
  3. Adds a schedule for the train
  4. Adds transaction to pay for the train
  5. Init. the trains position and motion

Specified by:
generateMove in interface PreMove