All Packages Class Hierarchy This Package Previous Next Index
Class scrobble.ServerBag
java.lang.Object
|
+----scrobble.Bag
|
+----scrobble.ServerBag
- public class ServerBag
- extends Bag
- implements GameLinkConstants
This class is the Server version of the class Bag
.
It handles all the Bag operations (giving and receiving letter...)
-
cheat
-
Boolean cheat enable to play in a cheaty way.
-
debug
- if true, enables the printing of debug informations on the console.
-
o
- ServerBag must be Observable by the others ClientBag.
-
ServerBag()
- Creates a new ServerBag
-
ServerBag(Distribution)
- Creates a new ServerBag
-
addLetters(Vector)
- Set the modification happened to the bag,
notify the observer.
-
addObserver(Observer)
- Adds an observer to the set of observers for this object.
-
countObservers()
- Returns the number of observers of this object.
-
createLinkframe(int, Object)
- Creates a new LinkFrame to tranmit to ClientBag.
-
deleteObserver(Observer)
- Deletes an observer to the set of observers for this object.
-
deleteObservers()
- Clears the observerlist so that this object no longer has any observers.
-
getLetter()
- Get a letter
The letters in the Bag are organized
following a Vector structure, built with a random process.
-
getLetters(int)
- Removes one or more letters from the bag and return them.
-
getRandomLetter()
- helper func.
-
getSize()
- getSize
-
notifyObservers(LinkFrame)
- [Describe me]
-
setLetter(Letter)
- Set a letter
debug
static boolean debug
- if true, enables the printing of debug informations on the console.
o
protected Observable o
- ServerBag must be Observable by the others ClientBag.
So needs the object o to have the methods addObserver(), deleteObserver()
and notifyObserver().
cheat
boolean cheat
- Boolean cheat enable to play in a cheaty way.
ServerBag
public ServerBag(Distribution distribution)
- Creates a new ServerBag
ServerBag
public ServerBag()
- Creates a new ServerBag
addObserver
public void addObserver(Observer obs)
- Adds an observer to the set of observers for this object.
- Parameters:
- obs - an observer to be added.
deleteObserver
public void deleteObserver(Observer obs)
- Deletes an observer to the set of observers for this object.
- Parameters:
- obs - the observer to be deleted
deleteObservers
public void deleteObservers()
- Clears the observerlist so that this object no longer has any observers.
countObservers
public int countObservers()
- Returns the number of observers of this object.
- Returns:
- the number of observers of this object.
notifyObservers
public void notifyObservers(LinkFrame frame)
- [Describe me]
createLinkframe
public LinkFrame createLinkframe(int request,
Object data)
- Creates a new LinkFrame to tranmit to ClientBag.
- Parameters:
- request - the request of the frame.
- data - the data of the frame.
addLetters
public void addLetters(Vector newLetters)
- Set the modification happened to the bag,
notify the observer.
- Parameters:
- newLetters - the new vector of letters remaining in the Bag.
getRandomLetter
Letter getRandomLetter() throws Exception
- helper func. Exception has to be created properly (ie EmptyBagException or ..) -vim980406
getLetter
public Letter getLetter() throws Exception
- Get a letter
The letters in the Bag are organized
following a Vector structure, built with a random process.
Eventually, the Bag returns a random letter.
Faire une exception si le sac est vide
getLetters
public Vector getLetters(int n) throws Exception
- Removes one or more letters from the bag and return them.
- Parameters:
- n - the number of letters to remove from the bag
- Returns:
- the letters actually removed from the bag
- Throws: Exception
- @@ [PENDING: Create me, describe me]
setLetter
public void setLetter(Letter letter)
- Set a letter
getSize
public int getSize()
- getSize
All Packages Class Hierarchy This Package Previous Next Index