org.cpsolver.studentsct.extension

## Class TimeOverlapsCounter.TimeOverlapsCounterContext

- java.lang.Object
- - org.cpsolver.studentsct.extension.TimeOverlapsCounter.TimeOverlapsCounterContext

- All Implemented Interfaces:
    AssignmentConstraintContext<Request,Enrollment>, AssignmentContext
  Enclosing class:
    TimeOverlapsCounter

      public class TimeOverlapsCounter.TimeOverlapsCounterContext
      extends Object
      implements AssignmentConstraintContext<Request,Enrollment>

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeOverlapsCounterContext(Assignment<Request,Enrollment> assignment)`
    `TimeOverlapsCounterContext(TimeOverlapsCounter.TimeOverlapsCounterContext parent)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)` Called after a value is assigned to a variable.
    `void` | `afterUnassigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)` Called after a value is unassigned from a variable.
    `Set<TimeOverlapsCounter.Conflict>` | `allConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` The set of all conflicts (`TimeOverlapsCounter.Conflict` objects) of the given enrollment and other enrollments that are assigned to the same student.
    `void` | `assigned(Assignment<Request,Enrollment> assignment, Enrollment value)` Called when a value is assigned to a variable.
    `void` | `beforeAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)` Called before a value is assigned to a variable.
    `void` | `checkTotalNrConflicts(Assignment<Request,Enrollment> assignment)`
    `Set<TimeOverlapsCounter.Conflict>` | `computeAllConflicts(Assignment<Request,Enrollment> assignment)` Compute a set of all time overlapping conflicts (`TimeOverlapsCounter.Conflict` objects).
    `int` | `countTotalNrConflicts(Assignment<Request,Enrollment> assignment)` Compute the actual number of all time overlapping conflicts.
    `Set<TimeOverlapsCounter.Conflict>` | `getAllConflicts()` Return a set of all time overlapping conflicts (`TimeOverlapsCounter.Conflict` objects).
    `int` | `getTotalNrConflicts()` Actual number of all time overlapping conflicts
    `int` | `nrAllConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` Total sum of all conflict of the given enrollment and other enrollments that are assigned to the same student.
    `void` | `unassigned(Assignment<Request,Enrollment> assignment, Enrollment value)` Called when a value is unassigned from a variable.

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

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

- - ### Constructor Detail

    - #### TimeOverlapsCounterContext

          public TimeOverlapsCounterContext(Assignment<Request,Enrollment> assignment)

    - #### TimeOverlapsCounterContext

          public TimeOverlapsCounterContext(TimeOverlapsCounter.TimeOverlapsCounterContext parent)

  - ### Method Detail

    - #### assigned

          public void assigned(Assignment<Request,Enrollment> assignment,
                               Enrollment value)

      Called when a value is assigned to a variable. Internal number of time overlapping conflicts is updated, see `TimeOverlapsCounter.getTotalNrConflicts(Assignment)`.
      Specified by:
        `assigned` in interface `AssignmentConstraintContext<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment (with which this context is associated)
        `value` - assigned value

    - #### unassigned

          public void unassigned(Assignment<Request,Enrollment> assignment,
                                 Enrollment value)

      Called when a value is unassigned from a variable. Internal number of time overlapping conflicts is updated, see `TimeOverlapsCounter.getTotalNrConflicts(Assignment)`.
      Specified by:
        `unassigned` in interface `AssignmentConstraintContext<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment (with which this context is associated)
        `value` - unassigned value

    - #### beforeAssigned

          public void beforeAssigned(Assignment<Request,Enrollment> assignment,
                                     long iteration,
                                     Enrollment value)

      Called before a value is assigned to a variable.
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration
        `value` - value to be assigned

    - #### afterAssigned

          public void afterAssigned(Assignment<Request,Enrollment> assignment,
                                    long iteration,
                                    Enrollment value)

      Called after a value is assigned to a variable.
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration
        `value` - value that was assigned

    - #### afterUnassigned

          public void afterUnassigned(Assignment<Request,Enrollment> assignment,
                                      long iteration,
                                      Enrollment value)

      Called after a value is unassigned from a variable.
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration
        `value` - value that was unassigned

    - #### getAllConflicts

          public Set<TimeOverlapsCounter.Conflict> getAllConflicts()

      Return a set of all time overlapping conflicts (`TimeOverlapsCounter.Conflict` objects).
      Returns:
        all conflicts

    - #### getTotalNrConflicts

          public int getTotalNrConflicts()

      Actual number of all time overlapping conflicts
      Returns:
        total number of all conflicts

    - #### checkTotalNrConflicts

          public void checkTotalNrConflicts(Assignment<Request,Enrollment> assignment)

    - #### countTotalNrConflicts

          public int countTotalNrConflicts(Assignment<Request,Enrollment> assignment)

      Compute the actual number of all time overlapping conflicts. Should be equal to `TimeOverlapsCounter.getTotalNrConflicts(Assignment)`.
      Parameters:
        `assignment` - current assignment
      Returns:
        counted number of all time conflicts in the assignment

    - #### computeAllConflicts

          public Set<TimeOverlapsCounter.Conflict> computeAllConflicts(Assignment<Request,Enrollment> assignment)

      Compute a set of all time overlapping conflicts (`TimeOverlapsCounter.Conflict` objects).
      Parameters:
        `assignment` - current assignment
      Returns:
        set of all time conflicts in the assignment

    - #### allConflicts

          public Set<TimeOverlapsCounter.Conflict> allConflicts(Assignment<Request,Enrollment> assignment,
                                                                Enrollment enrollment)

      The set of all conflicts (`TimeOverlapsCounter.Conflict` objects) of the given enrollment and other enrollments that are assigned to the same student.
      Parameters:
        `assignment` - current assignment
        `enrollment` - given enrollment
      Returns:
        set of all conflict of the given enrollment

    - #### nrAllConflicts

          public int nrAllConflicts(Assignment<Request,Enrollment> assignment,
                                    Enrollment enrollment)

      Total sum of all conflict of the given enrollment and other enrollments that are assigned to the same student.
      Parameters:
        `assignment` - current assignment
        `enrollment` - given enrollment
      Returns:
        number of all conflict of the given enrollment