public class ExamPeriod extends Object implements Comparable<ExamPeriod>
getPenalty()
) can be assigned to each
period. It is used to penalize unpopular examination times (e.g., evening or
last-day). ExamModel.addPeriod(Long, String, String, int, int)
, inserting
periods in the order of increasing days and times. Constructor and Description |
---|
ExamPeriod(Long id,
String day,
String time,
int length,
int penalty)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ExamPeriod p) |
boolean |
equals(Object o) |
int |
getDay()
Day index
|
String |
getDayStr()
Day string, e.g., 07/12/10
|
Long |
getId()
Period unique identifier
|
int |
getIndex()
Period index
|
int |
getLength()
Length of period in minutes
|
int |
getPenalty()
Period weight to be used to penalize unpopular periods
|
int |
getTime()
Time index
|
String |
getTimeStr()
Time string, e.g., 8:00am-10:00am
|
int |
hashCode() |
ExamPeriod |
next()
Next period
|
ExamPeriod |
prev()
Previous period
|
void |
setId(Long id)
Period unique identifier
|
void |
setIndex(int index,
int day,
int time)
Set priod indexes (only to be used by
ExamModel.addPeriod(Long, String, String, int, int) ) |
void |
setNext(ExamPeriod next)
Set next period (only to be used by
ExamModel.addPeriod(Long, String, String, int, int) ) |
void |
setPrev(ExamPeriod prev)
Set previous period (only to be used by
ExamModel.addPeriod(Long, String, String, int, int) ) |
String |
toDebugString()
String representation for debuging purposes
|
String |
toString()
String representation
|
public ExamPeriod(Long id, String day, String time, int length, int penalty)
id
- period unique identifierday
- day (e.g., 07/12/10)time
- (e.g., 8:00am-10:00am)length
- length of period in minutespenalty
- penalization of using this periodpublic int getDay()
public String getTimeStr()
public int getTime()
public int getLength()
public int getIndex()
public int getPenalty()
public ExamPeriod prev()
public ExamPeriod next()
public void setIndex(int index, int day, int time)
ExamModel.addPeriod(Long, String, String, int, int)
)index
- period indexday
- day indextime
- time indexpublic void setPrev(ExamPeriod prev)
ExamModel.addPeriod(Long, String, String, int, int)
)prev
- previous periodpublic void setNext(ExamPeriod next)
ExamModel.addPeriod(Long, String, String, int, int)
)next
- next periodpublic String toDebugString()
public int compareTo(ExamPeriod p)
compareTo
in interface Comparable<ExamPeriod>