Returns true if there are spans intersecting the given interval.
@param end must be strictly greater than start
488999
public boolean hasSpansIntersecting(int start, int end) {
        for (int i = 0; i < numberOfSpans; i++) {
            // equal test is valid since both intervals are not empty by construction
            if (spanStarts[i] >= end || spanEnds[i] <= start) continue;
            return true;
        }
        return false;
    }
48652
def intersection(self, other):
        
        startopen = other.startopen if self.start is None \
            else self.startopen if other.start is None \
            else other.startopen if self.start < other.start \
            else self.startopen if self.start > other.start \
            else (self.startopen or other.startopen)
        endopen = other.endopen if self.end is None \
            else self.endopen if other.end is None \
            else other.endopen if self.end > other.end \
            else self.endopen if self.end < other.end \
            else (self.endopen or other.endopen)

        new_start = self.start if other.start is None \
            else other.start if self.start is None \
            else max(self.start, other.start)
        new_end = self.end if other.end is None \
            else other.end if self.end is None \
            else min(self.end, other.end)

        interval = INTERVAL_LOOKUP[(startopen, endopen)]

        return DateRange(new_start, new_end, interval)
1070933
private boolean containsInterval(Interval i) {
        if (i != null) {
            return directedGraph.contains(i.getStart())
                    && directedGraph.contains(i.getFinish());
        } else {
            return false;
        }
    }
92453
public boolean intersect(Envelope2D other) {
		if (isEmpty() || other.isEmpty()) {
			setEmpty();
			return false;
		}

		if (other.xmin > xmin)
			xmin = other.xmin;

		if (other.xmax < xmax)
			xmax = other.xmax;

		if (other.ymin > ymin)
			ymin = other.ymin;

		if (other.ymax < ymax)
			ymax = other.ymax;

		boolean bIntersecting = xmin <= xmax && ymin <= ymax;

		if (!bIntersecting)
			setEmpty();

		return bIntersecting;
	}
201406
public Range intersection(final Range range) {
		int c0 = Math.max(this.start, range.start);
		int c1 = Math.min(this.end, range.end);
		return c0 <= c1 ? new Range(c0, c1) : null;
	}
123021
def within(self, other: "Interval", inclusive: bool = True) -> bool:
        
        if not other:
            return False
        if inclusive:
            return self.start >= other.start and self.end <= other.end
        else:
            return self.start > other.start and self.end < other.end
144844
def do_intersect(self, another_time_range):
        
        if self.begin_dt > another_time_range.end_dt or self.end_dt < \
                another_time_range.begin_dt:
            return False
        else:
            return True
47207
public static INDArrayIndex interval(int begin, int stride, int end, boolean inclusive) {
        Preconditions.checkArgument(begin <= end, "Beginning index (%s) in range must be less than or equal to end (%s)", begin, end);
        INDArrayIndex index = new IntervalIndex(inclusive, stride);
        index.init(begin, end);
        return index;
    }
34403
public static Range fromInterval(int start, int end) {
        if (start < 0) {
            throw new IllegalArgumentException("Range start must be >= 0: " + start);
        }
        if (end < 0) {
            throw new IllegalArgumentException("Range end must be >= 0: " + end);
        }
        if (end < start) {
            throw new IllegalArgumentException("Range end must be >= start: " + end + "<" + start);
        }
        return new Range(start, end - start);
    }
1339214
def is_date_ranges_intersection(t1start, t1end, t2start, t2end):
    
    return (t1start <= t2start <= t1end) or (t2start <= t1start <= t2end)
145612
def overlap(self, other):
        """"""
        if self._start < other.end and self._end > other.start:
            return True
        return False
976874
public static <E> boolean intersects(Set<E> s1, Set<E> s2) {
    // loop over whichever set is smaller
    if (s1.size() < s2.size()) {
      for (E element1 : s1) {
        if (s2.contains(element1)) {
          return true;
        }
      }
    } else {
      for (E element2 : s2) {
        if (s1.contains(element2)) {
          return true;
        }
      }
    }
    
    return false;
  }
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);
    }
100428
private boolean collectAndCheckLastSpans(int nextSpans1StartPosition,
      int nextSpans1EndPosition) throws IOException {
    // check next
    if (nextSpans1StartPosition == nextSpans2StartPosition
        && nextSpans1EndPosition == nextSpans2EndPosition) {
      return false;
    }
    // check last
    if (nextSpans1StartPosition == lastSpans2StartPosition
        && (nextSpans1EndPosition == lastSpans2EndPosition
            || lastSpans2EndPositions.contains(nextSpans1EndPosition))) {
      return false;
    }
    // collect
    if (nextSpans1StartPosition == nextSpans2StartPosition) {
      // reset
      if (nextSpans2StartPosition != lastSpans2StartPosition) {
        lastSpans2StartPosition = nextSpans2StartPosition;
        lastSpans2EndPosition = -1;
        lastSpans2EndPositions.clear();
      }
      while (nextSpans1StartPosition == nextSpans2StartPosition) {
        if (lastSpans2EndPosition > -1) {
          lastSpans2EndPositions.add(lastSpans2EndPosition);
        }
        lastSpans2EndPosition = nextSpans2EndPosition;
        nextSpans2StartPosition = spans2.spans.nextStartPosition();
        nextSpans2EndPosition = spans2.spans.endPosition();
        if (nextSpans1StartPosition == nextSpans2StartPosition
            && nextSpans1EndPosition == nextSpans2EndPosition) {
          return false;
        }
      }
    }

    return true;
  }
251474
def _check_boundaries(self, fragment):
        
        if not isinstance(fragment, SyncMapFragment):
            raise TypeError(u"fragment is not an instance of SyncMapFragment")
        interval = fragment.interval
        if not isinstance(interval, TimeInterval):
            raise TypeError(u"interval is not an instance of TimeInterval")
        if (self.begin is not None) and (interval.begin < self.begin):
            raise ValueError(u"interval.begin is before self.begin")
        if (self.end is not None) and (interval.end > self.end):
            raise ValueError(u"interval.end is after self.end")
179269
def intersectingInterval(self, start, end):
    
    # find all intervals in this node that intersect start and end
    l = []
    for x in self.data.starts:
      xStartsAfterInterval = (x.start > end and not self.openEnded) or \
                             (x.start >= end and self.openEnded)
      xEndsBeforeInterval = (x.end < start and not self.openEnded) or \
                            (x.end <= start and self.openEnded)
      if ((not xStartsAfterInterval) and (not xEndsBeforeInterval)):
        l.append(x)

    # process left subtree (if we have one) if the requested interval begins
    # before mid
    if self.left is not None and start <= self.data.mid:
      l += self.left.intersectingInterval(start, end)

    # process right subtree (if we have one) if the requested interval ends
    # after mid
    if self.right is not None and end >= self.data.mid:
      l += self.right.intersectingInterval(start, end)

    return l
612819
public boolean contains(int start, int end) {
        if (start < MIN_VALUE || start > MAX_VALUE) {
            throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(start, 6));
        }
        if (end < MIN_VALUE || end > MAX_VALUE) {
            throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(end, 6));
        }
        //int i = -1;
        //while (true) {
        //    if (start < list[++i]) break;
        //}
        int i = findCodePoint(start);
        return ((i & 1) != 0 && end < list[i]);
    }