net.sf.cpsolver.studentsct.model
Class FreeTimeRequest

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Variable<Request,Enrollment>
      extended by net.sf.cpsolver.studentsct.model.Request
          extended by net.sf.cpsolver.studentsct.model.FreeTimeRequest
All Implemented Interfaces:
Comparable<Request>, 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.2 (Student Sectioning)
Copyright (C) 2007 - 2010 Tomas Muller
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.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 assignment was assigned to a Request.
 int compareById(Assignment a)
          Sections first, then by Request.getId()
 List<Enrollment> computeEnrollments()
          Create all possible enrollments of this request -- there is only one possible enrollment: createEnrollment()
 Enrollment createEnrollment()
          Create enrollment of this request
 boolean equals(Object o)
           
 double getBound()
          Estimated bound for this request
 Set<Enrollment> 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
 List<RoomLocation> getRooms()
          Assignment API: free time request has no rooms
 TimeLocation getTime()
          Return requested time to be free
 int hashCode()
           
 boolean isAllowOverlap()
          Free time request generally allow overlaps.
 boolean isOverlapping(Assignment assignment)
          True, if this assignment is overlapping in time and space with the given assignment.
 boolean isOverlapping(Set<? extends Assignment> 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 assignment was unassigned from a Request.
 
Methods inherited from class net.sf.cpsolver.studentsct.model.Request
assign, compareTo, getId, getPriority, getStudent, getWeight, isAlternative, isAssigned, setPriority, setWeight, unassign, values
 
Methods inherited from class net.sf.cpsolver.ifs.model.Variable
addContstraint, addVariableListener, constraints, constraintVariables, countAssignments, getAssignment, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getInitialAssignment, getModel, getVariableListeners, hardConstraints, hasAssignment, 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
 
Methods inherited from interface net.sf.cpsolver.studentsct.model.Assignment
getId
 

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 List<RoomLocation> 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<? extends Assignment> 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 List<Enrollment> 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 assignment was assigned to a Request.

Specified by:
assigned in interface Assignment

unassigned

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

Specified by:
unassigned in interface Assignment

getEnrollments

public Set<Enrollment> 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<Request,Enrollment>

toString

public String toString()
Overrides:
toString in class Variable<Request,Enrollment>

getBound

public double getBound()
Estimated bound for this request

Specified by:
getBound in class Request

isAllowOverlap

public boolean isAllowOverlap()
Free time request generally allow overlaps.

Specified by:
isAllowOverlap in interface Assignment

compareById

public int compareById(Assignment a)
Sections first, then by Request.getId()

Specified by:
compareById in interface Assignment

hashCode

public int hashCode()
Overrides:
hashCode in class Request

equals

public boolean equals(Object o)
Overrides:
equals in class Request


Copyright © 2014 UniTime LLC. All Rights Reserved.