jfreerails.move
Class TrackMoveTransactionsGenerator

java.lang.Object
  extended by jfreerails.move.TrackMoveTransactionsGenerator

public class TrackMoveTransactionsGenerator
extends java.lang.Object

This class calculates the cost of a series of track moves. The motivation for separating this code from the code that generates track moves is that the transactions will be generated by the server whereas the track moves will be generated by a client.

Author:
Luke Lindsay

Field Summary
private  long fixedCostsBridges
           
private  long fixedCostsStations
           
private  FreerailsPrincipal principal
           
private  int[] trackAdded
          Number of each of the track types added.
private  int[] trackRemoved
          Number of each of the track types removed.
private  java.util.ArrayList<Transaction> transactions
           
private  ReadOnlyWorld w
           
 
Constructor Summary
TrackMoveTransactionsGenerator(ReadOnlyWorld world, FreerailsPrincipal p)
           
 
Method Summary
 CompositeMove addTransactions(Move move)
           
private  void generateTransactions()
           
private  void processMove(ChangeTrackPieceMove move)
           
private  void unpackMove(Move move)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trackAdded

private int[] trackAdded
Number of each of the track types added.


fixedCostsStations

private long fixedCostsStations

fixedCostsBridges

private long fixedCostsBridges

trackRemoved

private int[] trackRemoved
Number of each of the track types removed.


principal

private final FreerailsPrincipal principal

transactions

private final java.util.ArrayList<Transaction> transactions

w

private final ReadOnlyWorld w
Constructor Detail

TrackMoveTransactionsGenerator

public TrackMoveTransactionsGenerator(ReadOnlyWorld world,
                                      FreerailsPrincipal p)
Parameters:
p - the Principal on behalf of which this object generates transactions for
Method Detail

addTransactions

public CompositeMove addTransactions(Move move)

unpackMove

private void unpackMove(Move move)

processMove

private void processMove(ChangeTrackPieceMove move)

generateTransactions

private void generateTransactions()