Package zebra4j
Class BasicPuzzle
java.lang.Object
zebra4j.BasicPuzzle
A puzzle that asks all attributes in
getAttributeSets()
to be
assigned to people, satisfying rules defined by the attribute sets used in
the puzzle (e.g. all people have different name and the name may be Liza,
John or Mary). The assignment must also satisfy the given set of
Fact
s.
The puzzle is immutable if the provided input collections are immutable.
For efficiency, the puzzle constructor does not validate if the attribute
sets and facts are consistent. Use PuzzleBuilder
is validation is
preferred.
-
Constructor Summary
ConstructorsConstructorDescriptionBasicPuzzle(Map<AttributeType,Set<Attribute>> attributeSets, Collection<Fact> facts)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
describeConstraints(Locale locale)
Describe in natural language the constraints that the solution must satisfy.boolean
The attribute types and the sub-sets of their values used in the puzzle.getFacts()
The facts that must be satisfied by any solution of the puzzle.int
hashCode()
int
toString()
-
Constructor Details
-
BasicPuzzle
-
-
Method Details
-
numPeople
public int numPeople()- Returns:
- the number of people in the puzzle
-
contains
- Parameters:
attr
- required- Returns:
- if the puzzle refers to the given attribute
-
describeConstraints
Describe in natural language the constraints that the solution must satisfy.- Parameters:
locale
- required- Returns:
- a list of sentences in the given locale, not null.
-
getAttributeSets
The attribute types and the sub-sets of their values used in the puzzle. -
getFacts
The facts that must be satisfied by any solution of the puzzle. -
equals
-
hashCode
public int hashCode() -
toString
-