net.sf.cpsolver.studentsct.constraint
Class StudentConflict

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Constraint<Request,Enrollment>
      extended by net.sf.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.2 (Student Sectioning)
Copyright (C) 2007 - 2010 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 net.sf.cpsolver.ifs.model.Constraint
iAssignedVariables, iConstraintListeners, iId
 
Constructor Summary
StudentConflict(Student student)
          Constructor
 
Method Summary
 void computeConflicts(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(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 net.sf.cpsolver.ifs.model.Constraint
addConstraintListener, addVariable, assigned, assignedVariables, compareTo, 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

computeConflicts

public void computeConflicts(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

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>

inConflict

public boolean inConflict(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
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