public class ExamStudent extends Constraint<Exam,ExamPlacement>
iConstraintListeners, iId
Constructor and Description |
---|
ExamStudent(ExamModel model,
long id)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
canConflict(Exam ex1,
Exam ex2)
True if the given two exams can have a direct student conflict with this
student, i.e., they can be placed at the same period.
|
int |
compareTo(Constraint<Exam,ExamPlacement> o)
Compare two students (by student ids)
|
void |
computeConflicts(Assignment<Exam,ExamPlacement> assignment,
ExamPlacement p,
Set<ExamPlacement> conflicts)
Compute conflicts between the given assignment of an exam and all the
current assignments (of this student).
|
boolean |
equals(Object o)
Compare two student for equality
|
Set<Exam> |
getExams(Assignment<Exam,ExamPlacement> assignment,
ExamPeriod period)
Exam(s) enrolled by the student that are scheduled in the given period
|
Set<Exam> |
getExamsADay(Assignment<Exam,ExamPlacement> assignment,
ExamPeriod period)
Exam(s) enrolled by the student that are scheduled in the given day
|
Set<Exam> |
getExamsADay(Assignment<Exam,ExamPlacement> assignment,
int day)
Exam(s) enrolled by the student that are scheduled in the given day
|
List<ExamOwner> |
getOwners()
Courses and/or sections that this student is enrolled to
|
int |
hashCode()
Hash code
|
boolean |
inConflict(Assignment<Exam,ExamPlacement> assignment,
ExamPlacement p)
Check whether there is a conflict between the given assignment of an exam
and all the current assignments (of this student).
|
boolean |
isAllowDirectConflicts()
True if direct student conflicts are allowed for this student
|
boolean |
isAvailable(ExamPeriod period)
True if the student is available (for examination timetabling) during the
given period
|
boolean |
isConsistent(ExamPlacement p1,
ExamPlacement p2)
True if the given exams can conflict (see
canConflict(Exam, Exam) ), or if they are placed at
different periods. |
boolean |
isHard()
Constraint is hard if
isAllowDirectConflicts() is
false. |
void |
setAllowDirectConflicts(boolean allowDirectConflicts)
Set whether direct student conflicts are allowed for this student
|
void |
setAvailable(int period,
boolean available)
Set whether the student is available (for examination timetabling) during
the given period
|
String |
toString()
Student unique id
|
addConstraintListener, addVariable, assigned, assignedVariables, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, getDescription, getId, getModel, getName, removeConstraintListener, removeVariable, setModel, unassigned, variables
public ExamStudent(ExamModel model, long id)
model
- examination timetabling modelid
- student unique idpublic boolean isAllowDirectConflicts()
public void setAllowDirectConflicts(boolean allowDirectConflicts)
allowDirectConflicts
- direct conflicts are allowedpublic boolean canConflict(Exam ex1, Exam ex2)
ex1
- an examex2
- an examisAllowDirectConflicts()
and
Exam.isAllowDirectConflicts()
for both examspublic Set<Exam> getExams(Assignment<Exam,ExamPlacement> assignment, ExamPeriod period)
assignment
- current assignmentperiod
- given periodpublic Set<Exam> getExamsADay(Assignment<Exam,ExamPlacement> assignment, ExamPeriod period)
assignment
- current assignmentperiod
- given periodpublic Set<Exam> getExamsADay(Assignment<Exam,ExamPlacement> assignment, int day)
assignment
- current assignmentday
- given daypublic void computeConflicts(Assignment<Exam,ExamPlacement> assignment, ExamPlacement p, Set<ExamPlacement> conflicts)
canConflict(Exam, Exam)
are considered.computeConflicts
in class Constraint<Exam,ExamPlacement>
assignment
- current assignmentp
- value to be assigned to its variableconflicts
- resultant set of conflicting valuespublic boolean inConflict(Assignment<Exam,ExamPlacement> assignment, ExamPlacement p)
canConflict(Exam, Exam)
are
considered.inConflict
in class Constraint<Exam,ExamPlacement>
assignment
- current assignmentp
- given valuepublic boolean isConsistent(ExamPlacement p1, ExamPlacement p2)
canConflict(Exam, Exam)
), or if they are placed at
different periods.isConsistent
in class Constraint<Exam,ExamPlacement>
p1
- a valuep2
- a valuepublic boolean equals(Object o)
equals
in class Constraint<Exam,ExamPlacement>
public int hashCode()
hashCode
in class Constraint<Exam,ExamPlacement>
public int compareTo(Constraint<Exam,ExamPlacement> o)
compareTo
in interface Comparable<Constraint<Exam,ExamPlacement>>
compareTo
in class Constraint<Exam,ExamPlacement>
public boolean isHard()
isAllowDirectConflicts()
is
false.isHard
in class Constraint<Exam,ExamPlacement>
public List<ExamOwner> getOwners()
ExamOwner
public boolean isAvailable(ExamPeriod period)
period
- a periodpublic void setAvailable(int period, boolean available)
period
- a periodavailable
- true if a student can attend an exam at the given period,
false if otherwise