public class Section extends Object implements Assignment, Comparable<Section>
Constructor and Description |
---|
Section(long id,
int limit,
String name,
Subpart subpart,
Placement placement,
String instructorIds,
String instructorNames,
Section parent)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addIgnoreConflictWith(long sectionId)
Add section id of a section that student conflicts are to be ignored with
|
void |
assigned(Enrollment enrollment)
Called when an enrollment with this section is assigned to a request
|
void |
clearReservationCache()
Clear reservation information that was cached on this section
|
int |
compareById(Assignment a)
Sections first, then by
Request.getId() |
int |
compareTo(Section s)
Compare two sections, prefer sections with lower penalty and more open
space
|
boolean |
equals(Object o) |
Choice |
getChoice()
A (student) choice representing this section.
|
Set<Enrollment> |
getEnrollments()
Set of assigned enrollments
|
double |
getEnrollmentWeight(Request excludeRequest)
Enrollment weight -- weight of all requests which have an enrollment that
contains this section, excluding the given one.
|
long |
getId()
Section id
|
Set<Long> |
getIgnoreConflictWithSectionIds()
Returns a set of ids of sections that student conflicts are to be ignored with (between this section and the others)
|
int |
getLimit()
Section limit.
|
String |
getLongName()
Long name: subpart name + time long name + room names + instructor names
|
double |
getMaxEnrollmentWeight()
Maximal weight of a single enrollment in the section
|
double |
getMinEnrollmentWeight()
Minimal weight of a single enrollment in the section
|
String |
getName()
Section name
|
String |
getName(long courseId)
Return course-dependent section name
|
Map<Long,String> |
getNameByCourse()
Return course-dependent section names
|
String |
getNote()
Section note
|
int |
getNrRooms()
Number of rooms in which the section meet.
|
double |
getOnlineSectioningPenalty()
Online sectioning penalty.
|
Section |
getParent()
Parent section of this section (can be null).
|
double |
getPenalty()
Return penalty which is added to an enrollment that contains this
section.
|
Placement |
getPlacement()
Time/room placement of the section.
|
List<Reservation> |
getReservations()
Get reservations for this section
|
List<RoomLocation> |
getRooms()
Room placement -- list of
RoomLocation |
List<Reservation> |
getSectionReservations()
Get reservations that require this section
|
double |
getSpaceExpected()
Return the amount of space of this section that is expected to be taken
by incoming students.
|
double |
getSpaceHeld()
Return the amount of space of this section that is held for incoming
students.
|
Subpart |
getSubpart()
Scheduling subpart to which this section belongs
|
TimeLocation |
getTime()
Time placement of the section.
|
double |
getTotalUnreservedSpace()
Total space in the section that cannot be used by any section reservation
|
double |
getUnreservedSpace(Request excludeRequest)
Available space in the section that is not reserved by any section reservation
|
int |
hashCode() |
boolean |
isAllowOverlap()
Return true if overlaps are allowed, but the number of overlapping slots should be minimized.
|
boolean |
isOverlapping(Assignment assignment)
True, if this section overlaps with the given assignment in time and
space
|
boolean |
isOverlapping(Set<? extends Assignment> assignments)
True, if this section overlaps with one of the given set of assignments
in time and space
|
boolean |
isToIgnoreStudentConflictsWith(long sectionId)
Returns true if student conflicts between this section and the given one are to be ignored
|
void |
setLimit(int limit)
Set section limit
|
void |
setName(long courseId,
String name)
Set course-dependent section name
|
void |
setName(String name)
Set section name
|
void |
setNote(String note)
Section note
|
void |
setPenalty(double penalty)
Set penalty which is added to an enrollment that contains this section.
|
void |
setPlacement(Placement placement)
Set time/room placement of the section.
|
void |
setSpaceExpected(double spaceExpected)
Set the amount of space of this section that is expected to be taken by
incoming students.
|
void |
setSpaceHeld(double spaceHeld)
Set the amount of space of this section that is held for incoming
students.
|
String |
toString() |
void |
unassigned(Enrollment enrollment)
Called when an enrollment with this section is unassigned from a request
|
public Section(long id, int limit, String name, Subpart subpart, Placement placement, String instructorIds, String instructorNames, Section parent)
id
- section unique idlimit
- section limit, i.e., the maximal number of students that can
be enrolled in this section at the same timename
- section namesubpart
- subpart of this sectionplacement
- time/room placementinstructorIds
- instructor(s) id -- needed for getChoice()
instructorNames
- instructor(s) name -- needed for getChoice()
parent
- parent section -- if there is a parent section defined, a
student that is enrolled in this section has to be enrolled in
the parent section as well. Also, the same relation needs to
be defined between subpart of this section and the subpart of
the parent sectionpublic long getId()
getId
in interface Assignment
public int getLimit()
public void setLimit(int limit)
public Subpart getSubpart()
public Section getParent()
public Placement getPlacement()
public void setPlacement(Placement placement)
public TimeLocation getTime()
getTime
in interface Assignment
public int getNrRooms()
getNrRooms
in interface Assignment
public List<RoomLocation> getRooms()
RoomLocation
getRooms
in interface Assignment
RoomLocation
public boolean isOverlapping(Assignment assignment)
isOverlapping
in interface Assignment
public boolean isOverlapping(Set<? extends Assignment> assignments)
isOverlapping
in interface Assignment
public void assigned(Enrollment enrollment)
assigned
in interface Assignment
public void unassigned(Enrollment enrollment)
unassigned
in interface Assignment
public Set<Enrollment> getEnrollments()
getEnrollments
in interface Assignment
public double getEnrollmentWeight(Request excludeRequest)
Request.getWeight()
.public double getMaxEnrollmentWeight()
public double getMinEnrollmentWeight()
public String getLongName()
public double getPenalty()
public void setPenalty(double penalty)
public int compareTo(Section s)
compareTo
in interface Comparable<Section>
public double getSpaceHeld()
public void setSpaceHeld(double spaceHeld)
getSpaceHeld()
for more info.public double getSpaceExpected()
public void setSpaceExpected(double spaceExpected)
getSpaceExpected()
for more info.public double getOnlineSectioningPenalty()
public boolean isAllowOverlap()
Subpart.setAllowOverlap(boolean)
.isAllowOverlap
in interface Assignment
public int compareById(Assignment a)
Request.getId()
compareById
in interface Assignment
public double getUnreservedSpace(Request excludeRequest)
excludeRequest
- excluding given request (if not null)public double getTotalUnreservedSpace()
public List<Reservation> getReservations()
public List<Reservation> getSectionReservations()
public void clearReservationCache()
public Map<Long,String> getNameByCourse()
public void addIgnoreConflictWith(long sectionId)
public boolean isToIgnoreStudentConflictsWith(long sectionId)
public Set<Long> getIgnoreConflictWithSectionIds()