|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dice.Die
Field Summary | |
static int |
BADVAL
|
static int |
defaultSides
|
static int |
maxSides
|
static int |
minSides
|
Constructor Summary | |
Die()
Creates a new default instance of Die - with 6 sides and no initial value |
|
Die(int sides)
Creates a new instance of Die - with a given number of sides and no initial value |
|
Die(int sides,
int val)
Creates a new instance of Die - with a given number of sides and given initial value |
Method Summary | |
boolean |
equals(java.lang.Object obj)
test if two die objects are equal (in contents) Policy - just check value shown on dice - makes easier for client code to check die for having a particular value |
int |
getNumSides()
report the number of sides on this die (you think I'm joking - there are other size dice besides 6 sided) |
int |
getRoll()
roll the dice and report the value shown on the die |
int |
getValue()
report on what the current value shown on the dice is |
static void |
main(java.lang.String[] args)
|
dice.Die |
roll()
|
java.lang.String |
toString()
show the current value shown on the die (Policy - user not interested in how many sides - they know that) Policy - bad value - show as #BAD# |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int BADVAL
public static final int minSides
public static final int maxSides
public static final int defaultSides
Constructor Detail |
public Die()
public Die(int sides)
public Die(int sides, int val)
Method Detail |
public int getValue()
public int getRoll()
public dice.Die roll()
public int getNumSides()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- the command line arguments
used to test class
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |