Пример #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());
 }
Пример #2
0
 public static IntervalOfTime convexHull(IntervalOfTime i1, IntervalOfTime i2) {
   PointInTime t1;
   PointInTime t2;
   boolean lowClosed;
   boolean highClosed;
   if (i1.low.before(i2.low)) {
     t1 = i1.low;
     lowClosed = i1.isLowClosed();
   } else {
     t1 = i2.low;
     lowClosed = i2.isLowClosed();
   }
   if (i1.high.after(i2.high)) {
     t2 = i1.high;
     highClosed = i1.isHighClosed();
   } else {
     t2 = i2.high;
     highClosed = i2.isHighClosed();
   }
   return new IntervalOfTime(t1, t2, lowClosed, highClosed);
 }