public class LinkedSections extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
LinkedSections.ConflictHandler
Helper interface to process conflicts in
computeConflicts(Enrollment, EnrollmentAssignment, ConflictHandler) |
static class |
LinkedSections.CurrentAssignment
Current assignment -- default for
computeConflicts(Enrollment, EnrollmentAssignment, ConflictHandler) |
static interface |
LinkedSections.EnrollmentAssignment
Interface to be able to provide a custom assignment to
computeConflicts(Enrollment, EnrollmentAssignment, ConflictHandler) |
class |
LinkedSections.LinkedSectionsConstraint
Linked sections constraint -- to be created for each student that requests two
or more offerings of this link
|
| Constructor and Description |
|---|
LinkedSections(Collection<Section> sections)
Constructor
|
LinkedSections(Section... sections)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
computeConflicts(Assignment<Request,Enrollment> assignment,
Enrollment enrollment,
LinkedSections.ConflictHandler conflicts)
Compute conflicting enrollments.
|
void |
computeConflicts(Enrollment enrollment,
LinkedSections.EnrollmentAssignment assignment,
LinkedSections.ConflictHandler conflicts)
Compute conflicting enrollments.
|
void |
createConstraints()
Create linked-section constraints for this link.
|
Set<Offering> |
getOfferings()
Return offerings of this link
|
Set<Section> |
getSections(Subpart subpart)
Return section (or sections) of a subpart of this link
|
Set<Subpart> |
getSubparts(Offering offering)
Return subpart (or subparts) of an offering of this link
|
protected boolean |
hasFullMatch(Enrollment enrollment)
Check if the given enrollment fully matches this constraint
|
Enrollment |
inConflict(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
Check for conflicts.
|
Enrollment |
inConflict(Enrollment enrollment,
LinkedSections.EnrollmentAssignment assignment)
Check for conflicts.
|
boolean |
isMustBeUsed()
Return whether this constraint must be used
|
protected int |
nrSharedOfferings(LinkedSections other)
Number of offerings that are shared with some other linked sections constraint
|
void |
setMustBeUsed(boolean mustBeUsed)
Set whether this constraint must be used
|
String |
toString() |
public LinkedSections(Section... sections)
sections - sections that are to be linkedpublic LinkedSections(Collection<Section> sections)
sections - sections that are to be linkedpublic Set<Offering> getOfferings()
public Set<Subpart> getSubparts(Offering offering)
offering - an offering of this linkpublic Set<Section> getSections(Subpart subpart)
subpart - subpart of this linkpublic void createConstraints()
public void computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment, LinkedSections.ConflictHandler conflicts)
getSubparts(Offering)), another assignment
of this student is in a conflict, if it does not contain the appropriate sections from
getSubparts(Offering) and getSections(Subpart).assignment - current assignmentenrollment - given enrollmentconflicts - found conflicts are given to this interface, see LinkedSections.ConflictHandler.onConflict(Enrollment)public void computeConflicts(Enrollment enrollment, LinkedSections.EnrollmentAssignment assignment, LinkedSections.ConflictHandler conflicts)
getSubparts(Offering)), another assignment
of this student is in a conflict, if it does not contain the appropriate sections from
getSubparts(Offering) and getSections(Subpart).enrollment - given enrollmentassignment - custom assignmentconflicts - found conflicts are given to this interface, see LinkedSections.ConflictHandler.onConflict(Enrollment)protected boolean hasFullMatch(Enrollment enrollment)
enrollment - an enrollmentprotected int nrSharedOfferings(LinkedSections other)
other - the other constraintpublic Enrollment inConflict(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
getSubparts(Offering)), another assignment
of this student is in a conflict, if it does not contain the appropriate sections from
getSubparts(Offering) and getSections(Subpart).assignment - current assignmentenrollment - given enrollmentpublic Enrollment inConflict(Enrollment enrollment, LinkedSections.EnrollmentAssignment assignment)
getSubparts(Offering)), another assignment
of this student is in a conflict, if it does not contain the appropriate sections from
getSubparts(Offering) and getSections(Subpart).enrollment - given enrollmentassignment - custom assignmentpublic boolean isMustBeUsed()
public void setMustBeUsed(boolean mustBeUsed)
mustBeUsed - if true, a pair of linked sections must be used when a student requests both courses