net.sf.cpsolver.ifs.extension

## Class AssignmentSet<T extends Value<?,T>>

- java.lang.Object
- - net.sf.cpsolver.ifs.extension.AssignmentSet<T>

-     public class AssignmentSet<T extends Value<?,T>>
      extends Object

  This class describing a set of assignment (used by CBS). It also contains a counter, name, description and a constraint (for printing purposes).
  Version:
    IFS 1.2 (Iterative Forward Search)
    Copyright (C) 2006 - 2010 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssignmentSet()`
    `AssignmentSet(Assignment<T>[] assignments)`
    `AssignmentSet(Collection<Assignment<T>> assignments)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAssignment(Assignment<T> assignment)` Adds an assignment
    `void` | `addAssignment(long iteration, T value, double ageing)` Adds an assignment
    `boolean` | `contains(Assignment<T> assignment)` Returns true if it contains the given assignment
    `boolean` | `contains(AssignmentSet<T> assignmentSet)` Returns true if it contains all of the given assignments
    `boolean` | `contains(Collection<Assignment<T>> assignments)` Returns true if it contains all of the given assignments
    `boolean` | `contains(T value)` Returns true if it contains the given assignment
    `boolean` | `contains(Variable<?,T> variable)` Returns true if it contains the given assignment (assigned variable)
    `boolean` | `containsValues(Collection<T> assignments)` Returns true if it contains all of the given assignments
    `boolean` | `containsVariables(Collection<Variable<?,T>> assignments)` Returns true if it contains all of the given assignments
    `static <T extends Value<?,T>> AssignmentSet<T>` | `createAssignmentSet(Collection<Assignment<T>> assignments)` Create set of assignments from the list of Assignments, Values or (assigned) Variables
    `static <T extends Value<?,T>> AssignmentSet<T>` | `createAssignmentSetForValues(Collection<T> assignments)` Create set of assignments from the list of Assignments, Values or (assigned) Variables
    `static <T extends Value<?,T>> AssignmentSet<T>` | `createAssignmentSetForVariables(Collection<Variable<?,T>> assignments)` Create set of assignments from the list of Assignments, Values or (assigned) Variables
    `boolean` | `equals(Object o)` Compares two assignment sets -- name, size and content (assignments) has to match.
    `Assignment<T>` | `getAssignment(T value)` Returns assignment that corresponds to the given value (if it is present in the set)
    `Constraint<?,T>` | `getConstraint()` Returns constraint
    `int` | `getCounter()` Returns counter
    `String` | `getDescription()` Returns description
    `String` | `getName()` Returns name
    `List<Assignment<T>>` | `getSet()` Returns set of assignments
    `int` | `hashCode()`
    `void` | `incCounter()` Increment counter
    `void` | `setConstraint(Constraint<?,T> constraint)` Sets constraint
    `void` | `setDescription(String description)` Sets description
    `void` | `setName(String name)` Sets name
    `int` | `size()` Returns number of assignments in the set
    `static int` | `xor(int a, int b)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AssignmentSet

          public AssignmentSet()

    - #### AssignmentSet

          public AssignmentSet(Assignment<T>[] assignments)

    - #### AssignmentSet

          public AssignmentSet(Collection<Assignment<T>> assignments)

  - ### Method Detail

    - #### createAssignmentSet

          public static <T extends Value<?,T>> AssignmentSet<T> createAssignmentSet(Collection<Assignment<T>> assignments)

      Create set of assignments from the list of Assignments, Values or (assigned) Variables

    - #### createAssignmentSetForValues

          public static <T extends Value<?,T>> AssignmentSet<T> createAssignmentSetForValues(Collection<T> assignments)

      Create set of assignments from the list of Assignments, Values or (assigned) Variables

    - #### createAssignmentSetForVariables

          public static <T extends Value<?,T>> AssignmentSet<T> createAssignmentSetForVariables(Collection<Variable<?,T>> assignments)

      Create set of assignments from the list of Assignments, Values or (assigned) Variables

    - #### incCounter

          public void incCounter()

      Increment counter

    - #### getCounter

          public int getCounter()

      Returns counter

    - #### getSet

          public List<Assignment<T>> getSet()

      Returns set of assignments

    - #### getName

          public String getName()

      Returns name

    - #### setName

          public void setName(String name)

      Sets name

    - #### getDescription

          public String getDescription()

      Returns description

    - #### setDescription

          public void setDescription(String description)

      Sets description

    - #### getConstraint

          public Constraint<?,T> getConstraint()

      Returns constraint

    - #### setConstraint

          public void setConstraint(Constraint<?,T> constraint)

      Sets constraint

    - #### contains

          public boolean contains(Assignment<T> assignment)

      Returns true if it contains the given assignment

    - #### contains

          public boolean contains(AssignmentSet<T> assignmentSet)

      Returns true if it contains all of the given assignments

    - #### contains

          public boolean contains(T value)

      Returns true if it contains the given assignment

    - #### contains

          public boolean contains(Variable<?,T> variable)

      Returns true if it contains the given assignment (assigned variable)

    - #### contains

          public boolean contains(Collection<Assignment<T>> assignments)

      Returns true if it contains all of the given assignments

    - #### containsValues

          public boolean containsValues(Collection<T> assignments)

      Returns true if it contains all of the given assignments

    - #### containsVariables

          public boolean containsVariables(Collection<Variable<?,T>> assignments)

      Returns true if it contains all of the given assignments

    - #### addAssignment

          public void addAssignment(Assignment<T> assignment)

      Adds an assignment

    - #### addAssignment

          public void addAssignment(long iteration,
                                    T value,
                                    double ageing)

      Adds an assignment

    - #### getAssignment

          public Assignment<T> getAssignment(T value)

      Returns assignment that corresponds to the given value (if it is present in the set)

    - #### size

          public int size()

      Returns number of assignments in the set

    - #### equals

          public boolean equals(Object o)

      Compares two assignment sets -- name, size and content (assignments) has to match.
      Overrides:
        `equals` in class `Object`

    - #### xor

          public static int xor(int a,
                                int b)

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`