de.spieleck.game.base
Class GameRoomBase

java.lang.Object
  |
  +--de.spieleck.game.base.GamePlaceBase
        |
        +--de.spieleck.game.base.GameRoomBase
All Implemented Interfaces:
GamePlace, GameRoom, GameSpectator, PlayerCollection, ReadablePlayerCollection, ReadableSpectatorCollection, Spectable, SpectatorCollection

public abstract class GameRoomBase
extends GamePlaceBase
implements GameRoom

A GameRoom represents a collection of places, where gaming goes on. This is an arbitrary mixture of (nested) GameRoom or GameTable objects or whatever else implements a GamePlace interface. These classes form a typical composite pattern, with GameTable as leaf.

XXXAs with the other subclass of GamePlaceBase, GameTableBase one could consider replacing inheritance by delegation. As there, this is tedious and I hope I have made GamePlaceBase abstract enough to do not block further subclasses from adaption!


Field Summary
protected static int id
          unique child id
protected  java.util.Set places
          GamePlaces below this one
protected  java.util.Set rules
          Rules available in this Room
 
Constructor Summary
GameRoomBase()
          A simple constructor.
 
Method Summary
 void addGamePlace(GamePlace place)
          adds a GamePlace to this GameRoom
 void addRule(GameRule rule)
          We keep a set of rules to be allowed in a certain room.
 java.util.Iterator getGamePlaces()
          returns an Iterator of all GamePlace connected to this GameRoom
 int getid()
          poor mens unique id.
 java.util.Iterator getRules()
          return the list of allowed Rules in this Room.
 void removeGamePlace(GamePlace place)
          removes the GamePlace from this GameRoom
 void removeRule(GameRule rule)
           
 
Methods inherited from class de.spieleck.game.base.GamePlaceBase
canWatch, dispatchUpdateMessage, getParent, getPlaceName, getPlayerCount, getPlayers, getSpectatorName, getSpectators, getSpectatorsCount, isIn, isWatching, join, leave, setParent, setPlayers, setSpectators, turnAway, watch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.spieleck.game.base.GameRoom
getId
 
Methods inherited from interface de.spieleck.game.base.GamePlace
getParent, getPlaceLocalName, getPlaceName, setParent
 
Methods inherited from interface de.spieleck.game.base.Spectable
dispatchUpdateMessage
 
Methods inherited from interface de.spieleck.game.base.GameSpectator
getSpectatorName, notifyUpdate
 
Methods inherited from interface de.spieleck.game.base.SpectatorCollection
canWatch, turnAway, watch
 
Methods inherited from interface de.spieleck.game.base.ReadableSpectatorCollection
getSpectators, getSpectatorsCount, isWatching
 
Methods inherited from interface de.spieleck.game.base.PlayerCollection
canJoin, canLeave
 

Field Detail

rules

protected java.util.Set rules
Rules available in this Room

places

protected java.util.Set places
GamePlaces below this one

id

protected static int id
unique child id
Constructor Detail

GameRoomBase

public GameRoomBase()
A simple constructor. Not lazy, really initializes all.
Method Detail

addRule

public void addRule(GameRule rule)
We keep a set of rules to be allowed in a certain room.

removeRule

public void removeRule(GameRule rule)

getRules

public java.util.Iterator getRules()
return the list of allowed Rules in this Room.
Specified by:
getRules in interface GameRoom

addGamePlace

public void addGamePlace(GamePlace place)
adds a GamePlace to this GameRoom
Specified by:
addGamePlace in interface GameRoom

removeGamePlace

public void removeGamePlace(GamePlace place)
                     throws GameException
removes the GamePlace from this GameRoom
Specified by:
removeGamePlace in interface GameRoom

getGamePlaces

public java.util.Iterator getGamePlaces()
returns an Iterator of all GamePlace connected to this GameRoom
Specified by:
getGamePlaces in interface GameRoom

getid

public int getid()
poor mens unique id.


gameframe project