All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class game.GameLinkFilter

java.lang.Object
   |
   +----game.GameLinkFilter

public class GameLinkFilter
extends Object
implements GameLinkListener
When a Jags client is connected to a Jags server, it can open multiple games on this server. All those games will share the same GameLink object, so we need a way to sort network messages addressed to different games. This is done through the GameLinkFilter class.


Variable Index

 o gameId
The id of the game this GameLinkFilter corresponds to.
 o gameLink
The underlying GameLink object.
 o listeners
Set of listeners of this GameLinkFilter object.

Constructor Index

 o GameLinkFilter(Object, GameLink)
Creates a new GameLinkFilter [DESCRIBE ME]

Method Index

 o addGameLinkListener(GameLinkListener, int)
Adds the specified listener to the sets of listeners of this GameLinkFilter object.
 o deleteGameLinkListener(GameLinkListener, int)
Removes the specified listener from the sets of listeners of this GameLink object for the given group.
 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 notifyListeners(LinkFrame)
experimental.
 o send(LinkFrame)
Sends the given frame over the network.
 o sendBlindly(LinkFrame)
experimental.

Variables

 o listeners
 Hashtable listeners
Set of listeners of this GameLinkFilter object.

 o gameLink
 GameLink gameLink
The underlying GameLink object.

 o gameId
 Object gameId
The id of the game this GameLinkFilter corresponds to.

Constructors

 o GameLinkFilter
 public GameLinkFilter(Object id,
                       GameLink gameLink)
Creates a new GameLinkFilter [DESCRIBE ME]

Methods

 o send
 public void send(LinkFrame frame) throws IOException
Sends the given frame over the network. The frame will be tagged according to the game id.

Throws: IOException
thrown if an error occured during the sending of the frame
See Also:
sendBlindly, sendBlindly
 o sendBlindly
 public void sendBlindly(LinkFrame frame)
experimental.

See Also:
send, send
 o frameReceived
 public void frameReceived(Object link,
                           LinkFrame frame)
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.

Parameters:
frame - the frame that has just been received.
See Also:
GameLink
 o addGameLinkListener
 public synchronized void addGameLinkListener(GameLinkListener listener,
                                              int group)
Adds the specified listener to the sets of listeners of this GameLinkFilter object. The listener will listen only to the messages related to the group.

Parameters:
listener - the specified listener to be added.
gameId - the group of messages the listener wants listen to.
 o deleteGameLinkListener
 public synchronized void deleteGameLinkListener(GameLinkListener listener,
                                                 int group)
Removes the specified listener from the sets of listeners of this GameLink object for the given group.

Parameters:
listener - the listener to be removed from the set.
gameId - the given group.
 o notifyListeners
 void notifyListeners(LinkFrame frame)
experimental.


All Packages  Class Hierarchy  This Package  Previous  Next  Index