public class RequestGroup extends AbstractClassWithContext<Request,Enrollment,RequestGroup.RequestGroupContext> implements CanInheritContext<Request,Enrollment,RequestGroup.RequestGroupContext>
Modifier and Type | Class and Description |
---|---|
class |
RequestGroup.RequestGroupContext |
sMaxSize
Constructor and Description |
---|
RequestGroup(long id,
String name,
Course course)
Creates request group.
|
Modifier and Type | Method and Description |
---|---|
void |
addRequest(CourseRequest request)
Add course request to the group.
|
void |
assigned(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
Called when an enrollment is assigned to a request of this request group
|
RequestGroup.RequestGroupContext |
createAssignmentContext(Assignment<Request,Enrollment> assignment)
Create a new assignment context for the given assignment.
|
boolean |
equals(Object o) |
double |
getAverageSpread(Assignment<Request,Enrollment> assignment)
Return average section spread of this group.
|
Course |
getCourse()
Course associated with this group.
|
double |
getEnrollmentSpread(Assignment<Request,Enrollment> assignment,
Enrollment enrollment,
double bestRatio,
double fillRatio)
Return how much is the given enrollment similar to other enrollments of this group.
|
double |
getEnrollmentWeight(Assignment<Request,Enrollment> assignment,
Request excludeRequest)
Enrollment weight -- weight of all requests which have an enrollment that
is of this request group, excluding the given one.
|
long |
getId()
Request group id
|
Model<Request,Enrollment> |
getModel()
Get the model.
|
String |
getName()
Request group name
|
Set<CourseRequest> |
getRequests()
Return the set of course requests that are associated with this group.
|
double |
getSectionSpread(Assignment<Request,Enrollment> assignment,
Section section)
Return section spread of this group.
|
double |
getSectionWeight(Assignment<Request,Enrollment> assignment,
Section section,
Request excludeRequest)
Section weight -- weight of all requests which have an enrollment that
is of this request group and that includes the given section, excluding the given one.
|
double |
getTotalWeight()
Total weight (using
Request.getWeight() ) of the course requests of this group |
int |
hashCode() |
RequestGroup.RequestGroupContext |
inheritAssignmentContext(Assignment<Request,Enrollment> assignment,
RequestGroup.RequestGroupContext parentContext)
Create a new assignment context for the given assignment.
|
void |
removeRequest(CourseRequest request)
Remove course request from the group.
|
void |
unassigned(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
Called when an enrollment is unassigned from a request of this request group
|
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference
public RequestGroup(long id, String name, Course course)
id
- identification of the groupname
- group namecourse
- course for which the group is created (only course requests for this course can be of this group)public void addRequest(CourseRequest request)
getCourse()
.
This is done automatically by CourseRequest.addRequestGroup(RequestGroup)
.request
- course request to be added to this grouppublic void removeRequest(CourseRequest request)
CourseRequest.removeRequestGroup(RequestGroup)
.request
- course request to be removed from this grouppublic Set<CourseRequest> getRequests()
public double getTotalWeight()
Request.getWeight()
) of the course requests of this grouppublic long getId()
public Course getCourse()
public void assigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
public void unassigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
public double getEnrollmentWeight(Assignment<Request,Enrollment> assignment, Request excludeRequest)
Request.getWeight()
.assignment
- current assignmentexcludeRequest
- course request to ignore, if anypublic double getSectionWeight(Assignment<Request,Enrollment> assignment, Section section, Request excludeRequest)
Request.getWeight()
.assignment
- current assignmentsection
- section in questionexcludeRequest
- course request to ignore, if anypublic double getEnrollmentSpread(Assignment<Request,Enrollment> assignment, Enrollment enrollment, double bestRatio, double fillRatio)
assignment
- current assignmentenrollment
- enrollment in questionbestRatio
- how much of the weight should be used on estimation of the enrollment potential
(considering that students of this group that are not yet enrolled can take the same enrollment)fillRatio
- how much of the weight should be used in estimation how well are the sections of this enrollments going to be filled
(bestRatio + fillRatio <= 1.0)public double getAverageSpread(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic double getSectionSpread(Assignment<Request,Enrollment> assignment, Section section)
assignment
- current assignmentsection
- given sectionpublic RequestGroup.RequestGroupContext createAssignmentContext(Assignment<Request,Enrollment> assignment)
HasAssignmentContext
createAssignmentContext
in interface HasAssignmentContext<Request,Enrollment,RequestGroup.RequestGroupContext>
assignment
- an assignment for which there needs to be an assignment contextpublic RequestGroup.RequestGroupContext inheritAssignmentContext(Assignment<Request,Enrollment> assignment, RequestGroup.RequestGroupContext parentContext)
CanInheritContext
inheritAssignmentContext
in interface CanInheritContext<Request,Enrollment,RequestGroup.RequestGroupContext>
assignment
- an assignment for which there needs to be an assignment contextparentContext
- context of the parent assignmentpublic Model<Request,Enrollment> getModel()
AbstractClassWithContext
getModel
in class AbstractClassWithContext<Request,Enrollment,RequestGroup.RequestGroupContext>