All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class game.Handler

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----game.Handler

public abstract class Handler
extends Thread
implements GameLinkListener
The ... [DESCRIBE ME]


Variable Index

 o debug
if true, enables the printing of debug informations on the console.
 o gameLink
The GameLink object is used by the handler on one side (ie server) to communicate with the other handler on the other side (ie client).
 o listeners
Set of listeners of this Handler
 o players
Set of players managed by this handler.

Constructor Index

 o Handler(Socket)
Creates a new Handler

Method Index

 o addListener(HandlerListener)
Adds a listener to the set of listeners for this Handler.
 o addManagedPlayer(Player, GameHandler)
 o close()
Close this handler, by simply shutting down the GameLink connection.
 o countListeners()
Returns the number of listeners of this object.
 o deleteListener(HandlerListener)
Deletes a listener from the set of listeners of this Handler.
 o frameReceived(Object, LinkFrame)
Messaged when a new data frame is received by the GameLink object and this frame belongs to the groups the GameLinkListener asked to listen to.
 o getGameLink()
Returns GameLink object.
 o getManagedPlayers()
 o getPlayerGames(Player)
 o lostConnectionNotify()
experimental
 o notifyListeners()
experimental
 o pad(String, int)
Pads the given string to the given size with white spaces.
 o removePlayer(Player)
 o removePlayer(Player, Game)

Variables

 o gameLink
 GameLink gameLink
The GameLink object is used by the handler on one side (ie server) to communicate with the other handler on the other side (ie client).

 o debug
 boolean debug
if true, enables the printing of debug informations on the console.

 o listeners
 Vector listeners
Set of listeners of this Handler

 o players
 Hashtable players
Set of players managed by this handler. [FINISH ME]

Constructors

 o Handler
 public Handler(Socket socket) throws SocketException
Creates a new Handler

Methods

 o close
 public void close()
Close this handler, by simply shutting down the GameLink connection. Derivated classes should override this method to have a better control of the close operation.

See Also:
close
 o getGameLink
 public GameLink getGameLink()
Returns GameLink object. [CHECK THIS]

 o addListener
 public synchronized void addListener(HandlerListener hl)
Adds a listener to the set of listeners for this Handler.

Parameters:
hl - a listener to be added.
 o deleteListener
 public synchronized void deleteListener(HandlerListener hl)
Deletes a listener from the set of listeners of this Handler.

Parameters:
hl - the listener to be deleted.
 o countListeners
 public synchronized int countListeners()
Returns the number of listeners of this object.

Returns:
the number of listeners of this object.
 o notifyListeners
 public void notifyListeners()
experimental

 o lostConnectionNotify
 public void lostConnectionNotify()
experimental

 o pad
 public String pad(String s,
                   int size)
Pads the given string to the given size with white spaces.

Parameters:
s - the string to pad
size - the size of the new string returned
Returns:
the string space-padded.
 o addManagedPlayer
 public void addManagedPlayer(Player player,
                              GameHandler handler)
 o getManagedPlayers
 public Enumeration getManagedPlayers()
 o getPlayerGames
 public Enumeration getPlayerGames(Player player)
 o removePlayer
 public void removePlayer(Player player)
 o removePlayer
 public void removePlayer(Player player,
                          Game game)

All Packages  Class Hierarchy  This Package  Previous  Next  Index