Class GameInfo

java.lang.Object
  extended byGameInfo
All Implemented Interfaces:
java.io.Serializable

class GameInfo
extends java.lang.Object
implements java.io.Serializable

Class GameInfo contains basic information about a race.

GameInfo is used when the necessary information about the race is sent to the client programs. Based on this information, the client program shows a list of races available.

All attributes are public, since this is basically a collection of temporary information attributes.

Version:
1.0
Author:
Stefan Brockmann, Tero Kuusela
See Also:
Game, Tracksail

Field Summary
 int id
          unique id of this race
 boolean is_racing
          is the race currently in racing state
 int master_id
          id of the player who owns this race
 java.lang.String name
          name of this race
 int num_players
          number of players in this race
 
Constructor Summary
GameInfo(int id, java.lang.String name, int master_id, int num_players, boolean is_racing)
          Constructor.
 
Method Summary
private  void readObject(java.io.ObjectInputStream in)
          Reads an Object from a stream.
 java.lang.String toString()
          Returns an image of this race.
private  void writeObject(java.io.ObjectOutputStream out)
          Writes the game information to an Object stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public int id
unique id of this race


name

public java.lang.String name
name of this race


master_id

public int master_id
id of the player who owns this race


num_players

public int num_players
number of players in this race


is_racing

public boolean is_racing
is the race currently in racing state

Constructor Detail

GameInfo

public GameInfo(int id,
                java.lang.String name,
                int master_id,
                int num_players,
                boolean is_racing)
Constructor.

Parameters:
id - the unique id of this race
name - the name of this race
master_id - the id of the player who owns this race
num_players - the number of players in this race
is_racing - true if the race is currently in racing state, false otherwise
Method Detail

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes the game information to an Object stream.

Parameters:
out - ObjectOutputStream to write to
Throws:
java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads an Object from a stream.

Parameters:
in - ObjectInputStream to read from
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString()
Returns an image of this race.

The image contains the name, number of players and state of the race.

Returns:
Image of this race.