jfreerails.server
Class ServerGameModelImpl

java.lang.Object
  extended by jfreerails.server.ServerGameModelImpl
All Implemented Interfaces:
java.io.Serializable, ServerGameModel, GameModel

public class ServerGameModelImpl
extends java.lang.Object
implements ServerGameModel

A ServerGameModel that contains the automations used in the actual game.

Author:
Luke
See Also:
Serialized Form

Field Summary
private  CalcSupplyAtStations calcSupplyAtStations
           
private  MoveReceiver moveExecuter
           
private  long nextModelUpdateDue
           
private  java.lang.String[] passwords
           
private static long serialVersionUID
           
private  java.util.Vector<ServerAutomaton> serverAutomata
          List of the ServerAutomaton objects connected to this game.
private  TrainUpdater tb
           
private  int ticksSinceUpdate
          Number of ticks since the last time we did an infrequent update.
 World world
           
 
Constructor Summary
ServerGameModelImpl()
           
ServerGameModelImpl(World w, java.util.Vector<ServerAutomaton> serverAutomata)
           
 
Method Summary
 java.lang.String[] getPasswords()
           
 World getWorld()
           
 void init(MoveReceiver newMoveExecuter)
           
private  void monthEnd()
          This is called at the start of each new month.
 void setWorld(World w, java.lang.String[] passwords)
           
 void update()
           
private  void updateGameTime()
           
 void write(java.io.ObjectOutputStream objectOut)
           
private  void yearEnd()
          This is called on the last tick of each year.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

world

public World world

calcSupplyAtStations

private transient CalcSupplyAtStations calcSupplyAtStations

tb

private TrainUpdater tb

passwords

private java.lang.String[] passwords

serverAutomata

private final java.util.Vector<ServerAutomaton> serverAutomata
List of the ServerAutomaton objects connected to this game.


ticksSinceUpdate

private int ticksSinceUpdate
Number of ticks since the last time we did an infrequent update.


nextModelUpdateDue

private transient long nextModelUpdateDue

moveExecuter

private transient MoveReceiver moveExecuter
Constructor Detail

ServerGameModelImpl

public ServerGameModelImpl()

ServerGameModelImpl

public ServerGameModelImpl(World w,
                           java.util.Vector<ServerAutomaton> serverAutomata)
Method Detail

yearEnd

private void yearEnd()
This is called on the last tick of each year.


monthEnd

private void monthEnd()
This is called at the start of each new month.


updateGameTime

private void updateGameTime()

update

public void update()
Specified by:
update in interface GameModel

write

public void write(java.io.ObjectOutputStream objectOut)
           throws java.io.IOException
Specified by:
write in interface ServerGameModel
Throws:
java.io.IOException

init

public void init(MoveReceiver newMoveExecuter)
Specified by:
init in interface ServerGameModel

getWorld

public World getWorld()
Specified by:
getWorld in interface ServerGameModel

setWorld

public void setWorld(World w,
                     java.lang.String[] passwords)
Specified by:
setWorld in interface ServerGameModel

getPasswords

public java.lang.String[] getPasswords()
Specified by:
getPasswords in interface ServerGameModel