de.palmmedia.yahtzee.game
Class Section

java.lang.Object
  extended by de.palmmedia.yahtzee.game.Section
Direct Known Subclasses:
LowerSection, UpperSection

public abstract class Section
extends Object

Represents a section. The game consists of two sections. Each section consists of several elements.

Author:
Daniel Palme

Field Summary
private  List<Element> elements
          The elements.
 
Constructor Summary
Section()
           
 
Method Summary
protected  void add(Element element)
          Adds the given element.
abstract  int getBonus()
          Gets the bonus of the section.
 List<Element> getElements()
          Gets the elements.
 int getResult()
          Gets the sum of the section.
abstract  boolean hasBonus()
          Determines whether the section has a bonus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

private List<Element> elements
The elements.

Constructor Detail

Section

public Section()
Method Detail

add

protected void add(Element element)
Adds the given element.

Parameters:
element - The element.

getElements

public List<Element> getElements()
Gets the elements.

Returns:
The elements.

getResult

public int getResult()
Gets the sum of the section.

Returns:
The sum.

getBonus

public abstract int getBonus()
Gets the bonus of the section.

Returns:
The bonus.

hasBonus

public abstract boolean hasBonus()
Determines whether the section has a bonus.

Returns:
The bonus state.