Beispiel #1
0
 @Override
 public boolean equals(Object o) {
   if (o == null || !(o instanceof TimeLocation)) return false;
   TimeLocation t = (TimeLocation) 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 isAvailable(TimeLocation timeLocation, Long departmentId) {
   for (int d = 0; d < Constants.NR_DAYS; d++) {
     if ((Constants.DAY_CODES[d] & timeLocation.getDayCode()) == 0) continue;
     int startTime = timeLocation.getStartSlot() / 6;
     int endTime = (timeLocation.getStartSlot() + timeLocation.getLength() - 1) / 6;
     for (int t = startTime; t <= endTime; t++) {
       Long pref = iPreference[d][t];
       if (pref.equals(sNotAvailablePref)) return false;
       if (pref.equals(sFreeForAllPref)) continue;
       if (departmentId != null && !departmentId.equals(pref)) return false;
     }
   }
   return true;
 }