|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Roller
public class Roller
A class acting as a container for one or more Die objects. An object of this type allows you to easily roll all, or a subset, of the Die objects it contains with one method call. The Class also provides constructors that allow a user to specify seed values for the Die to allow reproducable behavior for easy testing, debugging, and or cheating (not recommended!) at dice games.
Constructor Summary | |
---|---|
Roller(int numberOfDie)
Creates a new instance of Roller with the specified number of die. |
|
Roller(int numberOfDie,
int numberOfSides)
Creates a new instance of Roller with the specified number of die having the specified number of sides. |
|
Roller(int numberOfDie,
int numberOfSides,
long[] seeds)
Creates a new instance of Roller with the specified number of die having the specified number of sides, and using the provided seed values for each one. |
|
Roller(int numberOfDie,
long[] seeds)
Creates a new instance of Roller with the specified number of die using the provided seed values for each one. |
Method Summary | |
---|---|
int[] |
roll()
Rolls all of the die and returns the value of each in an array of integers. |
int[] |
roll(int numberOfDice)
Rolls the specified number of die and returns the value of each in an array of integers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Roller(int numberOfDie)
numberOfDie
- The number of die contained by this Roller. The value
must be a positive integer.public Roller(int numberOfDie, int numberOfSides)
numberOfDie
- The number of die contained by this Roller. The value
must be a positive integer.numberOfSides
- The number of sides each die in this Roller will
have. The value must be a positive integer.public Roller(int numberOfDie, long[] seeds)
numberOfDie
- The number of die contained by this Roller. The value
must be a positive integer.seeds
- An array of values to use to seed each die. The size of the
array must be greater than or equal to the number of die being created.public Roller(int numberOfDie, int numberOfSides, long[] seeds)
numberOfDie
- The number of die contained by this Roller. The value
must be a positive integer.numberOfSides
- The number of sides each die in this Roller will
have. The value must be a positive integer.seeds
- An array of values to use to seed each die. The size of the
array must be greater than or equal to the number of die being created.Method Detail |
---|
public int[] roll()
public int[] roll(int numberOfDice)
numberOfDice
- The number of die to roll, must between 1 and the
number of die contained by this Roller, inclusive.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |