jfreerails.world.train
Class ImmutableSchedule

java.lang.Object
  extended by jfreerails.world.train.ImmutableSchedule
All Implemented Interfaces:
java.io.Serializable, FreerailsSerializable, Schedule

public class ImmutableSchedule
extends java.lang.Object
implements Schedule, FreerailsSerializable

A Schedule that is immutable.

Author:
Luke Lindsay
See Also:
Serialized Form

Field Summary
private  boolean hasPriorityOrders
           
private  int nextScheduledOrder
           
private  ImList<TrainOrdersModel> orders
           
private static long serialVersionUID
           
 
Fields inherited from interface jfreerails.world.train.Schedule
MAXIMUM_NUMBER_OF_ORDER, PRIORITY_ORDERS
 
Constructor Summary
ImmutableSchedule(TrainOrdersModel[] orders, int gotoStation, boolean hasPriorityOrders)
           
 
Method Summary
 boolean autoConsist()
          Returns the value for the autoconsist flag at the next scheduled stop.
 boolean equals(java.lang.Object o)
           
 int getNextScheduledOrder()
           
 int getNumOrders()
          Returns number of non priority orders + number of priority orders.
 TrainOrdersModel getOrder(int i)
           
 int getOrderToGoto()
          Returns the number of the order the train is currently carry out.
 int getStationToGoto()
          Returns the station number of the next station the train is scheduled to stop at.
 ImInts getWagonsToAdd()
          Returns the wagons to add at the next scheduled stop.
 int hashCode()
           
 boolean hasPriorityOrders()
           
 boolean stopsAtStation(int stationNumber)
           
 
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

orders

private final ImList<TrainOrdersModel> orders

nextScheduledOrder

private final int nextScheduledOrder

hasPriorityOrders

private final boolean hasPriorityOrders
Constructor Detail

ImmutableSchedule

public ImmutableSchedule(TrainOrdersModel[] orders,
                         int gotoStation,
                         boolean hasPriorityOrders)
Method Detail

hashCode

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

getOrder

public TrainOrdersModel getOrder(int i)
Specified by:
getOrder in interface Schedule

getOrderToGoto

public int getOrderToGoto()
Description copied from interface: Schedule
Returns the number of the order the train is currently carry out.

Specified by:
getOrderToGoto in interface Schedule

getStationToGoto

public int getStationToGoto()
Description copied from interface: Schedule
Returns the station number of the next station the train is scheduled to stop at.

Specified by:
getStationToGoto in interface Schedule

getWagonsToAdd

public ImInts getWagonsToAdd()
Description copied from interface: Schedule
Returns the wagons to add at the next scheduled stop.

Specified by:
getWagonsToAdd in interface Schedule

hasPriorityOrders

public boolean hasPriorityOrders()
Specified by:
hasPriorityOrders in interface Schedule

getNumOrders

public int getNumOrders()
Description copied from interface: Schedule
Returns number of non priority orders + number of priority orders.

Specified by:
getNumOrders in interface Schedule
Returns:
Number of orders.

getNextScheduledOrder

public int getNextScheduledOrder()
Specified by:
getNextScheduledOrder in interface Schedule

stopsAtStation

public boolean stopsAtStation(int stationNumber)

equals

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

autoConsist

public boolean autoConsist()
Description copied from interface: Schedule
Returns the value for the autoconsist flag at the next scheduled stop.

Specified by:
autoConsist in interface Schedule