de.palmmedia.yahtzee.game.elements
Class Number

java.lang.Object
  extended by de.palmmedia.yahtzee.game.elements.Element
      extended by de.palmmedia.yahtzee.game.elements.Number

public class Number
extends Element

Element where dices have to be equal to a certain number.

Author:
Daniel Palme

Field Summary
private  int number
          The number.
 
Constructor Summary
Number(String name, int number)
          Constructor.
 
Method Summary
 boolean areDicesAllowed(Dice[] dices)
          Determines whether the dices can be applied to the element.
protected  int calculateResult(Dice[] dices)
          Calculates the result of the given dices.
 boolean doDicesFit(Dice[] dices)
          Determines whether the dices fit.
 
Methods inherited from class de.palmmedia.yahtzee.game.elements.Element
calculate, getName, getResult, hasResult, setDices, unsetDices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

number

private int number
The number.

Constructor Detail

Number

public Number(String name,
              int number)
Constructor.

Parameters:
name - The name.
number - The number.
Method Detail

doDicesFit

public boolean doDicesFit(Dice[] dices)
Determines whether the dices fit.

Overrides:
doDicesFit in class Element
Parameters:
dices - The dices.
Returns:
The fit state.

areDicesAllowed

public boolean areDicesAllowed(Dice[] dices)
Determines whether the dices can be applied to the element.

Specified by:
areDicesAllowed in class Element
Parameters:
dices - The dices.
Returns:
The fit state.

calculateResult

protected int calculateResult(Dice[] dices)
Calculates the result of the given dices.

Specified by:
calculateResult in class Element
Parameters:
dices - The dices.
Returns:
The result.