Creates the list of existing intervals.
972277
private void createIntervalList(){
		synchronized(intervalLock){
			if (_cachedIntervalInfos!=null)
				return;
			List<Interval> intervals = intervalRegistry.getIntervals();
			_cachedIntervalInfos = new ArrayList<IntervalInfo>(intervals.size());
			for (Interval interval : intervals) {
				_cachedIntervalInfos.add(new IntervalInfo(interval));
				interval.addSecondaryIntervalListener(this);
			}
		}
	}
207740
def requested_intervals(self):
        
        with switch_db(WorkflowStatusModel, db_alias='hyperstream'):
            workflow_statuses = WorkflowStatusModel.objects(workflow_id=self.workflow_id)
            if len(workflow_statuses) == 1:
                return TimeIntervals(map(lambda x: TimeInterval(x.start, x.end),
                                         workflow_statuses[0].requested_intervals))
            else:
                return TimeIntervals([])
1325237
static TimingInterval merge(Iterable<TimingInterval> intervals, int maxSamples, long start)
    {
        ThreadLocalRandom rnd = ThreadLocalRandom.current();
        long operationCount = 0, partitionCount = 0, rowCount = 0, errorCount = 0;
        long maxLatency = 0, totalLatency = 0;
        List<SampleOfLongs> latencies = new ArrayList<>();
        long end = 0;
        long pauseStart = 0, pauseEnd = Long.MAX_VALUE;
        for (TimingInterval interval : intervals)
        {
            if (interval != null)
            {
                end = Math.max(end, interval.end);
                operationCount += interval.operationCount;
                maxLatency = Math.max(interval.maxLatency, maxLatency);
                totalLatency += interval.totalLatency;
                partitionCount += interval.partitionCount;
                rowCount += interval.rowCount;
                errorCount += interval.errorCount;
                latencies.addAll(Arrays.asList(interval.sample));
                if (interval.pauseLength > 0)
                {
                    pauseStart = Math.max(pauseStart, interval.pauseStart);
                    pauseEnd = Math.min(pauseEnd, interval.pauseStart + interval.pauseLength);
                }
            }
        }

        if (pauseEnd < pauseStart || pauseStart <= 0)
        {
            pauseEnd = pauseStart = 0;
        }

        return new TimingInterval(start, end, maxLatency, pauseStart, pauseEnd - pauseStart, partitionCount, rowCount,
                                  totalLatency, operationCount, errorCount, SampleOfLongs.merge(rnd, latencies, maxSamples));

    }
766341
def all_valid_time_intervals():
        '''
        
        '''
        return [PerformanceTimeInterval.DAY,
                PerformanceTimeInterval.WEEK,
                PerformanceTimeInterval.TWO_WEEKS,
                PerformanceTimeInterval.SIXTY_DAYS,
                PerformanceTimeInterval.NINETY_DAYS,
                PerformanceTimeInterval.ONE_YEAR]
1224351
protected List<Intervalable> checkForOverlaps(Intervalable interval, Direction direction)
    {

        List<Intervalable> overlaps = new ArrayList<Intervalable>();
        for (Intervalable currentInterval : this.intervals)
        {
            switch (direction)
            {
                case LEFT:
                    if (currentInterval.getStart() <= interval.getEnd())
                    {
                        overlaps.add(currentInterval);
                    }
                    break;
                case RIGHT:
                    if (currentInterval.getEnd() >= interval.getStart())
                    {
                        overlaps.add(currentInterval);
                    }
                    break;
            }
        }
        return overlaps;
    }
787952
def union_overlapping(intervals):
    """"""
    disjoint_intervals = []

    for interval in intervals:
        if disjoint_intervals and disjoint_intervals[-1].overlaps(interval):
            disjoint_intervals[-1] = disjoint_intervals[-1].union(interval)
        else:
            disjoint_intervals.append(interval)

    return disjoint_intervals
882322
function getIntervals(ctx) {
  return ctx._intervals || (ctx._parent ? getIntervals(ctx._parent) : new Intervals());
}
1268445
public S interval(Long interval) {
        builder.interval(String.valueOf(interval));
        return self;
    }
482950
def interval(best,lo=np.nan,hi=np.nan):
    
    return [float(best),[float(lo),float(hi)]]
959627
public List<Interval> filterIntervals(String columnId) {
        List<Interval> selected = columnSelectionMap.get(columnId);
        if (selected == null) {
            return new ArrayList<>();
        }
        return selected;
    }
