com.hedgehog.game
Class Dice

java.lang.Object
  extended by com.hedgehog.HObject
      extended by com.hedgehog.game.Dice
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator

public class Dice
extends HObject

Title: Dice - models a collecton of Die.

Description: Models a collection of Die.

Copyright: Copyright (c) Hedgehog Software 2007-2009.

Company: Hedgehog Software.

Since:
1.0
Version:
1.1

Field Summary
protected  Die[] mDice
          Array of die.
 
Fields inherited from class com.hedgehog.HObject
mID, mName
 
Constructor Summary
Dice()
          Default constructor.
Dice(Dice object)
          Copy constructor.
Dice(int numberDie)
          Constructor.
 
Method Summary
 Die die(int dieIndex)
          Returns the die having the speified index.
 Die[] getDie()
          Returns the array of die.
 int numberDie()
          Returns the number of die.
 void setDie(Die[] die)
          Sets the array of die.
 java.lang.String toString()
          Returns a String representation of this Dice object.
 
Methods inherited from class com.hedgehog.HObject
clone, compare, compareTo, copy, equals, getID, getName, hashCode, hasID, hasName, setID, setName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mDice

protected Die[] mDice
Array of die.

Constructor Detail

Dice

public Dice()
Default constructor. Allocates 2 die.


Dice

public Dice(int numberDie)
     throws java.lang.IllegalArgumentException
Constructor. Allocates the specified number of die.

Parameters:
numberDie - Number of die.
Throws:
java.lang.IllegalArgumentException - Thrown if numberDie <= 0.

Dice

public Dice(Dice object)
Copy constructor.

Parameters:
object - Object to copy.
Method Detail

getDie

public Die[] getDie()
Returns the array of die.

Returns:
The array of die.

setDie

public void setDie(Die[] die)
Sets the array of die.

Parameters:
die - New array of die.

numberDie

public int numberDie()
Returns the number of die.

Returns:
The number of die.

die

public Die die(int dieIndex)
        throws java.lang.IllegalArgumentException
Returns the die having the speified index.

Parameters:
dieIndex - Die index.
Returns:
The die having the specified index.
Throws:
java.lang.IllegalArgumentException - Thrown if the specified die index is invalid.

toString

public java.lang.String toString()
Returns a String representation of this Dice object.

Overrides:
toString in class java.lang.Object
Returns:
A String representation of this Dice object.