public int compareTo(ClassTimeInfo time) { int cmp = getDate().compareTo(time.getDate()); if (cmp != 0) return cmp; cmp = getTimePattern().compareTo(time.getTimePattern()); if (cmp != 0) return cmp; cmp = getDayCode() - time.getDayCode(); if (cmp != 0) return cmp; cmp = getStartSlot() - time.getStartSlot(); if (cmp != 0) return cmp; return hashCode() - time.hashCode(); }
public ClassTimeInfo(ClassTimeInfo time, ClassDateInfo date, List<Date> dates) { iClassId = time.iClassId; iPreference = time.getPreference(); iStartSlot = time.getStartSlot(); iDayCode = time.getDayCode(); iMinsPerMtg = time.getMinutesPerMeeting(); iLength = time.getLength(); iBreakTime = time.getBreakTime(); iNrMeetings = time.getNrMeetings(); iDate = date; iTimePatternId = time.getTimePatternId(); if (time.iTimePattern != null) iTimePattern = time.iTimePattern; iHashCode = combine(combine(iDayCode, iStartSlot), combine(iLength, date.getId().hashCode())); iDates = dates; }
public boolean equals(Object o) { if (o == null || !(o instanceof ClassTimeInfo)) return false; ClassTimeInfo t = (ClassTimeInfo) o; if (getStartSlot() != t.getStartSlot()) return false; if (getLength() != t.getLength()) return false; if (getDayCode() != t.getDayCode()) return false; return ToolBox.equals(getTimePatternId(), t.getTimePatternId()) && ToolBox.equals(getDatePatternId(), t.getDatePatternId()); }
public boolean shareWeeks(ClassTimeInfo anotherLocation) { return getDate().getPattern().intersects(anotherLocation.getDate().getPattern()); }