public class Section extends AbstractClassWithContext<Request,Enrollment,Section.SectionContext> implements SctAssignment, AssignmentComparable<Section,Request,Enrollment>, CanInheritContext<Request,Enrollment,Section.SectionContext>
Modifier and Type | Class and Description |
---|---|
class |
Section.SectionContext |
sMaxSize
Constructor and Description |
---|
Section(long id,
int limit,
String name,
Subpart subpart,
Placement placement,
List<Instructor> instructors,
Section parent)
Constructor
|
Section(long id,
int limit,
String name,
Subpart subpart,
Placement placement,
Section parent,
Instructor... instructors)
Constructor
|
Section(long id,
int limit,
String name,
Subpart subpart,
Placement placement,
String instructorIds,
String instructorNames,
Section parent)
Deprecated.
|
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(Assignment<Request,Enrollment> assignment,
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(SctAssignment a)
Sections first, then by
Request.getId() |
int |
compareTo(Assignment<Request,Enrollment> assignment,
Section s)
Compare two sections, prefer sections with lower penalty and more open
space
|
int |
compareTo(Section s)
Compare two sections, prefer sections with lower penalty
|
Section.SectionContext |
createAssignmentContext(Assignment<Request,Enrollment> assignment)
Create a new assignment context for the given assignment.
|
boolean |
equals(Object o) |
Choice |
getChoice()
Choice matching this section
|
protected int |
getDayOfWeekOffset() |
Set<Enrollment> |
getEnrollments(Assignment<Request,Enrollment> assignment)
Set of assigned enrollments
|
double |
getEnrollmentTotalWeight(Assignment<Request,Enrollment> assignment,
Request excludeRequest)
Enrollment weight including over the limit enrollments.
|
double |
getEnrollmentWeight(Assignment<Request,Enrollment> assignment,
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)
|
String |
getInstructorNames(String delim)
Instructor names
|
List<Instructor> |
getInstructors()
Instructors assigned to this section
|
int |
getLimit()
Section limit.
|
String |
getLongName()
Deprecated.
|
String |
getLongName(boolean useAmPm)
Long name: subpart name + time long name + room names + instructor names
|
double |
getMaxEnrollmentWeight(Assignment<Request,Enrollment> assignment)
Maximal weight of a single enrollment in the section
|
double |
getMinEnrollmentWeight(Assignment<Request,Enrollment> assignment)
Minimal weight of a single enrollment in the section
|
Model<Request,Enrollment> |
getModel()
Get the model.
|
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(Assignment<Request,Enrollment> assignment)
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
|
List<Unavailability> |
getUnavailabilities()
List of student unavailabilities
|
double |
getUnreservedSpace(Assignment<Request,Enrollment> assignment,
Request excludeRequest)
Available space in the section that is not reserved by any section reservation
|
int |
hashCode() |
boolean |
hasInstructors()
Has any instructors assigned
|
boolean |
hasTime()
Check if the class has a time assignment (is not arranged hours)
|
Section.SectionContext |
inheritAssignmentContext(Assignment<Request,Enrollment> assignment,
Section.SectionContext parentContext)
Create a new assignment context for the given assignment.
|
boolean |
isAllowOverlap()
Return true if overlaps are allowed, but the number of overlapping slots should be minimized.
|
boolean |
isCancelled()
Return cancelled flag of the class.
|
boolean |
isEnabled()
Return enabled flag of the class.
|
boolean |
isEnabled(Student student)
Return enabled flag of the class.
|
boolean |
isModalityPreferred(Student student) |
boolean |
isOnline()
Return whether the class is online.
|
boolean |
isOverlapping(SctAssignment assignment)
True, if this section overlaps with the given assignment in time and
space
|
boolean |
isOverlapping(Set<? extends SctAssignment> assignments)
True, if this section overlaps with one of the given set of assignments
in time and space
|
boolean |
isPast()
Return past flag of the class.
|
boolean |
isToIgnoreStudentConflictsWith(long sectionId)
Returns true if student conflicts between this section and the given one are to be ignored
|
int |
nrInstructors()
Return number of instructors of this section
|
boolean |
sameChoice(Section section)
True if the time assignment as well as the instructor(s) are the same
|
boolean |
sameInstructionalType(Section section)
True if the instructional type is the same
|
boolean |
sameInstructors(Section section)
True if the instructor(s) are the same
|
boolean |
sameTime(Section section)
True if the time assignment is the same
|
void |
setCancelled(boolean cancelled)
Set cancelled flag of the class.
|
void |
setEnabled(boolean enabled)
Set enabled flag of the class.
|
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 |
setOnline(boolean online)
Set whether the class is online.
|
void |
setPast(boolean past)
Set past flag of the class.
|
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(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
Called when an enrollment with this section is unassigned from a request
|
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference
public Section(long id, int limit, String name, Subpart subpart, Placement placement, List<Instructor> instructors, 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 placementinstructors
- assigned instructor(s)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 Section(long id, int limit, String name, Subpart subpart, Placement placement, Section parent, Instructor... instructors)
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 placementinstructors
- assigned instructor(s)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 SctAssignment
public int getLimit()
public void setLimit(int limit)
limit
- class limitpublic Subpart getSubpart()
public Section getParent()
public Placement getPlacement()
public void setPlacement(Placement placement)
placement
- time and room assignment of this classpublic TimeLocation getTime()
getTime
in interface SctAssignment
public boolean hasTime()
public boolean sameInstructionalType(Section section)
public boolean sameInstructors(Section section)
public boolean sameChoice(Section section)
public int getNrRooms()
getNrRooms
in interface SctAssignment
public List<RoomLocation> getRooms()
RoomLocation
getRooms
in interface SctAssignment
RoomLocation
public boolean isOverlapping(SctAssignment assignment)
isOverlapping
in interface SctAssignment
assignment
- another assignmentpublic boolean isOverlapping(Set<? extends SctAssignment> assignments)
isOverlapping
in interface SctAssignment
assignments
- a set of assignmentspublic void assigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
assigned
in interface SctAssignment
assignment
- current assignmentenrollment
- an enrollment that was just assignedpublic void unassigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
unassigned
in interface SctAssignment
assignment
- current assignmentenrollment
- an enrollment that was just unassignedpublic String getLongName(boolean useAmPm)
useAmPm
- use 12-hour format@Deprecated public String getLongName()
public List<Instructor> getInstructors()
public boolean hasInstructors()
public int nrInstructors()
public String getInstructorNames(String delim)
delim
- delimiterpublic double getPenalty()
public void setPenalty(double penalty)
penalty
- online penaltypublic int compareTo(Assignment<Request,Enrollment> assignment, Section s)
compareTo
in interface AssignmentComparable<Section,Request,Enrollment>
assignment
- current assignments
- other instancepublic int compareTo(Section s)
compareTo
in interface Comparable<Section>
compareTo
in interface AssignmentComparable<Section,Request,Enrollment>
public double getSpaceHeld()
public void setSpaceHeld(double spaceHeld)
getSpaceHeld()
for more info.spaceHeld
- space heldpublic double getSpaceExpected()
public void setSpaceExpected(double spaceExpected)
getSpaceExpected()
for more info.spaceExpected
- space expectedpublic double getOnlineSectioningPenalty(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic boolean isAllowOverlap()
Subpart.setAllowOverlap(boolean)
.isAllowOverlap
in interface SctAssignment
public int compareById(SctAssignment a)
Request.getId()
compareById
in interface SctAssignment
a
- another section assignmentpublic double getUnreservedSpace(Assignment<Request,Enrollment> assignment, Request excludeRequest)
assignment
- current assignmentexcludeRequest
- excluding given request (if not null)public double getTotalUnreservedSpace()
public List<Reservation> getReservations()
public List<Reservation> getSectionReservations()
public void clearReservationCache()
public String getName(long courseId)
courseId
- course offering unique idpublic void setName(long courseId, String name)
courseId
- course offering unique idname
- course dependent class namepublic Map<Long,String> getNameByCourse()
public void addIgnoreConflictWith(long sectionId)
sectionId
- class unique idpublic boolean isToIgnoreStudentConflictsWith(long sectionId)
sectionId
- class unique idpublic Set<Long> getIgnoreConflictWithSectionIds()
public Set<Enrollment> getEnrollments(Assignment<Request,Enrollment> assignment)
getEnrollments
in interface SctAssignment
assignment
- current assignmentspublic double getEnrollmentWeight(Assignment<Request,Enrollment> assignment, Request excludeRequest)
Request.getWeight()
.assignment
- current assignmentexcludeRequest
- course request to ignore, if anypublic double getEnrollmentTotalWeight(Assignment<Request,Enrollment> assignment, Request excludeRequest)
Reservation.canBatchAssignOverLimit()
set to true.assignment
- current assignmentexcludeRequest
- course request to ignore, if anypublic double getMaxEnrollmentWeight(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic double getMinEnrollmentWeight(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic boolean isCancelled()
public void setCancelled(boolean cancelled)
cancelled
- true if the class is cancelledpublic boolean isPast()
public void setPast(boolean past)
past
- true if the class is in the past and should be avoided when possiblepublic boolean isEnabled()
isEnabled(Student)
where applicable.public boolean isEnabled(Student student)
protected int getDayOfWeekOffset()
public void setEnabled(boolean enabled)
enabled
- true if the class is enabled for student schedulingpublic boolean isOnline()
public boolean isModalityPreferred(Student student)
public void setOnline(boolean online)
online
- true if the class is onlinepublic Model<Request,Enrollment> getModel()
AbstractClassWithContext
getModel
in class AbstractClassWithContext<Request,Enrollment,Section.SectionContext>
public Section.SectionContext createAssignmentContext(Assignment<Request,Enrollment> assignment)
HasAssignmentContext
createAssignmentContext
in interface HasAssignmentContext<Request,Enrollment,Section.SectionContext>
assignment
- an assignment for which there needs to be an assignment contextpublic Section.SectionContext inheritAssignmentContext(Assignment<Request,Enrollment> assignment, Section.SectionContext parentContext)
CanInheritContext
inheritAssignmentContext
in interface CanInheritContext<Request,Enrollment,Section.SectionContext>
assignment
- an assignment for which there needs to be an assignment contextparentContext
- context of the parent assignmentpublic Choice getChoice()
public List<Unavailability> getUnavailabilities()