de.palmmedia.yahtzee.game
Class Dice

java.lang.Object
  extended by java.util.Observable
      extended by de.palmmedia.yahtzee.game.Dice

public class Dice
extends Observable

Represents a dice.

Author:
Daniel Palme

Field Summary
private  boolean locked
          Determines whether the dice is locked.
private  int value
          The value.
 
Constructor Summary
Dice()
          Constructor.
 
Method Summary
 int getValue()
          Gets the value.
 boolean hasChanged()
          
 boolean isLocked()
          Determines whether the dice is locked.
 void roll()
          Rolls the dice if it is not locked.
 void setLocked(boolean value)
          Locks the dice.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

private int value
The value.


locked

private boolean locked
Determines whether the dice is locked.

Constructor Detail

Dice

public Dice()
Constructor.

Method Detail

getValue

public int getValue()
Gets the value.

Returns:
The value.

isLocked

public boolean isLocked()
Determines whether the dice is locked.

Returns:
The locked state.

setLocked

public void setLocked(boolean value)
Locks the dice.

Parameters:
value - The locked state.

roll

public void roll()
Rolls the dice if it is not locked.


hasChanged

public boolean hasChanged()

Overrides:
hasChanged in class Observable