group1.model
Class ScoreModelMediator

java.lang.Object
  extended by group1.model.ScoreModelMediator

public class ScoreModelMediator
extends java.lang.Object

A special mediator class that should be referenced by anything in the model that needs to add points to the game's score.


Method Summary
 boolean addPoints(int points)
          Add points to the total score.
static ScoreModelMediator getInstance()
          Get an instance of this class.
 void setGame(Game g)
          Set the game referenced by this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ScoreModelMediator getInstance()
Get an instance of this class. (Singleton design pattern.)

Returns:
The instance of this class.

setGame

public void setGame(Game g)
Set the game referenced by this class. (This must be done first!)

Parameters:
g - The game.

addPoints

public boolean addPoints(int points)
Add points to the total score. (More specifically: Send a signal to the Game class to add points to the score.) The "game" object must be set first, or this method has no meaning and will fail.

Parameters:
points - The number of points to add.
Returns:
Whether or not this method was successful.