org.cpsolver.ifs.assignment.context

## Class AssignmentContextReference<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.AssignmentContextReference<V,T,C>

- Type Parameters:
    `V` - Variable
    `T` - Value
    `C` - Assignment Context

      public class AssignmentContextReference<V extends Variable<V,T>,T extends Value<V,T>,C extends AssignmentContext>
      extends Object

  A reference to an assignment context. A reference is created by a class requiring an assignment context `HasAssignmentContext` by calling `Model.createReference(HasAssignmentContext)`. This reference can be stored with the class implementing the `HasAssignmentContext` interface in place of the assignment context `AssignmentContext`. Assignment context can be than retrieved from an assignment by calling `Assignment.getAssignmentContext(AssignmentContextReference)`. This method also create a new context if there is none associated with the assignment yet for the given reference.
  Method `getIndex()` can be used to index stored contexts. A new assignment context can be created for a reference by calling `HasAssignmentContext.createAssignmentContext(Assignment)` on the `getParent()`.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 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.
  Author:
    Tomáš Müller
  See Also:
    `AssignmentContext`, `AssignmentContextReference`, `HasAssignmentContext`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AssignmentContextReference(HasAssignmentContext<V,T,C> parent, int index)` Create a reference context

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `int` | `getIndex()` Return index, a unique number associated with the reference by the `Model`.
    `HasAssignmentContext<V,T,C>` | `getParent()` Return parent class, i.e., the class implementing the `HasAssignmentContext` interface.
    `int` | `hashCode()`

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

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

- - ### Constructor Detail

    - #### AssignmentContextReference

          public AssignmentContextReference(HasAssignmentContext<V,T,C> parent,
                                            int index)

      Create a reference context
      Parameters:
        `parent` - a class implementing the `HasAssignmentContext` interface
        `index` - a unique index associated with the reference by the `Model`

  - ### Method Detail

    - #### getIndex

          public int getIndex()

      Return index, a unique number associated with the reference by the `Model`.
      Returns:
        an index

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### getParent

          public HasAssignmentContext<V,T,C> getParent()

      Return parent class, i.e., the class implementing the `HasAssignmentContext` interface.
      Returns:
        parent