348268
def intervals(graph):
    
    interval_graph = Graph()  # graph of intervals
    heads = [graph.entry]  # list of header nodes
    interv_heads = {}  # interv_heads[i] = interval of header i
    processed = {i: False for i in graph}
    edges = defaultdict(list)

    while heads:
        head = heads.pop(0)

        if not processed[head]:
            processed[head] = True
            interv_heads[head] = Interval(head)

            # Check if there is a node which has all its predecessor in the
            # current interval. If there is, add that node to the interval and
            # repeat until all the possible nodes have been added.
            change = True
            while change:
                change = False
                for node in graph.rpo[1:]:
                    if all(
                                    p in interv_heads[head] for p in graph.all_preds(node)):
                        change |= interv_heads[head].add_node(node)

            # At this stage, a node which is not in the interval, but has one
            # of its predecessor in it, is the header of another interval. So
            # we add all such nodes to the header list.
            for node in graph:
                if node not in interv_heads[head] and node not in heads:
                    if any(
                                    p in interv_heads[head] for p in graph.all_preds(node)):
                        edges[interv_heads[head]].append(node)
                        assert (node not in heads)
                        heads.append(node)

            interval_graph.add_node(interv_heads[head])
            interv_heads[head].compute_end(graph)

    # Edges is a mapping of 'Interval -> [header nodes of interval successors]'
    for interval, heads in edges.items():
        for head in heads:
            interval_graph.add_edge(interval, interv_heads[head])

    interval_graph.entry = graph.entry.interval
    if graph.exit:
        interval_graph.exit = graph.exit.interval

    return interval_graph, interv_heads
252145
def validate_intervals(intervals):
    

    # Validate interval shape
    if intervals.ndim != 2 or intervals.shape[1] != 2:
        raise ValueError('Intervals should be n-by-2 numpy ndarray, '
                         'but shape={}'.format(intervals.shape))

    # Make sure no times are negative
    if (intervals < 0).any():
        raise ValueError('Negative interval times found')

    # Make sure all intervals have strictly positive duration
    if (intervals[:, 1] <= intervals[:, 0]).any():
        raise ValueError('All interval durations must be strictly positive')
188660
def copy(self):
        """"""
        return Interval(self._lower, self._lower_value, self._upper_value, self._upper)
25715
def _find_intervals(bundles, duration, step):
    """"""
    segments = []
    for bund in bundles:
        beg, end = bund['times'][0][0], bund['times'][-1][1]

        if end - beg >= duration:
            new_begs = arange(beg, end - duration, step)

            for t in new_begs:
                seg = bund.copy()
                seg['times'] = [(t, t + duration)]
                segments.append(seg)

    return segments
442157
def cut(self, times: Union[datetime.datetime,
                               List[datetime.datetime]]) -> List["Interval"]:
        
        if not isinstance(times, list):
            # Single time
            time = times
            if not self.contains(time):
                return []
            return [
                Interval(self.start, time),
                Interval(time, self.end)
            ]
        else:
            # Multiple times
            times = [t for t in times if self.contains(t)]  # discard others
            times.sort()
            times = [self.start] + times + [self.end]
            intervals = []
            for i in range(len(times) - 1):
                intervals.append(Interval(times[i], times[i + 1]))
            return intervals
850550
def _interval(dates):
        """"""
        interval = (dates[1] - dates[0]).days
        last = dates[0]
        for dat in dates[1:]:
            if (dat - last).days != interval:
                return 0
            last = dat
        return interval
1353879
@SuppressWarnings({"rawtypes", "unchecked"})
    public static List<Interval<?>> complement(List<Interval> intervals) throws MIDDException {

        final Interval w = new Interval(new EndPoint(EndPoint.Infinity.NEGATIVE), new EndPoint(EndPoint.Infinity.POSITIVE));
        List<Interval<?>> op1 = new ArrayList<>();
        op1.add(w);

        for (Interval op2 : intervals) {
            final List<Interval<?>> result = new ArrayList<>();

            for (Interval item : op1) {
                if (item.isIntersec(op2)) {
                    final List<Interval<?>> l = item.complement(op2);
                    if (!l.isEmpty()) {
                        result.addAll(l);
                    }
                } else {
                    result.add(item);
                }
            }
            op1 = result;
        }
        return ImmutableList.copyOf(op1);
    }