public interface DominoSpecification extends HasInvariant, Randomizable
equals(java.lang.Object)
and hashCode()
methods appropriatelyJUnit_DominoSpecification
Modifier and Type | Field and Description |
---|---|
static boolean |
INVARIANT
The class invariant checks that the MAX value is bigger than the MIN value
NOTE: Should NOT be changed |
static int |
MAX
The maximum value of a side of a domino in a standard domino set
NOTE: May be changed provided the class invariant remains true |
static int |
MIN
The minimum value of a side of a domino in a standard domino set
NOTE: May be changed provided the class invariant remains true |
static int |
NUMBER_OF_DOMINOES_POSSIBLE
The total number of dominoes = 1 + 2 + 3 + ...
|
static int |
RANGE_OF_VALUES
The range of domino values
NOTE: Should NOT be changed as it is a derived constant |
Modifier and Type | Method and Description |
---|---|
DominoSpecification |
copy()
Constructs a new domino using a copy of the left and right values of
this Tested by JUnit_DominoSpecification.test_copy() |
boolean |
equals(java.lang.Object obj)
Tested by
JUnit_DominoSpecification.test_equals() |
int |
getLeftValue()
Getter function of the left value.
Tested by JUnit_DominoSpecification.test_getLeft() |
int |
getRightValue()
Getter function of the right value.
Tested by JUnit_DominoSpecification.test_getRight() |
int |
hashCode()
|
boolean |
invariant()
Should check that the left and right values are in allowed range
MIN .. |
void |
switchSides()
Swap the left and right values - to model flipping/switching the domino around.
|
java.lang.String |
toString()
|
randomize, randomize
static final int MIN
static final int MAX
static final int RANGE_OF_VALUES
static final int NUMBER_OF_DOMINOES_POSSIBLE
static final boolean INVARIANT
boolean invariant() throws InvariantBrokenException
invariant
in interface HasInvariant
InvariantBrokenException
boolean equals(java.lang.Object obj)
JUnit_DominoSpecification.test_equals()
equals
in class java.lang.Object
obj
- is compared to thishashCode()
int hashCode()
hashCode
in class java.lang.Object
equals(java.lang.Object)
methodequals(java.lang.Object)
java.lang.String toString()
toString
in class java.lang.Object
DominoSpecification copy()
this
JUnit_DominoSpecification.test_copy()
this
void switchSides() throws InvariantBrokenException
JUnit_DominoSpecification.test_switchSides()
InvariantBrokenException
- if the state change produces an invalid dominoint getRightValue()
JUnit_DominoSpecification.test_getRight()
int getLeftValue()
JUnit_DominoSpecification.test_getLeft()