Exemple #1
0
 public boolean equals(Object obj) {
   if (!(obj instanceof IntervalOfTime)) return false;
   IntervalOfTime i = (IntervalOfTime) obj;
   return isLowClosed() == i.isLowClosed()
       && isHighClosed() == i.isHighClosed()
       && getLow().equals(i.getLow())
       && getHigh().equals(i.getHigh());
 }
Exemple #2
0
 public static IntervalOfTime intersection(IntervalOfTime i1, IntervalOfTime i2) {
   if (i1.getLow().before(i2.getLow())) {
     if (i2.getLow().after(i1.getHigh())) {
       return null;
     }
     return new IntervalOfTime(i2.getLow(), i1.getHigh());
   }
   if (i1.getLow().after(i2.getHigh())) {
     return null;
   }
   return new IntervalOfTime(i1.getLow(), i2.getHigh());
 }
Exemple #3
0
 public boolean contains(IntervalOfTime i) {
   return getLow().before(i.getLow()) && getHigh().after(i.getLow());
 }