org.cpsolver.ifs.extension

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

- java.lang.Object
- - org.cpsolver.ifs.extension.AssignedValueSet<T>

- Type Parameters:
    `T` - Value

      public class AssignedValueSet<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.3 (Iterative Forward Search)
    Copyright (C) 2006 - 2014 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
    `AssignedValueSet()`
    `AssignedValueSet(AssignedValue<T>[] assignments)`
    `AssignedValueSet(Collection<AssignedValue<T>> assignments)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAssignment(AssignedValue<T> assignment)` Adds an assignment
    `void` | `addAssignment(long iteration, T value, double aging)` Adds an assignment
    `boolean` | `contains(AssignedValue<T> assignment)` Returns true if it contains the given assignment
    `boolean` | `contains(AssignedValueSet<T> assignmentSet)` Returns true if it contains all of the given assignments
    `boolean` | `contains(Collection<AssignedValue<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` | `containsValues(Collection<T> assignments)` Returns true if it contains all of the given assignments
    `static <T extends Value<?,T>> AssignedValueSet<T>` | `createAssignmentSet(Collection<AssignedValue<T>> assignments)` Create set of assignments from the list of Assignments, Values or (assigned) Variables
    `static <T extends Value<?,T>> AssignedValueSet<T>` | `createAssignmentSetForValues(Collection<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.
    `AssignedValue<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<AssignedValue<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

    - #### AssignedValueSet

          public AssignedValueSet()

    - #### AssignedValueSet

          public AssignedValueSet(AssignedValue<T>[] assignments)

    - #### AssignedValueSet

          public AssignedValueSet(Collection<AssignedValue<T>> assignments)

  - ### Method Detail

    - #### createAssignmentSet

          public static <T extends Value<?,T>> AssignedValueSet<T> createAssignmentSet(Collection<AssignedValue<T>> assignments)

      Create set of assignments from the list of Assignments, Values or (assigned) Variables
      Type Parameters:
        `T` - Value
      Parameters:
        `assignments` - list of assignments
      Returns:
        a set of assignments

    - #### createAssignmentSetForValues

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

      Create set of assignments from the list of Assignments, Values or (assigned) Variables
      Type Parameters:
        `T` - Value
      Parameters:
        `assignments` - list of assignments
      Returns:
        a set of assignments

    - #### incCounter

          public void incCounter()

      Increment counter

    - #### getCounter

          public int getCounter()

      Returns counter
      Returns:
        counter

    - #### getSet

          public List<AssignedValue<T>> getSet()

      Returns set of assignments
      Returns:
        assignments in the set

    - #### getName

          public String getName()

      Returns name
      Returns:
        a name

    - #### setName

          public void setName(String name)

      Sets name
      Parameters:
        `name` - a name

    - #### getDescription

          public String getDescription()

      Returns description
      Returns:
        a description

    - #### setDescription

          public void setDescription(String description)

      Sets description
      Parameters:
        `description` - a description

    - #### getConstraint

          public Constraint<?,T> getConstraint()

      Returns constraint
      Returns:
        a constraint

    - #### setConstraint

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

      Sets constraint
      Parameters:
        `constraint` - a constraint

    - #### contains

          public boolean contains(AssignedValue<T> assignment)

      Returns true if it contains the given assignment
      Parameters:
        `assignment` - an assignment
      Returns:
        true if in the set

    - #### contains

          public boolean contains(AssignedValueSet<T> assignmentSet)

      Returns true if it contains all of the given assignments
      Parameters:
        `assignmentSet` - a set of assignments
      Returns:
        true if all in the set

    - #### contains

          public boolean contains(T value)

      Returns true if it contains the given assignment
      Parameters:
        `value` - an assignment (of the value to its variable)
      Returns:
        true if in the set

    - #### contains

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

      Returns true if it contains all of the given assignments
      Parameters:
        `assignments` - a set of assignments
      Returns:
        true if all in the set

    - #### containsValues

          public boolean containsValues(Collection<T> assignments)

      Returns true if it contains all of the given assignments
      Parameters:
        `assignments` - a set of assignments (values to their variables)
      Returns:
        true if all in the set

    - #### addAssignment

          public void addAssignment(AssignedValue<T> assignment)

      Adds an assignment
      Parameters:
        `assignment` - an assignment

    - #### addAssignment

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

      Adds an assignment
      Parameters:
        `iteration` - current iteration
        `value` - an assignment
        `aging` - aging factor

    - #### getAssignment

          public AssignedValue<T> getAssignment(T value)

      Returns assignment that corresponds to the given value (if it is present in the set)
      Parameters:
        `value` - an assignment
      Returns:
        a corresponding assignment of the set, null if not present

    - #### size

          public int size()

      Returns number of assignments in the set
      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`