net.sf.cpsolver.studentsct.constraint
Class Reservation

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Constraint
      extended by net.sf.cpsolver.studentsct.constraint.Reservation
Direct Known Subclasses:
ReservationOnCourse, ReservationOnSection

public abstract class Reservation
extends Constraint

Abstract reservation constraint. This constraint allow some section, courses, and other parts to be reserved to particular group of students. A reservation can be unlimited (any number of students of that particular group can attend a course, section, etc.) or with a limit (only given number of seats is reserved to the students of the particular group).

Version:
StudentSct 1.1 (Student Sectioning)
Copyright (C) 2007 Tomáš Müller
muller@unitime.org
Lazenska 391, 76314 Zlin, Czech Republic

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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Field Summary
static int CAN_ENROLL_INSTEAD
          Student can be enrolled, however, some other student has to dropped out of the section, course, etc.
static int CAN_ENROLL_NO
          Student cannot be enrolled
static int CAN_ENROLL_YES
          Student can be enrolled
 
Fields inherited from class net.sf.cpsolver.ifs.model.Constraint
iAssignedVariables, iConstraintListeners, iId
 
Constructor Summary
Reservation()
           
 
Method Summary
abstract  int canEnroll(Student student)
          Check, whether a student can be enrolled into the given section, course, etc.
abstract  boolean canEnrollInstead(Student student, Student insteadOfStudent)
          Check whether the given student can be enrolled instead of another student
 void computeConflicts(Value value, Set conflicts)
          Implementation of the constraint primitives.
 boolean inConflict(Value value)
          Implementation of the constraint primitives.
abstract  boolean isApplicable(Enrollment enrollment)
          Check whether the reservation is applicable to the given enrollment.
 
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint
addConstraintListener, addVariable, assigned, assignedVariables, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, getName, hashCode, isConsistent, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variables
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAN_ENROLL_NO

public static int CAN_ENROLL_NO
Student cannot be enrolled


CAN_ENROLL_YES

public static int CAN_ENROLL_YES
Student can be enrolled


CAN_ENROLL_INSTEAD

public static int CAN_ENROLL_INSTEAD
Student can be enrolled, however, some other student has to dropped out of the section, course, etc.

Constructor Detail

Reservation

public Reservation()
Method Detail

canEnroll

public abstract int canEnroll(Student student)
Check, whether a student can be enrolled into the given section, course, etc.

Parameters:
student - given student
Returns:
CAN_ENROLL_YES, CAN_ENROLL_NO, or CAN_ENROLL_INSTEAD

canEnrollInstead

public abstract boolean canEnrollInstead(Student student,
                                         Student insteadOfStudent)
Check whether the given student can be enrolled instead of another student

Parameters:
student - student that is to be enrolled in the particular course, section, etc.
insteadOfStudent - student, that is currently enrolled, which is going to be bumped out of the course, section, etc. in order to enroll given studen
Returns:
true, if the move is permitted

isApplicable

public abstract boolean isApplicable(Enrollment enrollment)
Check whether the reservation is applicable to the given enrollment. This means that the given enrollment contains the particular section, course, etc.

Parameters:
enrollment - enrollment of a student that is being considered
Returns:
true, if the reservation applies to the enrollment

computeConflicts

public void computeConflicts(Value value,
                             Set conflicts)
Implementation of the constraint primitives. See Constraint.computeConflicts(Value, Set) for more details.

Specified by:
computeConflicts in class Constraint
Parameters:
value - value to be assigned to its varaible
conflicts - resultant set of conflicting values

inConflict

public boolean inConflict(Value value)
Implementation of the constraint primitives. See Constraint.inConflict(Value) for more details.

Overrides:
inConflict in class Constraint