public abstract class Reservation extends AbstractClassWithContext<Request,Enrollment,Reservation.ReservationContext> implements AssignmentComparable<Reservation,Request,Enrollment>, CanInheritContext<Request,Enrollment,Reservation.ReservationContext>
Modifier and Type | Class and Description |
---|---|
class |
Reservation.ReservationContext |
sMaxSize
Constructor and Description |
---|
Reservation(long id,
Offering offering,
int priority,
boolean mustBeUsed,
boolean canAssignOverLimit,
boolean allowOverlap)
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) |
void |
addSection(Section section,
boolean inclusive)
Add a section (of the offering
getOffering() ) to this reservation. |
boolean |
areRestrictionsInclusive()
Check if restrictions are inclusive (that is for each section, the reservation also contains all its parents and the configuration)
|
boolean |
canAssignOverLimit()
True if can go over the course / config / section limit.
|
boolean |
canBatchAssignOverLimit()
True if the batch solver can assign the reservation over the course / config / section limit.
|
boolean |
canBreakLinkedSections()
Can break linked-section constraints when set to true
|
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 |
getLimit(Config config)
Reservation limit capped the limit cap (see
getLimitCap(Config) ) for a particular configuration |
double |
getLimitCap()
Compute limit cap (maximum number of students that can get into the offering using this reservation)
|
double |
getLimitCap(Config config)
Compute limit cap (maximum number of students that can get into the offering using this reservation) for a particular configuration
|
Model<Request,Enrollment> |
getModel()
Get the model.
|
Offering |
getOffering()
Instructional offering on which the reservation is set.
|
int |
getPriority()
Reservation priority (e.g., individual reservations first)
|
abstract double |
getReservationLimit()
Reservation limit
|
double |
getReservedAvailableSpace(Assignment<Request,Enrollment> assignment,
Config config,
Request excludeRequest)
Available reserved space for a particular config
|
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).
|
Reservation.ReservationContext |
inheritAssignmentContext(Assignment<Request,Enrollment> assignment,
Reservation.ReservationContext parentContext)
Create a new assignment context for the given assignment.
|
boolean |
isAllowDisabled()
True if holding this reservation allows a student to attend a disabled class.
|
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.
|
boolean |
mustBeUsed()
If true, student must use the reservation (if applicable).
|
boolean |
mustBeUsedIgnoreExpiration()
If true, student must use the reservation (if applicable).
|
boolean |
neverIncluded()
No enrollment is matching this reservation when set to true
|
void |
setAllowDisabled(boolean allowDisabled)
Set to true if holding this reservation allows a student to attend a disabled class
|
void |
setAllowOverlap(boolean allowOverlap)
Set to true if holding this reservation allows a student to have attend overlapping class.
|
void |
setBreakLinkedSections(boolean breakLinkedSections)
Can break linked-section constraints when set to true
|
void |
setCanAssignOverLimit(boolean canAssignOverLimit)
Set to true if a student meeting this reservation can go over the course / config / section limit.
|
void |
setExpired(boolean expired)
Set reservation expiration.
|
void |
setMustBeUsed(boolean mustBeUsed)
Set to true if the student must use the reservation (if applicable)
|
void |
setNeverIncluded(boolean neverIncluded)
No enrollment is matching this reservation when set to true
|
void |
setPriority(int priority)
Set reservation priority (e.g., individual reservations first)
|
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference
public Reservation(long id, Offering offering, int priority, boolean mustBeUsed, boolean canAssignOverLimit, boolean allowOverlap)
id
- reservation unique idoffering
- instructional offering on which the reservation is setpriority
- reservation prioritymustBeUsed
- must this reservation be usedcanAssignOverLimit
- can assign over class / configuration / course limitallowOverlap
- does this reservation allow for overlapspublic long getId()
public abstract double getReservationLimit()
public int getPriority()
public void setPriority(int priority)
priority
- reservation prioritypublic 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, boolean inclusive)
getOffering()
) to this reservation.
This will also add all parent sections and the appropriate configuration to the offering.section
- a class restrictionpublic void addSection(Section section)
public boolean isIncluded(Enrollment enrollment)
enrollment
- given enrollmentpublic boolean canEnroll(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
assignment
- current assignmentenrollment
- given enrollmentpublic boolean canAssignOverLimit()
public boolean canBatchAssignOverLimit()
public void setCanAssignOverLimit(boolean canAssignOverLimit)
canAssignOverLimit
- can assign over class / configuration / course limitpublic boolean mustBeUsed()
public boolean mustBeUsedIgnoreExpiration()
public void setMustBeUsed(boolean mustBeUsed)
mustBeUsed
- must this reservation be usedpublic 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 boolean areRestrictionsInclusive()
public double getLimitCap(Config config)
public double getLimit()
getLimitCap()
)public double getLimit(Config config)
getLimitCap(Config)
) for a particular configurationconfig
- configuration for which the limit is computed (restrictions on other configurations are ignored)public boolean isAllowOverlap()
public void setAllowOverlap(boolean allowOverlap)
allowOverlap
- does this reservation allow for overlapspublic boolean isAllowDisabled()
public void setAllowDisabled(boolean allowDisabled)
allowDisabled
- does this reservation allow for disabled sectionspublic void setExpired(boolean expired)
expired
- is this reservation expiredpublic boolean isExpired()
public boolean neverIncluded()
public void setNeverIncluded(boolean neverIncluded)
public boolean canBreakLinkedSections()
public void setBreakLinkedSections(boolean breakLinkedSections)
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 double getReservedAvailableSpace(Assignment<Request,Enrollment> assignment, Config config, 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 contextpublic Reservation.ReservationContext inheritAssignmentContext(Assignment<Request,Enrollment> assignment, Reservation.ReservationContext parentContext)
CanInheritContext
inheritAssignmentContext
in interface CanInheritContext<Request,Enrollment,Reservation.ReservationContext>
assignment
- an assignment for which there needs to be an assignment contextparentContext
- context of the parent assignment