Putting It All Together |
bingo.shared
The following lists and describes all the classes in thebingo.shared
package.
Registrar
-- an interfaceThis interface is implemented by
bingo.game.RegistrarImpl
and defines the three remote methods supported by the Game application that can be called by the Player. One method is called by the Player to register for a game, one is called by the Player to claim BINGO, and one is called to get status from the Game.
Constants
-- an interface that contains a collection of game constants.One constant define in this file is the port number used by the Game to broadcast packets to the Player. Three other constants are group names used to categorize the broadcast packets into three types of information: balls, player status updates, and game status updates.
ErrorMessages
-- this class contains a collection of static methods that both the Game and the Player can call to print error messages.
BingoBall
-- a BINGO ball.Used extensively by
Card
andBallAnnouncer
.
Card
-- a BINGO card.Each space on the card contains a
BingoBall
. Created and signed by the Game.
Ticket
-- an instance of this class is created by the Registrar when a Player registers and returned to the Player.It contains the Player's ID, cards, and other information needed by the Player to play.
PlayerRecord
-- represents a Player.Used by the
Registrar
andPlayerInfoPane
to keep track of players.
Answer
-- returned to the Player when the Player claims BINGO.This class informs the Player whether or not they actually won.
OverallStatusPane
-- implements the Game status UI.This window creates a
LightBoardPane
,PlayerInfoPane
, and aGameStatusLabel
. This is general enough that it could be used by the Player or another application.
PlayerInfoPane
-- used by the Game to display the players that are registered in this game.This Pane is a
PlayerListener
and uses aPlayerListenerThread
to listen for player status updates on theMulticastSocket
.
PlayerInfoModel
-- controls the content of the table that lists the currently registered players.
GameStatusLabel
-- used by the Player and by the Game to display game status.This Label is a
GameListener
and uses aGameListenerThread
to listen for game status updates on theMulticastSocket
.
LightBoardPane
-- used by the Player and by the Game to display the balls that have been announced in this game.This particular status pane works differently than the
PlayerInfoPane
andGameStatusLabel
. This Pane is not aBallListener
and doesn't use aBallListenerThread
, but must be created and informed of announced balls by aBallListener
using aBallListenerThread
. This is because the information is needed at a higher level in each program (theBallAnnouncer
throws an end-of-game ball which has implications for the rest of the program).
Utilities
-- a class with a couple of useful methods for positioning Swing components.This class is only used by the Player application, but could be used by other applications.
Listener
-- an empty interface whose sole purpose is to be a superinterface toBallListener
,PlayerListener
andGameListener
.
ListenerThread
-- the abstract superclass ofBallListenerThread
,PlayerListenerThread
, andGameListenerThread
.This class is a subclass of
Thread
provides a constructor which must be called by its subclass's constructors. Additionally, this class provides thestopListening
andfinalize
methods for its subclasses.
BallListener
-- an interface that defines the methods a class must implement in order to listen to balls as they are announced.This interface is implemented by
bingo.shared.OverallStatusPane
andbingo.player.Player
. ABallListener
uses aBallListenerThread
to listen to aMulticastSocket
for announced balls. The thread notifies itsBallListener
of interesting activities on the socket.
BallListenerThread
-- a subclass ofListenerThread
that receives balls from theMulticastSocket
as they are sent by the Game.This thread is created with a
BallListener
which is informed of each ball as it is announced.
PlayerListener
-- an interface that defines the methods a class must implement in order to listen to player status updates.A
PlayerListener
uses aPlayerListenerThread
to listen to aMulticastSocket
for player status messages. The thread notifies itsPlayerListener
of interesting activities on the socket.PlayerInfoPane
implements this interface and creates aPlayerListenerThread
for listening.
PlayerListenerThread
-- a subclass ofListenerThread
that gets player status updates from theMulticastSocket
as they are sent by the Game.This thread is created with a
PlayerListener
which is informed of status messages as they are received.
GameListener
-- an interface that defines the methods a class must implement in order to listen to game status updates.A
GameListener
uses aGameListenerThread
to listen to aMulticastSocket
for game status messages. The thread notifies itsGameListener
of interesting activities on the socket.GameStatusLabel
implements this interface and createsGameListenerThread
for listening.
GameListenerThread
-- a subclass ofListenerThread
that gets game status updates from theMulticastSocket
as they are sent by the RingMaster.This thread is created with a
GameListener
which is informed of status messages as they are received.
BingoException
,NoMoreBallsException
-- exceptions for the BINGO game.
Putting It All Together |