org.cpsolver.ifs.criteria

## Class AbstractCriterion.ValueContext

- java.lang.Object
- - org.cpsolver.ifs.criteria.AbstractCriterion.ValueContext

- All Implemented Interfaces:
    AssignmentContext
  Direct Known Subclasses:
    AssignmentCount.AssignmentCountContext, ExamRotationPenalty.RotationContext, InstructorFairness.InstructorFairnessContext, InstructorLunchBreak.InstructorLunchBreakContext, RoomSplitDistancePenalty.RoomSplitContext, RoomSplitPenalty.RoomSplitContext, WeightedHardConflicts.IterationContext
  Enclosing class:
    AbstractCriterion<V extends Variable<V,T>,T extends Value<V,T>>

      public class AbstractCriterion.ValueContext
      extends Object
      implements AssignmentContext

  Assignment context holding current value and the cached bounds.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected double` | `iTotal`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ValueContext()`
    `protected` | `ValueContext(Assignment<V,T> assignment)` Create from an assignment

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `assigned(Assignment<V,T> assignment, T value)` Update value when assigned
    `protected double[]` | `getBounds(Assignment<V,T> assignment)` Return bounds
    `double` | `getTotal()` Return value
    `void` | `inc(double value)` Increment value
    `protected void` | `setBounds(double[] bounds)` Set bounds
    `void` | `setTotal(double value)` Set value
    `protected void` | `unassigned(Assignment<V,T> assignment, T value)` Update value when unassigned

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

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

- - ### Field Detail

    - #### iTotal

          protected double iTotal

  - ### Constructor Detail

    - #### ValueContext

          protected ValueContext(Assignment<V,T> assignment)

      Create from an assignment
      Parameters:
        `assignment` - current assignment

    - #### ValueContext

          protected ValueContext()

  - ### Method Detail

    - #### unassigned

          protected void unassigned(Assignment<V,T> assignment,
                                    T value)

      Update value when unassigned
      Parameters:
        `assignment` - current assignment
        `value` - recently unassigned value

    - #### assigned

          protected void assigned(Assignment<V,T> assignment,
                                  T value)

      Update value when assigned
      Parameters:
        `assignment` - current assignment
        `value` - recently assigned value

    - #### getTotal

          public double getTotal()

      Return value
      Returns:
        current value of the criterion

    - #### setTotal

          public void setTotal(double value)

      Set value
      Parameters:
        `value` - current value of the criterion

    - #### inc

          public void inc(double value)

      Increment value
      Parameters:
        `value` - increment

    - #### getBounds

          protected double[] getBounds(Assignment<V,T> assignment)

      Return bounds
      Parameters:
        `assignment` - current assignment
      Returns:
        minimum and maximum of this criterion's value

    - #### setBounds

          protected void setBounds(double[] bounds)

      Set bounds
      Parameters:
        `bounds` - bounds to cache