org.cpsolver.studentsct.constraint

## Class StudentConflict

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

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

      public class StudentConflict
      extends Constraint<Request,Enrollment>

  This constraints ensures that a student is not enrolled into sections that are overlapping in time.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 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/.

- - ### Field Summary

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

      `iConstraintListeners, iId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StudentConflict(Student student)` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `canAssign(Assignment<Request,Enrollment> assignment, Enrollment enrollment, Set<Enrollment> conflicts)` True if the given enrollment can be assigned to the student.
    `void` | `computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment, Set<Enrollment> conflicts)` A given enrollment is conflicting when the student is enrolled into another course / free time request that has an assignment that is overlapping with one or more assignments of the given section.
    `boolean` | `inConflict(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` A given enrollment is conflicting when the student is enrolled into another course / free time request that has an assignment that is overlapping with one or more assignments of the given section.
    `boolean` | `isConsistent(Enrollment e1, Enrollment e2)` Two enrollments are consistent if they are not overlapping in time
    `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

    - #### StudentConflict

          public StudentConflict(Student student)

      Constructor
      Parameters:
        `student` - student for which the constraint is created

  - ### Method Detail

    - #### canAssign

          public static boolean canAssign(Assignment<Request,Enrollment> assignment,
                                          Enrollment enrollment,
                                          Set<Enrollment> conflicts)

      True if the given enrollment can be assigned to the student. A new enrollment cannot be assigned to a student when the student already has the desired number of requests assigned (i.e., number of non-alternative course requests).
      Parameters:
        `assignment` - current assignment
        `enrollment` - given enrollment
      Returns:
        true if the given request can be assigned

    - #### computeConflicts

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

      A given enrollment is conflicting when the student is enrolled into another course / free time request that has an assignment that is overlapping with one or more assignments of the given section. See `Enrollment.isOverlapping(Enrollment)` for more details. All such overlapping enrollments are added into the provided set of conflicts.
      Specified by:
        `computeConflicts` in class `Constraint<Request,Enrollment>`
      Parameters:
        `enrollment` - `Enrollment` that is being considered
        `conflicts` - resultant list of conflicting enrollments
        `assignment` - current assignment

    - #### isConsistent

          public boolean isConsistent(Enrollment e1,
                                      Enrollment e2)

      Two enrollments are consistent if they are not overlapping in time
      Overrides:
        `isConsistent` in class `Constraint<Request,Enrollment>`
      Parameters:
        `e1` - a value
        `e2` - a value
      Returns:
        true if the constraint is ok with the assignment

    - #### inConflict

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

      A given enrollment is conflicting when the student is enrolled into another course / free time request that has an assignment that is overlapping with one or more assignments of the given section. See `Enrollment.isOverlapping(Enrollment)` for more details.
      Overrides:
        `inConflict` in class `Constraint<Request,Enrollment>`
      Parameters:
        `enrollment` - `Enrollment` that is being considered
        `assignment` - current assignment
      Returns:
        true, if the student is enrolled into another enrollment of a different request that is overlapping in time with the given enrollment

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`