Package zebra4j

Class Puzzle


  • public final class Puzzle
    extends java.lang.Object
    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 Facts.
    • 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.
      boolean equals​(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.
      int hashCode()  
      int numPeople()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

    • 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object