Package jfreerails.move

Provides classes that encapsulate changes to the game world.

See:
          Description

Interface Summary
ListMove This interface provides information about changes to the lists in the World database.
MapUpdateMove This interface tags Moves that change items on the map and tells the caller which tiles have been updated.
Move All moves should implement this interface and obey the contract described below.
ServerMove Indicates a move which can only be submitted by the server.
TrackMove This interface tags Moves that change the track.
 

Class Summary
AbstractMoveTestCase All TestCases for moves should extend this class.
AddActiveEntityMove A move that adds an active entity.
AddCargoBundleMove This Move adds a cargo bundle to the cargo bundle list.
AddItemToListMove All moves that add an item to a list should extend this class.
AddItemToSharedListMove All moves that add an item to a shared list should extend this class.
AddPlayerMove Adds a player to the world.
AddStationMove This CompositeMoveadds a station to the station list and adds a cargo bundle (to store the cargo waiting at the station) to the cargo bundle list.
AddTransactionMove This Move adds a Transaction to a players bank account on the World object.
ChangeCargoBundleMove This Move changes a cargo bundle (cargo bundles are used to represent the cargo carried by trains and the cargo waiting at stations).
ChangeGameSpeedMove Changes the game speed item on the world object.
ChangeItemInListMove All Moves that replace an item in a list with another should extend this class.
ChangeProductionAtEngineShopMove 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.
ChangeStationMove This Move changes the properties of a station.
ChangeTileMove Move that changes a single tile.
ChangeTrackPieceCompositeMove This Move changes adds, removes, or upgrades the track between two tiles.
ChangeTrackPieceMove This Move adds, removes, or upgrades the track on a single tile.
ChangeTrainMove This Move can change a train's engine and wagons.
ChangeTrainScheduleMove This Move changes a train's schedule.
CompositeMove This Move may be subclassed to create a move composed of a number of component Moves where atomicity of the move is required.
MoveStatus Records the success or failure of an attempt to execute a move.
NextActivityMove  
RemoveCargoBundleMove This move removes a cargo bundle from the cargo bundle list.
RemoveItemFromListMove All moves that remove an item from a list should extend this class.
RemoveStationMove This Move removes a station from the station list and from the map.
RemoveTrainMove This Move removes a train from the list of trains, and the corresponding CargoBundle and Schedule.
TimeTickMove Changes the time item on the world object.
TrackMoveTransactionsGenerator This class calculates the cost of a series of track moves.
TransferCargoAtStationMove This CompositeMove transfers cargo from a train to a station and vice-versa.
UndoMove Undoes the Move passed to its constructor.
UpgradeTrackMove This CompositeMove changes the track type at a point on the map and charges the players account for the cost of the change.
WorldDiffMove A move that makes a number of changes to the map and to the lists.
WorldDiffMove.MapDiff  
 

Enum Summary
WorldDiffMove.Cause  
 

Exception Summary
PreMoveException Thrown when there is a problem generating a move.
TrainCrashException  
 

Package jfreerails.move Description

Provides classes that encapsulate changes to the game world. The classes implement the GoF request pattern, and they are referred to as 'moves'. All moves should implement the interface Move. The javadoc comment for the interface move sets out the contract they should obey in addition to implementing the methods it defines.

Guide lines for writing moves

(1) Implement the interface Move and follow the contract described in the javadoc for the interface.

(2) Rather than writing the class from scratch, it is probably better to extend one of the generic moves class.

if the move.. then extend
adds an item to a list AddItemToListMove
removes an item from a list RemoveItemFromListMove
changes an item in a list ChangeItemInListMove
does several things CompositeMove

(3) Consider writing a junit testcase for the move, and if you do, make the testcase a extend AbstractMoveTestCase.

(4) If the move depends on properties stored on the world object, consider extending PreMove.