org.cpsolver.studentsct.constraint

## Class LinkedSections.LinkedSectionsConstraint

- java.lang.Object
- - org.cpsolver.ifs.model.Constraint<Request,Enrollment>
  - - org.cpsolver.studentsct.constraint.LinkedSections.LinkedSectionsConstraint

- All Implemented Interfaces:
    Comparable<Constraint<Request,Enrollment>>
  Enclosing class:
    LinkedSections

      public class LinkedSections.LinkedSectionsConstraint
      extends Constraint<Request,Enrollment>

  Linked sections constraint -- to be created for each student that requests two or more offerings of this link

- - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.model.Constraint

      `iConstraintListeners, iId`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `LinkedSectionsConstraint(Student student, Collection<Request> requests)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment value, Set<Enrollment> conflicts)` Compute conflicts using `LinkedSections.computeConflicts(Assignment, Enrollment, ConflictHandler)`
    `LinkedSections` | `getLinkedSections()` Return linked section
    `Student` | `getStudent()` Return student
    `boolean` | `inConflict(Assignment<Request,Enrollment> assignment, Enrollment value)` Check for conflict using `LinkedSections.inConflict(Assignment, Enrollment)`
    `boolean` | `isConsistent(Enrollment enrollment, Enrollment other)` Check consistency using `LinkedSections.inConflict(Enrollment, EnrollmentAssignment)`
    `String` | `toString()`

    - ### Methods inherited from class org.cpsolver.ifs.model.Constraint

      `addConstraintListener, addVariable, assigned, assignedVariables, compareTo, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, getName, hashCode, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variables`

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

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

- - ### Constructor Detail

    - #### LinkedSectionsConstraint

          protected LinkedSectionsConstraint(Student student,
                                             Collection<Request> requests)

      Constructor
      Parameters:
        `student` - a student
        `requests` - sub-set of student requests `Student.getRequests()` that contains offerings of this link

  - ### Method Detail

    - #### getStudent

          public Student getStudent()

      Return student
      Returns:
        student

    - #### getLinkedSections

          public LinkedSections getLinkedSections()

      Return linked section
      Returns:
        linked sections constraint

    - #### computeConflicts

          public void computeConflicts(Assignment<Request,Enrollment> assignment,
                                       Enrollment value,
                                       Set<Enrollment> conflicts)

      Compute conflicts using `LinkedSections.computeConflicts(Assignment, Enrollment, ConflictHandler)`
      Specified by:
        `computeConflicts` in class `Constraint<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment
        `value` - value to be assigned to its variable
        `conflicts` - resultant set of conflicting values

    - #### isConsistent

          public boolean isConsistent(Enrollment enrollment,
                                      Enrollment other)

      Check consistency using `LinkedSections.inConflict(Enrollment, EnrollmentAssignment)`
      Overrides:
        `isConsistent` in class `Constraint<Request,Enrollment>`
      Parameters:
        `enrollment` - a value
        `other` - a value
      Returns:
        true if the constraint is ok with the assignment

    - #### inConflict

          public boolean inConflict(Assignment<Request,Enrollment> assignment,
                                    Enrollment value)

      Check for conflict using `LinkedSections.inConflict(Assignment, Enrollment)`
      Overrides:
        `inConflict` in class `Constraint<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment
        `value` - given value
      Returns:
        true if there is a conflict with other assigned variables of the constraint

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`