public abstract class Reservation extends AbstractClassWithContext<Request,Enrollment,Reservation.ReservationContext> implements AssignmentComparable<Reservation,Request,Enrollment>
Modifier and Type | Class and Description |
---|---|
class |
Reservation.ReservationContext |
Constructor and Description |
---|
Reservation(long id,
Offering offering)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addConfig(Config config)
Add a configuration (of the offering
getOffering() ) to this reservation |
void |
addSection(Section section)
Add a section (of the offering
getOffering() ) to this reservation. |
abstract boolean |
canAssignOverLimit()
True if can go over the course / config / section limit.
|
boolean |
canEnroll(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
True if the enrollment can be done using this reservation
|
int |
compareTo(Assignment<Request,Enrollment> assignment,
Reservation r)
Priority first, than restrictivity (more restrictive first), than availability (more available first), than id
|
int |
compareTo(Reservation r)
Priority first, than restrictivity (more restrictive first), than id
|
Reservation.ReservationContext |
createAssignmentContext(Assignment<Request,Enrollment> assignment)
Create a new assignment context for the given assignment.
|
Set<Config> |
getConfigs()
One or more configurations on which the reservation is set (optional).
|
Set<Enrollment> |
getEnrollments(Assignment<Request,Enrollment> assignment)
Enrollments assigned using this reservation
|
long |
getId()
Reservation id
|
double |
getLimit()
Reservation limit capped the limit cap (see
getLimitCap() ) |
double |
getLimitCap()
Compute limit cap (maximum number of students that can get into the offering using this reservation)
|
Model<Request,Enrollment> |
getModel()
Get the model.
|
Offering |
getOffering()
Instructional offering on which the reservation is set.
|
abstract int |
getPriority()
Reservation priority (e.g., individual reservations first)
|
abstract double |
getReservationLimit()
Reservation limit
|
double |
getReservedAvailableSpace(Assignment<Request,Enrollment> assignment,
Request excludeRequest)
Available reserved space
|
double |
getRestrictivity()
Reservation restrictivity (estimated percentage of enrollments that include this reservation, 1.0 reservation on the whole offering)
|
Map<Subpart,Set<Section>> |
getSections()
One or more sections on which the reservation is set (optional).
|
Set<Section> |
getSections(Subpart subpart)
One or more sections on which the reservation is set (optional).
|
boolean |
isAllowOverlap()
True if holding this reservation allows a student to have attend overlapping class.
|
abstract boolean |
isApplicable(Student student)
Returns true if the student is applicable for the reservation
|
boolean |
isExpired()
True if the reservation is expired.
|
boolean |
isIncluded(Enrollment enrollment)
Return true if the given enrollment meets the reservation.
|
abstract boolean |
mustBeUsed()
If true, student must use the reservation (if applicable)
|
void |
setExpired(boolean expired)
Set reservation expiration.
|
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, setContext
public Reservation(long id, Offering offering)
id
- reservation unique idoffering
- instructional offering on which the reservation is setpublic long getId()
public abstract double getReservationLimit()
public abstract int getPriority()
public abstract boolean isApplicable(Student student)
student
- a studentpublic Offering getOffering()
public Set<Config> getConfigs()
public void addConfig(Config config)
getOffering()
) to this reservationconfig
- instructional offering configurationpublic Map<Subpart,Set<Section>> getSections()
public Set<Section> getSections(Subpart subpart)
subpart
- scheduling subpartpublic void addSection(Section section)
getOffering()
) to this reservation.
This will also add all parent sections and the appropriate configuration to the offering.section
- a class restrictionpublic boolean isIncluded(Enrollment enrollment)
enrollment
- given enrollmentpublic boolean canEnroll(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
assignment
- current assignmentenrollment
- given enrollmentpublic abstract boolean canAssignOverLimit()
public abstract boolean mustBeUsed()
public double getRestrictivity()
public int compareTo(Assignment<Request,Enrollment> assignment, Reservation r)
compareTo
in interface AssignmentComparable<Reservation,Request,Enrollment>
assignment
- current assignmentr
- other instancepublic int compareTo(Reservation r)
compareTo
in interface Comparable<Reservation>
compareTo
in interface AssignmentComparable<Reservation,Request,Enrollment>
public double getLimitCap()
public double getLimit()
getLimitCap()
)public boolean isAllowOverlap()
public void setExpired(boolean expired)
expired
- is this reservation expiredpublic boolean isExpired()
public Model<Request,Enrollment> getModel()
AbstractClassWithContext
getModel
in class AbstractClassWithContext<Request,Enrollment,Reservation.ReservationContext>
public double getReservedAvailableSpace(Assignment<Request,Enrollment> assignment, Request excludeRequest)
assignment
- current assignmentexcludeRequest
- excluding given request (if not null)public Set<Enrollment> getEnrollments(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic Reservation.ReservationContext createAssignmentContext(Assignment<Request,Enrollment> assignment)
HasAssignmentContext
createAssignmentContext
in interface HasAssignmentContext<Request,Enrollment,Reservation.ReservationContext>
assignment
- an assignment for which there needs to be an assignment contextCopyright © 2014 UniTime LLC. All Rights Reserved.