Package zebra4j
Class Puzzle
- java.lang.Object
-
- zebra4j.Puzzle
-
public final class Puzzle extends java.lang.ObjectA puzzle that asks all attributes ingetAttributeSets()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 ofFacts.
-
-
Constructor Summary
Constructors Constructor Description Puzzle(java.util.Map<AttributeType,java.util.Set<Attribute>> attributeSets, java.util.Set<Fact> facts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>describeConstraints(java.util.Locale locale)Describe in natural language the constraints that the solution must satisfy.booleanequals(java.lang.Object o)java.util.Map<AttributeType,java.util.Set<Attribute>>getAttributeSets()The attribute types and the sub-sets of their values used in the puzzle.java.util.Set<Fact>getFacts()The facts that must be satisfied by any solution of the puzzle.inthashCode()intnumPeople()java.lang.StringtoString()
-
-
-
Constructor Detail
-
Puzzle
public Puzzle(java.util.Map<AttributeType,java.util.Set<Attribute>> attributeSets, java.util.Set<Fact> facts)
-
-
Method Detail
-
numPeople
public int numPeople()
- Returns:
- the number of people in the puzzle
-
describeConstraints
public java.util.List<java.lang.String> describeConstraints(java.util.Locale locale)
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
public java.util.Map<AttributeType,java.util.Set<Attribute>> getAttributeSets()
The attribute types and the sub-sets of their values used in the puzzle.
-
getFacts
public java.util.Set<Fact> getFacts()
The facts that must be satisfied by any solution of the puzzle.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-