public class Section extends Object
Constructor and Description |
---|
Section(long id,
String externalId,
String type,
String name,
TimeLocation time,
String room,
boolean allowOverlap,
boolean common)
Constructor
|
Modifier and Type | Method and Description |
---|---|
double |
countBackToBacks(Collection<Section> sections,
double diffRoomWeight,
double diffTypeWeight)
Check if this section is back-to-back with some other section in the list
|
double |
countSameDays(Collection<Section> sections,
double diffRoomWeight,
double diffTypeWeight)
Check if this section has the same days with some other section in the list
|
double |
countSameRooms(Collection<Section> sections,
double diffTypeWeight)
Check if this section has the same room with some other section in the list
|
boolean |
equals(Object o) |
String |
getExternalId()
Section external unique id that was provided in the constructor
|
String |
getRoom()
Section room (or rooms)
|
Long |
getSectionId()
Section unique id that was provided in the constructor
|
String |
getSectionName()
Section name that was provided in the constructor
|
String |
getSectionType()
Section instructional type (e.g., Lecture) that was provided in the constructor
|
TimeLocation |
getTime()
Section time that was provided in the constructor
|
String |
getTimeName(boolean useAmPm)
Format the time statement
|
int |
hashCode() |
boolean |
hasRoom()
Has section room filled in?
|
boolean |
hasSectionType()
Has section type filled in?
|
boolean |
hasTime()
Has section time filled in?
|
boolean |
isAllowOverlap()
Are time overlaps with other sections and with prohibited time preferences allowed?
|
boolean |
isBackToBack(Section section)
Check if this section is back to back with some other section
|
boolean |
isCommon()
Is common part of the course (e.g., a lecture)?
|
boolean |
isOverlapping(Collection<Section> sections)
Check if this section overlaps in time with at least one of the given sections
|
boolean |
isOverlapping(Section section)
Check if this section overlaps in time with some other section
|
boolean |
isSameRoom(Section section)
Check if this section is placed in the same room as the other section
|
boolean |
isSameSectionType(Section section)
Check if this section has the same instructional type as the other section
|
double |
percSameDays(Section section)
Check if this section has the same days as some other section
|
int |
share(Collection<Section> sections)
If this section can overlap in time with any of the given section, compute the number of overlapping time slots
|
int |
share(Section section)
If this section can overlap in time with the other section, compute the number of overlapping time slots
|
int |
share(TimeLocation time)
Compute the number of overlapping time slots between this section and the given time
|
String |
toString() |
public Section(long id, String externalId, String type, String name, TimeLocation time, String room, boolean allowOverlap, boolean common)
id
- section unique idexternalId
- section external idtype
- instructional typename
- section nametime
- section time assignmentroom
- section room assignmentallowOverlap
- can this section overlap with some other sectioncommon
- is this a common part of the coursepublic Long getSectionId()
public String getExternalId()
public String getSectionType()
public boolean hasSectionType()
public String getSectionName()
public TimeLocation getTime()
public boolean hasTime()
public boolean hasRoom()
public boolean isAllowOverlap()
public boolean isCommon()
TeachingRequest.getSameCommonPreference()
is true) or to minimize the different sections that are not shared among all the assignments
(using DifferentLecture
criterion and TeachingRequest.nrSameLectures(TeachingRequest)
).public boolean isOverlapping(Section section)
section
- the other sectionTimeLocation.hasIntersection(TimeLocation)
)public boolean isOverlapping(Collection<Section> sections)
sections
- the other sectionsisOverlapping(Section)
)public boolean isBackToBack(Section section)
section
- the other sectionpublic double percSameDays(Section section)
section
- the other sectionpublic boolean isSameRoom(Section section)
section
- the other sectionpublic boolean isSameSectionType(Section section)
section
- the other sectionpublic double countBackToBacks(Collection<Section> sections, double diffRoomWeight, double diffTypeWeight)
sections
- the other sectionsdiffRoomWeight
- different room penalty (should be between 1 and 0)diffTypeWeight
- different instructional type penalty (should be between 1 and 0)public double countSameDays(Collection<Section> sections, double diffRoomWeight, double diffTypeWeight)
sections
- the other sectionsdiffRoomWeight
- different room penalty (should be between 1 and 0)diffTypeWeight
- different instructional type penalty (should be between 1 and 0)public double countSameRooms(Collection<Section> sections, double diffTypeWeight)
sections
- the other sectionsdiffTypeWeight
- different instructional type penalty (should be between 1 and 0)public int share(Section section)
section
- the other sectionpublic int share(TimeLocation time)
time
- the given timepublic int share(Collection<Section> sections)
sections
- the other sectionspublic String getTimeName(boolean useAmPm)
useAmPm
- use 12-hours or 24-hours format