|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--blue.chance.Die
A 'die' is modeled in terms of a top face value, the number of sides, a name, and a history of previous roll outcomes from a particular point in 'time'.
Constructor Summary | |
Die()
Create a standard die. |
|
Die(int nf)
Create a standard die. |
|
Die(java.lang.String n)
Create a standard die. |
|
Die(java.lang.String n,
int nf)
Create a standard die. |
Method Summary | |
int |
count()
Return the number of values on the local event history. |
int |
previous()
Return the previously rolled top face value, assuming there is one. |
int |
previous(int n)
Return the nth previously rolled top face value, assuming it exists. |
void |
print()
Print a representation of the die to the standard output stream. |
void |
print(OutStream os)
Print a representation of the die to the standard output stream. |
void |
print(java.io.PrintStream ps)
Print a representation of the die to the standard output stream. |
void |
println()
Print a description of the die to the standard output stream followed by a newline. |
void |
println(OutStream os)
Print a description of the die to the standard output stream followed by a newline. |
void |
println(java.io.PrintStream ps)
Print a description of the die to the standard output stream followed by a newline. |
void |
reset()
Empty the local history which records the top face outcomes since either the die was created or a reset command was issued. |
void |
roll()
Roll the die. |
void |
showHistory()
Display the local event history (the top face values) to the standard output file. |
void |
showHistory(OutStream os)
Display the local event history (the top face values) to the standard output file. |
void |
showHistory(java.io.PrintStream ps)
Display the local event history (the top face values) to the standard output file. |
void |
showHistoryHorizontally()
Display the local event history (the top face values) to the standard output file, horizontally. |
void |
showHistoryHorizontally(OutStream os)
Display the local event history (the top face values) to the standard output file, horizontally. |
void |
showHistoryHorizontally(java.io.PrintStream ps)
Display the local event history (the top face values) to the standard output file, horizontally. |
void |
showHistoryVertically()
Display the local event history (the top face values) to the standard output file, vertically. |
void |
showHistoryVertically(OutStream os)
Display the local event history (the top face values) to the standard output file, vertically. |
void |
showHistoryVertically(java.io.PrintStream ps)
Display the local event history (the top face values) to the standard output file, vertically. |
int |
top()
Return the top face value of the die. |
void |
topPrint()
Print the top face value of the die to the standard output stream. |
void |
topPrint(OutStream os)
Print the top face value of the die. |
void |
topPrint(java.io.PrintStream ps)
Print the top face value of the die. |
void |
topPrintln()
Print the top face value of the die to the standard output stream followed by a newline. |
void |
topPrintln(OutStream os)
Print the top face value of the die to the standard output stream followed by a newline. |
void |
topPrintln(java.io.PrintStream ps)
Print the top face value of the die to the standard output stream followed by a newline. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Die()
public Die(java.lang.String n)
n
- the name of the die.public Die(int nf)
nf
- the number of faces.public Die(java.lang.String n, int nf)
n
- the name of the die.nf
- the number of faces.Method Detail |
public void roll()
public int top()
public void topPrint()
public void topPrint(OutStream os)
os
- the stream to which the value is written.public void topPrint(java.io.PrintStream ps)
ps
- the stream to which the value is written.public void print()
public void print(OutStream os)
os
- the stream to which the value is written.public void print(java.io.PrintStream ps)
ps
- the stream to which the value is written.public void topPrintln()
public void topPrintln(OutStream os)
os
- the stream to which the value is written.public void topPrintln(java.io.PrintStream ps)
ps
- the stream to which the value is written.public void reset()
public int count()
public void println()
public void println(OutStream os)
os
- the stream to which the value is written.public void println(java.io.PrintStream ps)
ps
- the stream to which the value is written.public void showHistory()
public void showHistory(OutStream os)
os
- the stream to which the value is written.public void showHistory(java.io.PrintStream ps)
ps
- the stream to which the value is written.public void showHistoryHorizontally()
public void showHistoryHorizontally(OutStream os)
os
- the stream to which the value is written.public void showHistoryHorizontally(java.io.PrintStream ps)
ps
- the stream to which the value is written.public void showHistoryVertically()
public void showHistoryVertically(OutStream os)
os
- the stream to which the value is written.public void showHistoryVertically(java.io.PrintStream ps)
ps
- the stream to which the value is written.public int previous()
public int previous(int n)
n
- the index in time gone by of the top face value
to be retured.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |