Returns true if the difference between the event versions impacts repetitions and occurrences.
497339
public function requireOccurrenceRegeneration($repetitions1, $repetitions2)
    {
        if (count($repetitions1) != count($repetitions2)) {
            return true;
        }

        $comparator = new Comparator();

        for ($i = 0; $i < count($repetitions1); $i++) {
            if (!$comparator->areEqual($repetitions1[$i]->getRepetitionObject(), $repetitions2[$i]->getRepetitionObject())) {
                return true;
            }
        }

        return false;
    }
858076
function isSoftNewlineEvent(event: Object): boolean {
  return (
    event.which === 13 &&
    (event.getModifierState('Shift') ||
      event.getModifierState('Alt') ||
      event.getModifierState('Control'))
  );
}
562138
public boolean isNewerThan(VersionComparator comparator) {
        if (this.major > comparator.getMajor()) {
            return true;
        }  else if (this.major == comparator.getMajor() && this.minor > comparator.getMinor()) {
            return true;
        } else if (this.major == comparator.getMajor() && this.minor == comparator.getMinor() && this.revision > comparator.getRevision()) {
            return true;
        } else if (this.major == comparator.getMajor() && this.minor == comparator.getMinor() && this.revision == comparator.getRevision() && this.prereleaseNumber > comparator.getPrereleaseNumber()) {
            return true;
        }
        return false;
    }
1272737
function versionGreaterThan (version1, version2) {
      if (version1 === version2) return false;
      if (version1 === -1) return version2;
      if (version2 === -1) return version1;

      if (version1.indexOf('.') === -1 && version2.indexOf('.') === -1) {
        return version1 > version2;
      }

      // The versions have multiple components (i.e. 0.10.30) and
      // must be compared piecewise.
      // Note: I'm ignoring the case where one version has multiple
      // components and the other doesn't.
      var v1 = version1.split('.'),
          v2 = version2.split('.'),
          versionLength = (v1.length > v2.length ? v2 : v1).length;


      for (var i = 0; i < versionLength; ++i) {
        if (parseInt(v1[i], 10) > parseInt(v2[i], 10)) {
          return true;
        }
      }

      // Special case, v1 has extra components but the initial components
      // were identical, we assume this means newer but it might also mean
      // that someone changed versioning systems.
      if (i < v1.length) {
        return true;
      }

      return false;
    }
755906
def is_different(old_value, new_value):
    """"""
    if opt.has_numpy:
        return not opt.np.array_equal(old_value, new_value)
    else:
        return old_value != new_value
1179788
def _occursOn(self, myDate):
        
        # TODO analyse which is faster (rrule or db) and test that first
        if myDate not in self.repeat:
            return False
        if CancellationPage.events.child_of(self)                            \
                           .filter(except_date=myDate).exists():
            return False
        return True
1156279
def is_ignored(self, event):
        
        for each in self._ignored:
            if event.name == each:
                return True
        return False
1038660
def is_faulty(self, event):
        
        for each in self._faults:
            if each.name.upper() == event.name.upper():
                return True
        return False
781641
public function isDuplicate($pspReference, $event, $success)
    {
        $success = (trim($success) == "true") ? true : false;
        $result = $this->getResource()->getEvent(trim($pspReference), trim($event), $success);
        return (empty($result)) ? false : true;
    }
977501
public boolean isUpdateForVersionCode() {
		Set<Integer> uniques = new HashSet<Integer>();
		for (VersionHistoryItem item : versionHistoryItems) {
			uniques.add(item.getVersionCode());
		}
		return uniques.size() > 1;
	}
638942
protected function processRecurrences()
    {
        $events = (isset($this->cal['VEVENT'])) ? $this->cal['VEVENT'] : array();

        $recurrenceEvents    = array();
        $allRecurrenceEvents = array();

        if (!empty($events)) {
            foreach ($events as $anEvent) {
                if (isset($anEvent['RRULE']) && $anEvent['RRULE'] !== '') {
                    // Tag as generated by a recurrence rule
                    $anEvent['RRULE_array'][2] = self::RECURRENCE_EVENT;

                    $countNb = 0;

                    $initialStart             = new \DateTime($anEvent['DTSTART_array'][1]);
                    $initialStartTimeZoneName = $initialStart->getTimezone()->getName();

                    if (isset($anEvent['DTEND'])) {
                        $initialEnd             = new \DateTime($anEvent['DTEND_array'][1]);
                        $initialEndTimeZoneName = $initialEnd->getTimezone()->getName();
                    } else {
                        $initialEndTimeZoneName = $initialStartTimeZoneName;
                    }

                    // Recurring event, parse RRULE and add appropriate duplicate events
                    $rrules = array();
                    $rruleStrings = explode(';', $anEvent['RRULE']);

                    foreach ($rruleStrings as $s) {
                        list($k, $v) = explode('=', $s);
                        $rrules[$k] = $v;
                    }

                    // Get frequency
                    $frequency = $rrules['FREQ'];
                    // Get Start timestamp
                    $startTimestamp = $initialStart->getTimestamp();

                    if (isset($anEvent['DTEND'])) {
                        $endTimestamp = $initialEnd->getTimestamp();
                    } elseif (isset($anEvent['DURATION'])) {
                        $duration = end($anEvent['DURATION_array']);
                        $endTimestamp = $this->parseDuration($anEvent['DTSTART'], $duration);
                    } else {
                        $endTimestamp = $anEvent['DTSTART_array'][2];
                    }

                    $eventTimestampOffset = $endTimestamp - $startTimestamp;
                    // Get Interval
                    $interval = (isset($rrules['INTERVAL']) && $rrules['INTERVAL'] !== '') ? $rrules['INTERVAL'] : 1;

                    $dayNumber = null;
                    $weekday   = null;

                    if (in_array($frequency, array('MONTHLY', 'YEARLY')) && isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
                        // Deal with BYDAY
                        $byDay     = $rrules['BYDAY'];
                        $dayNumber = intval($byDay);

                        if (empty($dayNumber)) { // Returns 0 when no number defined in BYDAY
                            if (!isset($rrules['BYSETPOS'])) {
                                $dayNumber = 1; // Set first as default
                            } elseif (is_numeric($rrules['BYSETPOS'])) {
                                $dayNumber = $rrules['BYSETPOS'];
                            }
                        }

                        $weekday = substr($byDay, -2);
                    }

                    if (is_int($this->defaultSpan)) {
                        $untilDefault = date_create('now');
                        $untilDefault->modify($this->defaultSpan . ' year');
                        $untilDefault->setTime(23, 59, 59); // End of the day
                    } else {
                        trigger_error('ICal::defaultSpan: User defined value is not an integer', E_USER_NOTICE);
                    }

                    // Compute EXDATEs
                    $exdates = $this->parseExdates($anEvent);

                    $countOrig = null;

                    if (isset($rrules['UNTIL'])) {
                        // Get Until
                        $until = strtotime($rrules['UNTIL']);
                    } elseif (isset($rrules['COUNT'])) {
                        $countOrig = (is_numeric($rrules['COUNT']) && $rrules['COUNT'] > 1) ? $rrules['COUNT'] : 0;

                        // Increment count by the number of excluded dates
                        $countOrig += sizeof($exdates);

                        // Remove one to exclude the occurrence that initialises the rule
                        $count = ($countOrig - 1);

                        if ($interval >= 2) {
                            $count += ($count > 0) ? ($count * $interval) : 0;
                        }

                        $countNb = 1;
                        $offset  = "+{$count} " . $this->frequencyConversion[$frequency];
                        $until   = strtotime($offset, $startTimestamp);

                        if (in_array($frequency, array('MONTHLY', 'YEARLY'))
                            && isset($rrules['BYDAY']) && $rrules['BYDAY'] !== ''
                        ) {
                            $dtstart = date_create($anEvent['DTSTART']);

                            if (!$dtstart) {
                                continue;
                            }

                            for ($i = 1; $i <= $count; $i++) {
                                $dtstartClone = clone $dtstart;
                                $dtstartClone->modify('next ' . $this->frequencyConversion[$frequency]);
                                $offset = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $dtstartClone)} {$this->weekdays[$weekday]} of " . $dtstartClone->format('F Y H:i:01');
                                $dtstart->modify($offset);
                            }

                            // Jumping X months forwards doesn't mean
                            // the end date will fall on the same day defined in BYDAY
                            // Use the largest of these to ensure we are going far enough
                            // in the future to capture our final end day
                            $until = max($until, $dtstart->format(self::UNIX_FORMAT));
                        }

                        unset($offset);
                    } elseif (isset($untilDefault)) {
                        $until = $untilDefault->getTimestamp();
                    }

                    $until = intval($until);

                    // Decide how often to add events and do so
                    switch ($frequency) {
                        case 'DAILY':
                            // Simply add a new event each interval of days until UNTIL is reached
                            $offset = "+{$interval} day";
                            $recurringTimestamp = strtotime($offset, $startTimestamp);

                            while ($recurringTimestamp <= $until) {
                                $dayRecurringTimestamp = $recurringTimestamp;

                                // Adjust time zone from initial event
                                $dayRecurringOffset = 0;
                                if ($this->useTimeZoneWithRRules) {
                                    $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $dayRecurringTimestamp);
                                    $recurringTimeZone->setTimezone($initialStart->getTimezone());
                                    $dayRecurringOffset = $recurringTimeZone->getOffset();
                                    $dayRecurringTimestamp += $dayRecurringOffset;
                                }

                                // Add event
                                $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $dayRecurringTimestamp) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '');
                                $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
                                $anEvent['DTSTART_array'][2] = $dayRecurringTimestamp;
                                $anEvent['DTEND_array']      = $anEvent['DTSTART_array'];
                                $anEvent['DTEND_array'][2]  += $eventTimestampOffset;
                                $anEvent['DTEND'] = date(
                                    self::DATE_TIME_FORMAT,
                                    $anEvent['DTEND_array'][2]
                                ) . (($initialEndTimeZoneName === 'Z') ? 'Z' : '');
                                $anEvent['DTEND_array'][1] = $anEvent['DTEND'];

                                // Exclusions
                                $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $dayRecurringOffset) {
                                    return self::isExdateMatch($exdate, $anEvent, $dayRecurringOffset);
                                });

                                if (isset($anEvent['UID'])) {
                                    $searchDate = $anEvent['DTSTART'];
                                    if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
                                        $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
                                    }

                                    if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                        $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
                                        if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                            $isExcluded = true;
                                        }
                                    }
                                }

                                if (!$isExcluded) {
                                    $anEvent            = $this->processEventIcalDateTime($anEvent);
                                    $recurrenceEvents[] = $anEvent;
                                    $this->eventCount++;

                                    // If RRULE[COUNT] is reached then break
                                    if (isset($rrules['COUNT'])) {
                                        $countNb++;

                                        if ($countNb >= $countOrig) {
                                            break;
                                        }
                                    }
                                }

                                // Move forwards
                                $recurringTimestamp = strtotime($offset, $recurringTimestamp);
                            }

                            $recurrenceEvents    = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
                            $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
                            $recurrenceEvents    = array(); // Reset
                            break;

                        case 'WEEKLY':
                            // Create offset
                            $offset = "+{$interval} week";

                            $wkst  = (isset($rrules['WKST']) && in_array($rrules['WKST'], array('SA', 'SU', 'MO'))) ? $rrules['WKST'] : $this->defaultWeekStart;
                            $aWeek = $this->weeks[$wkst];
                            $days  = array('SA' => 'Saturday', 'SU' => 'Sunday', 'MO' => 'Monday');

                            // Build list of days of week to add events
                            $weekdays = $aWeek;

                            if (isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
                                $byDays = explode(',', $rrules['BYDAY']);
                            } else {
                                // A textual representation of a day, two letters (e.g. SU)
                                $byDays = array(mb_substr(strtoupper($initialStart->format('D')), 0, 2));
                            }

                            // Get timestamp of first day of start week
                            $weekRecurringTimestamp = (strcasecmp($initialStart->format('l'), $this->weekdays[$wkst]) === 0)
                                ? $startTimestamp
                                : strtotime("last {$days[$wkst]} " . $initialStart->format('H:i:s'), $startTimestamp);

                            // Step through weeks
                            while ($weekRecurringTimestamp <= $until) {
                                $dayRecurringTimestamp = $weekRecurringTimestamp;

                                // Adjust time zone from initial event
                                $dayRecurringOffset = 0;
                                if ($this->useTimeZoneWithRRules) {
                                    $dayRecurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $dayRecurringTimestamp);
                                    $dayRecurringTimeZone->setTimezone($initialStart->getTimezone());
                                    $dayRecurringOffset = $dayRecurringTimeZone->getOffset();
                                    $dayRecurringTimestamp += $dayRecurringOffset;
                                }

                                foreach ($weekdays as $day) {
                                    // Check if day should be added
                                    if (in_array($day, $byDays) && $dayRecurringTimestamp > $startTimestamp
                                        && $dayRecurringTimestamp <= $until
                                    ) {
                                        // Add event
                                        $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $dayRecurringTimestamp) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '');
                                        $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
                                        $anEvent['DTSTART_array'][2] = $dayRecurringTimestamp;
                                        $anEvent['DTEND_array']      = $anEvent['DTSTART_array'];
                                        $anEvent['DTEND_array'][2]  += $eventTimestampOffset;
                                        $anEvent['DTEND'] = date(
                                            self::DATE_TIME_FORMAT,
                                            $anEvent['DTEND_array'][2]
                                        ) . (($initialEndTimeZoneName === 'Z') ? 'Z' : '');
                                        $anEvent['DTEND_array'][1] = $anEvent['DTEND'];

                                        // Exclusions
                                        $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $dayRecurringOffset) {
                                            return self::isExdateMatch($exdate, $anEvent, $dayRecurringOffset);
                                        });

                                        if (isset($anEvent['UID'])) {
                                            $searchDate = $anEvent['DTSTART'];
                                            if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
                                                $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
                                            }

                                            if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
                                                if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                    $isExcluded = true;
                                                }
                                            }
                                        }

                                        if (!$isExcluded) {
                                            $anEvent            = $this->processEventIcalDateTime($anEvent);
                                            $recurrenceEvents[] = $anEvent;
                                            $this->eventCount++;

                                            // If RRULE[COUNT] is reached then break
                                            if (isset($rrules['COUNT'])) {
                                                $countNb++;

                                                if ($countNb >= $countOrig) {
                                                    break 2;
                                                }
                                            }
                                        }
                                    }

                                    // Move forwards a day
                                    $dayRecurringTimestamp = strtotime('+1 day', $dayRecurringTimestamp);
                                }

                                // Move forwards $interval weeks
                                $weekRecurringTimestamp = strtotime($offset, $weekRecurringTimestamp);
                            }

                            $recurrenceEvents    = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
                            $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
                            $recurrenceEvents    = array(); // Reset
                            break;

                        case 'MONTHLY':
                            // Create offset
                            $recurringTimestamp = $startTimestamp;
                            $offset = "+{$interval} month";

                            if (isset($rrules['BYMONTHDAY']) && $rrules['BYMONTHDAY'] !== '') {
                                // Deal with BYMONTHDAY
                                $monthdays = explode(',', $rrules['BYMONTHDAY']);

                                while ($recurringTimestamp <= $until) {
                                    foreach ($monthdays as $key => $monthday) {
                                        $monthRecurringTimestamp = null;

                                        if ($key === 0) {
                                            // Ensure original event conforms to monthday rule
                                            $anEvent['DTSTART'] = gmdate(
                                                'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
                                                strtotime($anEvent['DTSTART'])
                                            ) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '');

                                            $anEvent['DTEND'] = gmdate(
                                                'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
                                                isset($anEvent['DURATION'])
                                                        ? $this->parseDuration($anEvent['DTSTART'], end($anEvent['DURATION_array']))
                                                        : strtotime($anEvent['DTEND'])
                                            ) . (($initialEndTimeZoneName === 'Z') ? 'Z' : '');

                                            $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
                                            $anEvent['DTSTART_array'][2] = $this->iCalDateToUnixTimestamp($anEvent['DTSTART']);
                                            $anEvent['DTEND_array'][1]   = $anEvent['DTEND'];
                                            $anEvent['DTEND_array'][2]   = $this->iCalDateToUnixTimestamp($anEvent['DTEND']);

                                            // Ensure recurring timestamp confirms to BYMONTHDAY rule
                                            $monthRecurringTimestamp = $this->iCalDateToUnixTimestamp(
                                                gmdate(
                                                    'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
                                                    $recurringTimestamp
                                                ) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '')
                                            );
                                        }

                                        // Adjust time zone from initial event
                                        $monthRecurringOffset = 0;
                                        if ($this->useTimeZoneWithRRules) {
                                            $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $monthRecurringTimestamp);
                                            $recurringTimeZone->setTimezone($initialStart->getTimezone());
                                            $monthRecurringOffset = $recurringTimeZone->getOffset();
                                            $monthRecurringTimestamp += $monthRecurringOffset;
                                        }

                                        if (($monthRecurringTimestamp > $startTimestamp) && ($monthRecurringTimestamp <= $until)) {
                                            // Add event
                                            $anEvent['DTSTART'] = date(
                                                'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
                                                $monthRecurringTimestamp
                                            ) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '');
                                            $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
                                            $anEvent['DTSTART_array'][2] = $monthRecurringTimestamp;
                                            $anEvent['DTEND_array']      = $anEvent['DTSTART_array'];
                                            $anEvent['DTEND_array'][2]  += $eventTimestampOffset;
                                            $anEvent['DTEND'] = date(
                                                self::DATE_TIME_FORMAT,
                                                $anEvent['DTEND_array'][2]
                                            ) . (($initialEndTimeZoneName === 'Z') ? 'Z' : '');
                                            $anEvent['DTEND_array'][1] = $anEvent['DTEND'];

                                            // Exclusions
                                            $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $monthRecurringOffset) {
                                                return self::isExdateMatch($exdate, $anEvent, $monthRecurringOffset);
                                            });

                                            if (isset($anEvent['UID'])) {
                                                $searchDate = $anEvent['DTSTART'];
                                                if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
                                                    $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
                                                }

                                                if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                    $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
                                                    if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                        $isExcluded = true;
                                                    }
                                                }
                                            }

                                            if (!$isExcluded) {
                                                $anEvent = $this->processEventIcalDateTime($anEvent);
                                                $recurrenceEvents[] = $anEvent;
                                                $this->eventCount++;

                                                // If RRULE[COUNT] is reached then break
                                                if (isset($rrules['COUNT'])) {
                                                    $countNb++;

                                                    if ($countNb >= $countOrig) {
                                                        break 2;
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    // Move forwards
                                    $recurringTimestamp = strtotime($offset, $recurringTimestamp);
                                }
                            } elseif (isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
                                while ($recurringTimestamp <= $until) {
                                    $monthRecurringTimestamp = $recurringTimestamp;

                                    // Adjust time zone from initial event
                                    $monthRecurringOffset = 0;

                                    if ($this->useTimeZoneWithRRules) {
                                        $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $monthRecurringTimestamp);
                                        $recurringTimeZone->setTimezone($initialStart->getTimezone());
                                        $monthRecurringOffset = $recurringTimeZone->getOffset();
                                        $monthRecurringTimestamp += $monthRecurringOffset;
                                    }

                                    $eventStartDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $monthRecurringTimestamp)} {$this->weekdays[$weekday]} of "
                                        . date(self::DATE_TIME_FORMAT_PRETTY, $monthRecurringTimestamp);
                                    $eventStartTimestamp = strtotime($eventStartDesc);

                                    if (intval($rrules['BYDAY']) === 0) {
                                        $lastDayDesc = "last {$this->weekdays[$weekday]} of "
                                            . date(self::DATE_TIME_FORMAT_PRETTY, $monthRecurringTimestamp);
                                    } else {
                                        $lastDayDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $monthRecurringTimestamp)} {$this->weekdays[$weekday]} of "
                                            . date(self::DATE_TIME_FORMAT_PRETTY, $monthRecurringTimestamp);
                                    }

                                    $lastDayTimestamp = strtotime($lastDayDesc);

                                    do {
                                        // Prevent 5th day of a month from showing up on the next month
                                        // If BYDAY and the event falls outside the current month, skip the event

                                        $compareCurrentMonth = date('F', $monthRecurringTimestamp);
                                        $compareEventMonth   = date('F', $eventStartTimestamp);

                                        if ($compareCurrentMonth !== $compareEventMonth) {
                                            $monthRecurringTimestamp = strtotime($offset, $monthRecurringTimestamp);
                                            continue;
                                        }

                                        if ($eventStartTimestamp > $startTimestamp && $eventStartTimestamp <= $until) {
                                            $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $eventStartTimestamp) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '');
                                            $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
                                            $anEvent['DTSTART_array'][2] = $eventStartTimestamp;
                                            $anEvent['DTEND_array']      = $anEvent['DTSTART_array'];
                                            $anEvent['DTEND_array'][2]  += $eventTimestampOffset;
                                            $anEvent['DTEND'] = date(
                                                self::DATE_TIME_FORMAT,
                                                $anEvent['DTEND_array'][2]
                                            ) . (($initialEndTimeZoneName === 'Z') ? 'Z' : '');
                                            $anEvent['DTEND_array'][1] = $anEvent['DTEND'];

                                            // Exclusions
                                            $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $monthRecurringOffset) {
                                                return self::isExdateMatch($exdate, $anEvent, $monthRecurringOffset);
                                            });

                                            if (isset($anEvent['UID'])) {
                                                $searchDate = $anEvent['DTSTART'];
                                                if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
                                                    $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
                                                }

                                                if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                    $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
                                                    if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                        $isExcluded = true;
                                                    }
                                                }
                                            }

                                            if (!$isExcluded) {
                                                $anEvent            = $this->processEventIcalDateTime($anEvent);
                                                $recurrenceEvents[] = $anEvent;
                                                $this->eventCount++;

                                                // If RRULE[COUNT] is reached then break
                                                if (isset($rrules['COUNT'])) {
                                                    $countNb++;

                                                    if ($countNb >= $countOrig) {
                                                        break 2;
                                                    }
                                                }
                                            }
                                        }

                                        if (isset($rrules['BYSETPOS'])) {
                                            // BYSETPOS is defined so skip
                                            // looping through each week
                                            $lastDayTimestamp = $eventStartTimestamp;
                                        }

                                        $eventStartTimestamp += self::SECONDS_IN_A_WEEK;
                                    } while ($eventStartTimestamp <= $lastDayTimestamp);

                                    // Move forwards
                                    $recurringTimestamp = strtotime($offset, $recurringTimestamp);
                                }
                            }

                            $recurrenceEvents    = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
                            $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
                            $recurrenceEvents    = array(); // Reset
                            break;

                        case 'YEARLY':
                            // Create offset
                            $recurringTimestamp = $startTimestamp;
                            $offset = "+{$interval} year";

                            // Deal with BYMONTH
                            if (isset($rrules['BYMONTH']) && $rrules['BYMONTH'] !== '') {
                                $bymonths = explode(',', $rrules['BYMONTH']);
                            } else {
                                $bymonths = array();
                            }

                            // Check if BYDAY rule exists
                            if (isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
                                while ($recurringTimestamp <= $until) {
                                    $yearRecurringTimestamp = $recurringTimestamp;

                                    // Adjust time zone from initial event
                                    $yearRecurringOffset = 0;

                                    if ($this->useTimeZoneWithRRules) {
                                        $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $yearRecurringTimestamp);
                                        $recurringTimeZone->setTimezone($initialStart->getTimezone());
                                        $yearRecurringOffset = $recurringTimeZone->getOffset();
                                        $yearRecurringTimestamp += $yearRecurringOffset;
                                    }

                                    foreach ($bymonths as $bymonth) {
                                        $eventStartDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $yearRecurringTimestamp)} {$this->weekdays[$weekday]}"
                                            . " of {$this->monthNames[$bymonth]} "
                                            . gmdate('Y H:i:s', $yearRecurringTimestamp);
                                        $eventStartTimestamp = strtotime($eventStartDesc);

                                        if (intval($rrules['BYDAY']) === 0) {
                                            $lastDayDesc = "last {$this->weekdays[$weekday]}"
                                                . " of {$this->monthNames[$bymonth]} "
                                                . gmdate('Y H:i:s', $yearRecurringTimestamp);
                                        } else {
                                            $lastDayDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $yearRecurringTimestamp)} {$this->weekdays[$weekday]}"
                                                . " of {$this->monthNames[$bymonth]} "
                                                . gmdate('Y H:i:s', $yearRecurringTimestamp);
                                        }

                                        $lastDayTimestamp = strtotime($lastDayDesc);

                                        do {
                                            if ($eventStartTimestamp > $startTimestamp && $eventStartTimestamp <= $until) {
                                                $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $eventStartTimestamp) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '');
                                                $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
                                                $anEvent['DTSTART_array'][2] = $eventStartTimestamp;
                                                $anEvent['DTEND_array']      = $anEvent['DTSTART_array'];
                                                $anEvent['DTEND_array'][2]  += $eventTimestampOffset;
                                                $anEvent['DTEND'] = date(
                                                    self::DATE_TIME_FORMAT,
                                                    $anEvent['DTEND_array'][2]
                                                ) . (($initialEndTimeZoneName === 'Z') ? 'Z' : '');
                                                $anEvent['DTEND_array'][1] = $anEvent['DTEND'];

                                                // Exclusions
                                                $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $yearRecurringOffset) {
                                                    return self::isExdateMatch($exdate, $anEvent, $yearRecurringOffset);
                                                });

                                                if (isset($anEvent['UID'])) {
                                                    $searchDate = $anEvent['DTSTART'];
                                                    if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
                                                        $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
                                                    }

                                                    if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                        $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
                                                        if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                            $isExcluded = true;
                                                        }
                                                    }
                                                }

                                                if (!$isExcluded) {
                                                    $anEvent            = $this->processEventIcalDateTime($anEvent);
                                                    $recurrenceEvents[] = $anEvent;
                                                    $this->eventCount++;

                                                    // If RRULE[COUNT] is reached then break
                                                    if (isset($rrules['COUNT'])) {
                                                        $countNb++;

                                                        if ($countNb >= $countOrig) {
                                                            break 3;
                                                        }
                                                    }
                                                }
                                            }

                                            $eventStartTimestamp += self::SECONDS_IN_A_WEEK;
                                        } while ($eventStartTimestamp <= $lastDayTimestamp);
                                    }

                                    // Move forwards
                                    $recurringTimestamp = strtotime($offset, $recurringTimestamp);
                                }
                            } else {
                                $day = $initialStart->format('d');

                                // Step through years
                                while ($recurringTimestamp <= $until) {
                                    $yearRecurringTimestamp = $recurringTimestamp;

                                    // Adjust time zone from initial event
                                    $yearRecurringOffset = 0;
                                    if ($this->useTimeZoneWithRRules) {
                                        $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $yearRecurringTimestamp);
                                        $recurringTimeZone->setTimezone($initialStart->getTimezone());
                                        $yearRecurringOffset = $recurringTimeZone->getOffset();
                                        $yearRecurringTimestamp += $yearRecurringOffset;
                                    }

                                    $eventStartDescs = array();
                                    if (isset($rrules['BYMONTH']) && $rrules['BYMONTH'] !== '') {
                                        foreach ($bymonths as $bymonth) {
                                            array_push($eventStartDescs, "{$day} {$this->monthNames[$bymonth]} " . gmdate('Y H:i:s', $yearRecurringTimestamp));
                                        }
                                    } else {
                                        array_push($eventStartDescs, $day . gmdate(self::DATE_TIME_FORMAT_PRETTY, $yearRecurringTimestamp));
                                    }

                                    foreach ($eventStartDescs as $eventStartDesc) {
                                        $eventStartTimestamp = strtotime($eventStartDesc);

                                        if ($eventStartTimestamp > $startTimestamp && $eventStartTimestamp <= $until) {
                                            $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $eventStartTimestamp) . (($initialStartTimeZoneName === 'Z') ? 'Z' : '');
                                            $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
                                            $anEvent['DTSTART_array'][2] = $eventStartTimestamp;
                                            $anEvent['DTEND_array']      = $anEvent['DTSTART_array'];
                                            $anEvent['DTEND_array'][2]  += $eventTimestampOffset;
                                            $anEvent['DTEND'] = date(
                                                self::DATE_TIME_FORMAT,
                                                $anEvent['DTEND_array'][2]
                                            ) . (($initialEndTimeZoneName === 'Z') ? 'Z' : '');
                                            $anEvent['DTEND_array'][1] = $anEvent['DTEND'];

                                            // Exclusions
                                            $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $yearRecurringOffset) {
                                                return self::isExdateMatch($exdate, $anEvent, $yearRecurringOffset);
                                            });

                                            if (isset($anEvent['UID'])) {
                                                $searchDate = $anEvent['DTSTART'];
                                                if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
                                                    $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
                                                }

                                                if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                    $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
                                                    if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
                                                        $isExcluded = true;
                                                    }
                                                }
                                            }

                                            if (!$isExcluded) {
                                                $anEvent            = $this->processEventIcalDateTime($anEvent);
                                                $recurrenceEvents[] = $anEvent;
                                                $this->eventCount++;

                                                // If RRULE[COUNT] is reached then break
                                                if (isset($rrules['COUNT'])) {
                                                    $countNb++;

                                                    if ($countNb >= $countOrig) {
                                                        break 2;
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    // Move forwards
                                    $recurringTimestamp = strtotime($offset, $recurringTimestamp);
                                }
                            }

                            $recurrenceEvents    = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
                            $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
                            $recurrenceEvents    = array(); // Reset
                            break;
                    }
                }
            }

            $events = array_merge($events, $allRecurrenceEvents);

            $this->cal['VEVENT'] = $events;
        }
    }
489709
static boolean isChanged(Collection<RedisNodeDescription> o1, Collection<RedisNodeDescription> o2) {

        if (o1.size() != o2.size()) {
            return true;
        }

        for (RedisNodeDescription base : o2) {
            if (!essentiallyEqualsTo(base, findNodeByUri(o1, base.getUri()))) {
                return true;
            }
        }

        return false;
    }
577790
private boolean isApplicable(QueryCacheEventData event) {
        if (!getInfo().isPublishable()) {
            return false;
        }

        final int partitionId = event.getPartitionId();

        if (isEndEvent(event)) {
            sequenceProvider.reset(partitionId);
            removeFromBrokenSequences(event);
            return false;
        }

        if (isNextEvent(event)) {
            long currentSequence = sequenceProvider.getSequence(partitionId);
            sequenceProvider.compareAndSetSequence(currentSequence, event.getSequence(), partitionId);

            removeFromBrokenSequences(event);
            return true;
        }

        handleUnexpectedEvent(event);

        return false;
    }
424160
def detect_event_conflict!(event_name, method_name = event_name)
      if method_already_implemented?(method_name)
        raise FiniteMachine::AlreadyDefinedError, EVENT_CONFLICT_MESSAGE % {
          name: event_name,
          type: :instance,
          method: method_name,
          source: 'FiniteMachine'
        }
      end
    end
152353
static boolean hasMoreApplicationEvents(List<TraceEvent> events, int index)
   {
      if (index < 0 || index >= events.size())
         return false;

      for (int j = index; j < events.size(); j++)
      {
         TraceEvent te = events.get(j);
         if (te.getType() == TraceEvent.GET_CONNECTION ||
             te.getType() == TraceEvent.RETURN_CONNECTION)
            return true;
      }

      return false;
   }
380343
function(){
       var i; 
       for (i = 0; i < this._events.length; i++) {
           var evt = this._events[i];
           if (evt.eventType === "WorkflowExecutionCancelRequested") {
               return true;
           }
       }
       return false;

   }
158977
public boolean isForeignKeyChanged() {
        return CollectionUtils.exists(differences.values(), new Predicate() {
            @Override
            public boolean evaluate(Object object) {
                return ((ModelDiffEntry) object).isForeignKey();
            }
        });
    }