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]
-
debug
- if true, enables the printing of debug informations on the console.
-
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).
-
listeners
- Set of listeners of this Handler
-
players
- Set of players managed by this handler.
-
Handler(Socket)
- Creates a new Handler
-
addListener(HandlerListener)
- Adds a listener to the set of listeners for this Handler.
-
addManagedPlayer(Player, GameHandler)
-
-
close()
- Close this handler, by simply shutting down the
GameLink
connection.
-
countListeners()
- Returns the number of listeners of this object.
-
deleteListener(HandlerListener)
- Deletes a listener from the set of listeners of this Handler.
-
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.
-
getGameLink()
- Returns GameLink object.
-
getManagedPlayers()
-
-
getPlayerGames(Player)
-
-
lostConnectionNotify()
- experimental
-
notifyListeners()
- experimental
-
pad(String, int)
- Pads the given string to the given size with white spaces.
-
removePlayer(Player)
-
-
removePlayer(Player, Game)
-
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).
debug
boolean debug
- if true, enables the printing of debug informations on the console.
listeners
Vector listeners
- Set of listeners of this Handler
players
Hashtable players
- Set of players managed by this handler. [FINISH ME]
Handler
public Handler(Socket socket) throws SocketException
- Creates a new Handler
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
getGameLink
public GameLink getGameLink()
- Returns GameLink object. [CHECK THIS]
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.
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.
countListeners
public synchronized int countListeners()
- Returns the number of listeners of this object.
- Returns:
- the number of listeners of this object.
notifyListeners
public void notifyListeners()
- experimental
lostConnectionNotify
public void lostConnectionNotify()
- experimental
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.
addManagedPlayer
public void addManagedPlayer(Player player,
GameHandler handler)
getManagedPlayers
public Enumeration getManagedPlayers()
getPlayerGames
public Enumeration getPlayerGames(Player player)
removePlayer
public void removePlayer(Player player)
removePlayer
public void removePlayer(Player player,
Game game)
All Packages Class Hierarchy This Package Previous Next Index