Methods Summary |
---|
public int | compareTo(java.lang.Object o)
TimeSlot other = (TimeSlot) o;
if (zeroBasedDayOfWeek < other.zeroBasedDayOfWeek) {
return -1;
} else if (zeroBasedDayOfWeek > other.zeroBasedDayOfWeek) {
return 1;
} else {
if (startMinutes < other.startMinutes) {
return -1;
} else if (startMinutes > other.startMinutes) {
return 1;
}
}
return 0;
|
public int | getDayOfWeek()
return zeroBasedDayOfWeek;
|
public java.lang.String | getDescription()
return DAYS[zeroBasedDayOfWeek] + " " + getHrsMins(startMinutes) + "-"
+ getHrsMins(endMinutes);
|
public int | getEndMinutes()
return endMinutes;
|
private java.lang.String | getHrsMins(int mins)
int hrs = mins / 60;
if (hrs > 12) {
hrs -= 12;
}
int remainder = mins % 60;
return hrs + ":"
+ (remainder < 10 ? "0" + remainder : String.valueOf(remainder));
|
public int | getStartMinutes()
return startMinutes;
|
public void | setDayOfWeek(int zeroBasedDayOfWeek)
if (0 <= zeroBasedDayOfWeek && zeroBasedDayOfWeek < 7) {
this.zeroBasedDayOfWeek = zeroBasedDayOfWeek;
} else {
throw new IllegalArgumentException("day must be in the range 0-6");
}
|
public void | setEndMinutes(int endMinutes)
this.endMinutes = endMinutes;
|
public void | setStartMinutes(int startMinutes)
this.startMinutes = startMinutes;
|