|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.dolben.MarkX.Requirement
class Requirement
A Requirement, as part of the Monitors algorithm for generating guesses in the N digit number game, keeps track of a set of available digits and the number of digits that must be picked from that set, and provides a check that those constraints are satisfied.
| Constructor Summary | |
|---|---|
Requirement(java.util.BitSet available,
int needs)
constructs a Requirement with a set of available digits and a number of digits from that set that are in the target number |
|
| Method Summary | |
|---|---|
boolean |
ok(int digit,
int left)
checks that picking some digit with a number of places left in the guess satisfies the constraints |
void |
pick(int digit)
tracks the picking of a digit |
java.lang.String |
toString()
makes a String of the object |
void |
unpick(int digit)
tracks the backtracking of picking a digit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
Requirement(java.util.BitSet available,
int needs)
available - the set of digits to trackneeds - the number of digits from the set in the target| Method Detail |
|---|
public boolean ok(int digit,
int left)
digit - the digit to checkleft - the number of digits left in the guess
public void pick(int digit)
digit - the digit pickedpublic void unpick(int digit)
digit - the digit which was picked beforepublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||