common
Class NetworkObject

java.lang.Object
  extended by common.NetworkObject
All Implemented Interfaces:
java.io.Serializable

public class NetworkObject
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
static int ALREADY_LOGGED_IN
          Used to notify that a user using that username is already logged in.
static int CARD
           
static int CREATE_NEW_USER
          Used to notify that the player wants to create a new player profile.
static int DISCONNECTED
           
static int DRAW
           
static int GAME_CHOICE
          Indicates that the accompanying message contains the name of the game the player wants to play.
static int GAME_PACKET
          Used to indicate the the accompanying object contains information about the game currently being played.
static int GAME_RESULT
          Used to notify the player that the accompanying message contains the result of the game defined in Player.
static int GET_RECORDS
          Used to notify that that the player wants to know the other's players records.
static int LEAVE_TABLE
          Used to notify the Server that the player wants to leave the table.
static int LOGIN
          Used to notify the server that a client is logging in.
static int LOSS
           
static int NO_SUCH_GAME
          Should never be used unless a Player somehow selects to play a game that doesn't exist on the Server.
static int NO_SUCH_PLAYER
          Used to notify the server a player is disconnected.
static int OPPONENT_CARD
           
static int OPPONENT_MOVE
           
static int PLAY_AGAIN
           
static int PLAYER_DISCONNECTED
          Used to notify a player that their opponent disconnected.
static int PLAYER_INFO
          Used to nottify the player that the accompanying message is a String representation of one of their opponents.
static int USER_ALREADY_EXISTS
          Used to notify the player that the username he tried to create already exists in the database.
static int WIN
           
static int WRONG_PASSWORD
          Used to notify the player that the password provided doesn't match the password in the database.
 
Constructor Summary
NetworkObject(int type, java.lang.Object message)
          Creates a new instance of NetworkObject
 
Method Summary
 java.lang.Object getMessage()
          Returns the Object sent in the message.
 int getType()
          Returns an int representing the protocol for the type of message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN

public static final int LOGIN
Used to notify the server that a client is logging in. Used to notify the client that it is successfully logged in.

See Also:
Constant Field Values

ALREADY_LOGGED_IN

public static final int ALREADY_LOGGED_IN
Used to notify that a user using that username is already logged in.

See Also:
Constant Field Values

CREATE_NEW_USER

public static final int CREATE_NEW_USER
Used to notify that the player wants to create a new player profile.

See Also:
Constant Field Values

NO_SUCH_PLAYER

public static final int NO_SUCH_PLAYER
Used to notify the server a player is disconnected. Used to notify the client that they are disconnected.

See Also:
Constant Field Values

WRONG_PASSWORD

public static final int WRONG_PASSWORD
Used to notify the player that the password provided doesn't match the password in the database.

See Also:
Constant Field Values

USER_ALREADY_EXISTS

public static final int USER_ALREADY_EXISTS
Used to notify the player that the username he tried to create already exists in the database.

See Also:
Constant Field Values

PLAYER_DISCONNECTED

public static final int PLAYER_DISCONNECTED
Used to notify a player that their opponent disconnected.

See Also:
Constant Field Values

PLAYER_INFO

public static final int PLAYER_INFO
Used to nottify the player that the accompanying message is a String representation of one of their opponents.

See Also:
Constant Field Values

GAME_RESULT

public static final int GAME_RESULT
Used to notify the player that the accompanying message contains the result of the game defined in Player.

See Also:
Constant Field Values

LEAVE_TABLE

public static final int LEAVE_TABLE
Used to notify the Server that the player wants to leave the table.

See Also:
Constant Field Values

GET_RECORDS

public static final int GET_RECORDS
Used to notify that that the player wants to know the other's players records. Used by the server to notify the player that the accompanying message has player records.

See Also:
Constant Field Values

OPPONENT_MOVE

public static final int OPPONENT_MOVE
See Also:
Constant Field Values

DRAW

public static final int DRAW
See Also:
Constant Field Values

WIN

public static final int WIN
See Also:
Constant Field Values

LOSS

public static final int LOSS
See Also:
Constant Field Values

OPPONENT_CARD

public static final int OPPONENT_CARD
See Also:
Constant Field Values

CARD

public static final int CARD
See Also:
Constant Field Values

DISCONNECTED

public static final int DISCONNECTED
See Also:
Constant Field Values

PLAY_AGAIN

public static final int PLAY_AGAIN
See Also:
Constant Field Values

GAME_CHOICE

public static final int GAME_CHOICE
Indicates that the accompanying message contains the name of the game the player wants to play.

See Also:
Constant Field Values

NO_SUCH_GAME

public static final int NO_SUCH_GAME
Should never be used unless a Player somehow selects to play a game that doesn't exist on the Server.

See Also:
Constant Field Values

GAME_PACKET

public static final int GAME_PACKET
Used to indicate the the accompanying object contains information about the game currently being played.

See Also:
Constant Field Values
Constructor Detail

NetworkObject

public NetworkObject(int type,
                     java.lang.Object message)
Creates a new instance of NetworkObject

Parameters:
type - int of the message.
message - Object that is being encapsulated in the NetworkObject.
Method Detail

getType

public int getType()
Returns an int representing the protocol for the type of message.

Returns:
int messageType

getMessage

public java.lang.Object getMessage()
Returns the Object sent in the message.

Returns:
Object message