jfreerails.world.top
Class KEY

java.lang.Object
  extended by jfreerails.world.top.KEY
All Implemented Interfaces:
java.io.Serializable, FreerailsSerializable

public class KEY
extends java.lang.Object
implements FreerailsSerializable

This class provides a set of keys to access the lists of elements in the game world that are indexed by player.

It implements the typesafe enum pattern (see Bloch, Effective Java item 21)

Author:
Luke
See Also:
Serialized Form

Field Summary
static KEY CARGO_BUNDLES
          The cargo waiting at stations or carried by trains.
private  int keyNumber
           
private static KEY[] keys
          Maps key numbers to KEYs.
private static int numberOfKeys
           
private static long serialVersionUID
           
static KEY STATIONS
           
static KEY TRAIN_SCHEDULES
           
static KEY TRAINS
           
 
Constructor Summary
private KEY()
           
 
Method Summary
static KEY getKey(int keyNum)
           
(package private)  int getKeyID()
           
(package private) static int getNumberOfKeys()
           
private  java.lang.Object readResolve()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

keys

private static final KEY[] keys
Maps key numbers to KEYs.


TRAINS

public static final KEY TRAINS

STATIONS

public static final KEY STATIONS

CARGO_BUNDLES

public static final KEY CARGO_BUNDLES
The cargo waiting at stations or carried by trains.


TRAIN_SCHEDULES

public static final KEY TRAIN_SCHEDULES

numberOfKeys

private static int numberOfKeys

keyNumber

private final int keyNumber
Constructor Detail

KEY

private KEY()
Method Detail

getNumberOfKeys

static int getNumberOfKeys()

getKeyID

int getKeyID()

readResolve

private java.lang.Object readResolve()
                              throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getKey

public static KEY getKey(int keyNum)