Пример #1
0
 public SimpleTime GetOverlap(SimpleTimePeriod anotherTimePeriod) {
     if (this.start.isBefore(anotherTimePeriod.start) && this.end.isBefore(anotherTimePeriod.end) && anotherTimePeriod.start.isBefore(this.end)) {
         return this.end.getBefore(anotherTimePeriod.start);
     }
     if (anotherTimePeriod.start.isBefore(this.start) && anotherTimePeriod.end.isBefore(this.end) && this.start.isBefore(anotherTimePeriod.end)) {
         return anotherTimePeriod.end.getBefore(this.start);
     }
     if (anotherTimePeriod.start.isBefore(this.start) && this.end.isBefore(anotherTimePeriod.end)) {
         return this.end.getBefore(this.start);
     }
     if (this.start.isBefore(anotherTimePeriod.start) && anotherTimePeriod.end.isBefore(this.end)) {
         return anotherTimePeriod.end.getBefore(anotherTimePeriod.start);
     }
     return new SimpleTime(0);
 }
Пример #2
0
 public void AddTimePeriod(SimpleTimePeriod period) {
     periods.Add(period);
 }