net.sf.cpsolver.studentsct.model
Class FreeTimeRequest

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Variable
      extended by net.sf.cpsolver.studentsct.model.Request
          extended by net.sf.cpsolver.studentsct.model.FreeTimeRequest
All Implemented Interfaces:
Comparable, Assignment

public class FreeTimeRequest
extends Request
implements Assignment

Representation of a request of a student for free time. This class directly implements Assignment API, with the appropriate free time.

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
 
Fields inherited from class net.sf.cpsolver.studentsct.model.Request
sCacheValues
 
Fields inherited from class net.sf.cpsolver.ifs.model.Variable
iValue
 
Constructor Summary
FreeTimeRequest(long id, int priority, boolean alternative, Student student, TimeLocation time)
          Constructor
 
Method Summary
 void assigned(Enrollment enrollment)
          Enrollment with this assignmnet was assigned to a Request.
 Vector computeEnrollments()
          Create all possible enrollments of this request -- there is only one possible enrollment: createEnrollment()
 Enrollment createEnrollment()
          Create enrollment of this request
 double getBound()
          Estimated bound for this request
 Set getEnrollments()
          Return the list of assigned enrollments that contains this assignment.
 String getName()
          Request name: A for alternative, 1 + priority, Free Time, long name of requested time
 int getNrRooms()
          Assignment API: free time request has no rooms
 Vector getRooms()
          Assignment API: free time request has no rooms
 TimeLocation getTime()
          Return requested time to be free
 boolean isOverlapping(Assignment assignment)
          True, if this assignment is overlapping in time and space with the given assignment.
 boolean isOverlapping(Set assignments)
          True, if this assignment is overlapping in time and space with the given set of assignments.
 String toString()
           
 void unassigned(Enrollment enrollment)
          Enrollment with this assignmnet was unassigned from a Request.
 
Methods inherited from class net.sf.cpsolver.studentsct.model.Request
assign, compareTo, getId, getPriority, getStudent, getWeight, isAlternative, setPriority, setWeight, unassign, values
 
Methods inherited from class net.sf.cpsolver.ifs.model.Variable
addContstraint, addVariableListener, constraints, constraintVariables, countAssignments, equals, getAssignment, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getInitialAssignment, getModel, getVariableListeners, hardConstraints, hasAssignment, hashCode, hasInitialAssignment, hasValues, lastAssignmentIteration, lastUnassignmentIteration, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setBestAssignment, setExtra, setInitialAssignment, setModel, setValues, softConstraints
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FreeTimeRequest

public FreeTimeRequest(long id,
                       int priority,
                       boolean alternative,
                       Student student,
                       TimeLocation time)
Constructor

Parameters:
id - request unique id
priority - request priority
alternative - true if the request is alternative (alternative request can be assigned instead of a non-alternative course requests, if it is left unassigned)
student - appropriate student
time - appropriate time location that is requested to be free
Method Detail

getTime

public TimeLocation getTime()
Return requested time to be free

Specified by:
getTime in interface Assignment

getNrRooms

public int getNrRooms()
Assignment API: free time request has no rooms

Specified by:
getNrRooms in interface Assignment

getRooms

public Vector getRooms()
Assignment API: free time request has no rooms

Specified by:
getRooms in interface Assignment
Returns:
list of RoomLocation

isOverlapping

public boolean isOverlapping(Assignment assignment)
True, if this assignment is overlapping in time and space with the given assignment.

Specified by:
isOverlapping in interface Assignment

isOverlapping

public boolean isOverlapping(Set assignments)
True, if this assignment is overlapping in time and space with the given set of assignments.

Specified by:
isOverlapping in interface Assignment

createEnrollment

public Enrollment createEnrollment()
Create enrollment of this request


computeEnrollments

public Vector computeEnrollments()
Create all possible enrollments of this request -- there is only one possible enrollment: createEnrollment()

Specified by:
computeEnrollments in class Request

assigned

public void assigned(Enrollment enrollment)
Enrollment with this assignmnet was assigned to a Request.

Specified by:
assigned in interface Assignment

unassigned

public void unassigned(Enrollment enrollment)
Enrollment with this assignmnet was unassigned from a Request.

Specified by:
unassigned in interface Assignment

getEnrollments

public Set getEnrollments()
Return the list of assigned enrollments that contains this assignment.

Specified by:
getEnrollments in interface Assignment

getName

public String getName()
Request name: A for alternative, 1 + priority, Free Time, long name of requested time

Overrides:
getName in class Variable

toString

public String toString()
Overrides:
toString in class Variable

getBound

public double getBound()
Estimated bound for this request

Specified by:
getBound in class Request