org.cpsolver.ifs.assignment.context

## Class InheritedAssignmentContextHolder<V extends Variable<V,T>,T extends Value<V,T>>

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.AssignmentContextHolderMap<V,T>
  - - org.cpsolver.ifs.assignment.context.DefaultParallelAssignmentContextHolder<V,T>
    - - org.cpsolver.ifs.assignment.context.InheritedAssignmentContextHolder<V,T>

- Type Parameters:
    `V` - Variable
    `T` - Value
  All Implemented Interfaces:
    AssignmentContextHolder<V,T>

      public class InheritedAssignmentContextHolder<V extends Variable<V,T>,T extends Value<V,T>>
      extends DefaultParallelAssignmentContextHolder<V,T>

  A variant of the `AssignmentContextHolderMap` that is used by the `InheritedAssignment` class. If a `HasAssignmentContext` class implements the `CanInheritContext` interface, this class will use the `CanInheritContext.inheritAssignmentContext(Assignment, AssignmentContext)` method instead of the `HasAssignmentContext.createAssignmentContext(Assignment)` method to create a new context.
  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:
    `HasAssignmentContext`, `InheritedAssignment`, `CanInheritContext`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `InheritedAssignmentContextHolder.VersionedContext<U extends AssignmentContext>`

  - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.assignment.context.DefaultParallelAssignmentContextHolder

      `iIndex`

    - ### Fields inherited from class org.cpsolver.ifs.assignment.context.AssignmentContextHolderMap

      `iContexts`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InheritedAssignmentContextHolder(int index, long version)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<U extends AssignmentContext> U` | `getAssignmentContext(Assignment<V,T> assignment, AssignmentContextReference<V,T,U> reference)` If the `AssignmentContextReference.getParent()` implements the `CanInheritContext` interface, this method will use the `CanInheritContext.inheritAssignmentContext(Assignment, AssignmentContext)` instead of the `HasAssignmentContext.createAssignmentContext(Assignment)` to create a new context.

    - ### Methods inherited from class org.cpsolver.ifs.assignment.context.DefaultParallelAssignmentContextHolder

      `clearContext`

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

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

- - ### Constructor Detail

    - #### InheritedAssignmentContextHolder

          public InheritedAssignmentContextHolder(int index,
                                                  long version)

  - ### Method Detail

    - #### getAssignmentContext

          public <U extends AssignmentContext> U getAssignmentContext(Assignment<V,T> assignment,
                                                                      AssignmentContextReference<V,T,U> reference)

      If the `AssignmentContextReference.getParent()` implements the `CanInheritContext` interface, this method will use the `CanInheritContext.inheritAssignmentContext(Assignment, AssignmentContext)` instead of the `HasAssignmentContext.createAssignmentContext(Assignment)` to create a new context.
      Specified by:
        `getAssignmentContext` in interface `AssignmentContextHolder<V extends Variable<V,T>,T extends Value<V,T>>`
      Overrides:
        `getAssignmentContext` in class `DefaultParallelAssignmentContextHolder<V extends Variable<V,T>,T extends Value<V,T>>`
      Type Parameters:
        `U` - assignment context type
      Parameters:
        `assignment` - current assignment (must be `InheritedAssignment`)
        `reference` - assignment context reference
      Returns:
        assignment context for the given assignment and reference