Checks this period conflicts with another period.
970609
def conflicts_with(self, period):
        ""
        if self.tba or period.tba:
            return False
        same_day = False
        for i in self.int_days:
            if i in period.int_days:
                same_day = True

        if not same_day:
            return False

        return self.start <= period.start <= self.end or \
            period.start <= self.start <= period.end or \
            self.start <= period.end <= self.end or \
            period.start <= self.end <= period.end
659779
function icaltime_compare(other) {
      var a = this.toSeconds();
      var b = other.toSeconds();
      return (a > b) - (b > a);
    }
535997
def conflicts_with(self, other):
        """"""
        if isinstance(other, Requirement):
            if (self.name_ != other.name_) or (self.range is None) \
                    or (other.range is None):
                return False
            elif self.conflict:
                return False if other.conflict \
                    else self.range_.issuperset(other.range_)
            elif other.conflict:
                return other.range_.issuperset(self.range_)
            else:
                return not self.range_.intersects(other.range_)
        else:  # VersionedObject
            if (self.name_ != other.name_) or (self.range is None):
                return False
            if self.conflict:
                return (other.version_ in self.range_)
            else:
                return (other.version_ not in self.range_)
125376
public static boolean isTimeConflict(Time timeFrom, Time timeTo, Time otherTimeFrom, Time otherTimeTo) {
		if (JKDateTimeUtil.isTimesEqaualed(timeFrom, otherTimeFrom) || JKDateTimeUtil.isTimesEqaualed(timeTo, otherTimeTo)) {
			return true;
		}

		// other time start time is between start and end time for this time
		if (timeFrom.after(otherTimeFrom) && timeFrom.before(otherTimeTo)) {
			return true;
		}

		// other time e is between start and end time for this time
		if (timeTo.after(otherTimeFrom) && timeTo.before(otherTimeTo)) {
			return true;
		}

		// if time starting before this time and ends after this time
		if (timeFrom.before(otherTimeFrom) && timeTo.after(otherTimeTo)) {
			return true;
		}

		return false;
	}
1229558
public PeriodList calculateRecurrenceSet(final Period period) {
        PeriodList periods = new PeriodList();

        for (Component component : getRevisions()) {
            periods = periods.add(component.calculateRecurrenceSet(period));
        }

        return periods;
    }
880657
public void setPeriod(@Nullable Period period) {
    checkState(!initialized, "Period have already been initialized");
    this.period = period;
    this.initialized = true;
  }
1192586
private static long periodEnd(long now, 
                                long period, 
                                LocalDateTime cal)
  {
    if (period < 0)
      return Long.MAX_VALUE;
    else if (period == 0)
      return now;

    if (period < 30 * DAY) {
      //cal.setGMTTime(now);

      long localTime = cal.toEpochSecond(ZoneOffset.UTC) * 1000;

      localTime = localTime + (period - (localTime + 4 * DAY) % period);

      //cal.setLocalTime(localTime);

      //return cal.getGMTTime();
      return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
    }

    if (period % (30 * DAY) == 0) {
      int months = (int) (period / (30 * DAY));

      //cal.setGMTTime(now);
      long year = cal.getYear();
      int month = cal.getMonthValue();

      //cal.setLocalTime(0);
      
      //cal.setDate(year, month + months, 1);
      cal.withMonth(month + months);
      cal.withDayOfMonth(1);

      return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
    }

    if (period % (365 * DAY) == 0) {
      long years = (period / (365 * DAY));

      //cal.setGMTTime(now);
      long year = cal.getYear();

      //cal.setLocalTime(0);

      long newYear = year + (years - year % years);
      
      cal.withYear((int) newYear);
      cal.withMonth(1);
      cal.withDayOfMonth(1);

      return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
    }

    //cal.setGMTTime(now);

    //long localTime = cal.getLocalTime();

    //localTime = localTime + (period - (localTime + 4 * DAY) % period);

    //cal.setLocalTime(localTime);

    //return cal.getGMTTime();
    return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
  }
460529
def CheckDisjointCalendars(self):
    
    # TODO: Do an exact check here.

    a_service_periods = self.feed_merger.a_schedule.GetServicePeriodList()
    b_service_periods = self.feed_merger.b_schedule.GetServicePeriodList()

    for a_service_period in a_service_periods:
      a_start, a_end = a_service_period.GetDateRange()
      for b_service_period in b_service_periods:
        b_start, b_end = b_service_period.GetDateRange()
        overlap_start = max(a_start, b_start)
        overlap_end = min(a_end, b_end)
        if overlap_end >= overlap_start:
          return False
    return True
9546
def intersect(self, other):
        """"""
        if self.overlaps(other):
            newlower_value = max(self.lower_value, other.lower_value)
            new_upper_value = min(self._upper_value, other._upper_value)
            new_lower, new_upper = self._get_new_lower_upper(other, self.intersect)
            return Interval(new_lower, newlower_value, new_upper_value, new_upper)
        else:
            return None
909367
def range_matches(self, other):
        
        return (
            self.begin == other.begin and 
            self.end == other.end
        )
563959
def overlap(self, other: 'Span'):
        """"""
        return not (
            # if one rectangle is left of other
            other.column_end <= self.column_start
            or self.column_end <= other.column_start
            # if one rectangle is above other
            or other.row_end <= self.row_start
            or self.row_end <= other.row_start
        )
549988
public void setRolloverCheckPeriod(long period)
  {
    if (period > 1000)
      _rolloverCheckPeriod = period;
    else if (period > 0)
      _rolloverCheckPeriod = 1000;
    
    if (DAY < _rolloverCheckPeriod) {
      log.info(this + " rollover-check-period "
               + _rolloverCheckPeriod + "ms is longer than 24h");
      
      _rolloverCheckPeriod = DAY;
    }
  }
620330
public boolean between(final Interval<C> that, final Interval<C> other) {
        checkNotNull(this.range, that.range);
        checkNotNull(other.range);
        return this.after(that) && this.before(other);
    }
330733
public static void validatePeriod(Duration period) {
		if(period.equals(Duration.ZERO)) {
			String message = "The period must be nonzero";
			throw new IllegalArgumentException(message);
		}
	}
1216022
def is_continuous(self):
        """"""
        if self._validated_a_period is True and \
                len(self.values) == len(self.header.analysis_period.months_int):
            return True
        else:
            return False
930857
def time_conflict(self, schedule):
        
        if is_nil(schedule):
            return True
        for timerange in self._excluded_times:
            if timerange.conflicts_with(schedule):
                return False
        return True
991983
public static boolean checkOverlap (Service s1, Service s2) {
        if (s1.calendar == null || s2.calendar == null) {
            return false;
        }
        // overlap exists if at least one day of week is shared by two calendars
        boolean overlappingDays = s1.calendar.monday == 1 && s2.calendar.monday == 1 ||
                s1.calendar.tuesday == 1 && s2.calendar.tuesday == 1 ||
                s1.calendar.wednesday == 1 && s2.calendar.wednesday == 1 ||
                s1.calendar.thursday == 1 && s2.calendar.thursday == 1 ||
                s1.calendar.friday == 1 && s2.calendar.friday == 1 ||
                s1.calendar.saturday == 1 && s2.calendar.saturday == 1 ||
                s1.calendar.sunday == 1 && s2.calendar.sunday == 1;
        return overlappingDays;
    }