Checks whether the CodeReplacements have any overlap. The replacements must be provided in
order sorted by start position, as sorted by ORDER_CODE_REPLACEMENTS.
337013
private static boolean containsOverlaps(List<CodeReplacement> replacements) {
    checkState(ORDER_CODE_REPLACEMENTS.isOrdered(replacements));
    int start = -1;
    for (CodeReplacement replacement : replacements) {
      if (replacement.getStartPosition() < start) {
        return true;
      }
      start = Math.max(start, replacement.getEndPosition());
    }
    return false;
  }
1241742
private int compareToErrStackLines(List<StackLine> stackLines, List<StackLine> errStackLines) {
        if (errStackLines == null || errStackLines.size() == 0) {
            return -1; // already executed
        }
        if (stackLines.size() == 0) {
            throw new IllegalArgumentException("empty stackLine");
        }

        for (int i = 0; i < stackLines.size(); i++) {
            if (i >= errStackLines.size()) {
                throw new IllegalArgumentException(String.format(
                        "stack mismatch:%n[stackLines]%n%s[errStackLines]%n%s",
                        stackLinesStr(stackLines), stackLinesStr(errStackLines)));
            }
            int indexFromTail = stackLines.size() - 1 - i;
            int errIndexFromTail = errStackLines.size() - 1 - i;
            int line = stackLines.get(indexFromTail).getCodeBodyIndex();
            int errLine = errStackLines.get(errIndexFromTail).getCodeBodyIndex();
            if (line < errLine) {
                return -1; // already executed
            } else if (line > errLine) {
                return 1; // not executed
            }
        }
        return 0;
    }
198533
public final boolean overlaps(@NotNull final DayOpeningHours other) {
        Contract.requireArgNotNull("other", other);
        return hourRanges.overlaps(other.hourRanges);
    }
836508
def bounds_overlap(bound1, bound2):
    ''''''
    (x1,y1,w1,h1) = bound1
    (x2,y2,w2,h2) = bound2
    if x1+w1 < x2:
        return False
    if x2+w2 < x1:
        return False
    if y1+h1 < y2:
        return False
    if y2+h2 < y1:
        return False
    return True
27329
def overlaps(self, other):
        
        if self.chrom != other.chrom: return False
        if self.start >= other.end: return False
        if other.start >= self.end: return False
        return True
56335
def __solve_overlaps(self, start_time, end_time):
        
        if end_time is None or start_time is None:
            return

        # possible combinations and the OR clauses that catch them
        # (the side of the number marks if it catches the end or start time)
        #             |----------------- NEW -----------------|
        #      |--- old --- 1|   |2 --- old --- 1|   |2 --- old ---|
        # |3 -----------------------  big old   ------------------------ 3|
        query = """
                   SELECT a.*, b.name, c.name as category
                     FROM facts a
                LEFT JOIN activities b on b.id = a.activity_id
                LEFT JOIN categories c on b.category_id = c.id
                    WHERE (end_time > ? and end_time < ?)
                       OR (start_time > ? and start_time < ?)
                       OR (start_time < ? and end_time > ?)
                 ORDER BY start_time
                """
        conflicts = self.fetchall(query, (start_time, end_time,
                                          start_time, end_time,
                                          start_time, end_time))

        for fact in conflicts:
            # won't eliminate as it is better to have overlapping entries than loosing data
            if start_time < fact["start_time"] and end_time > fact["end_time"]:
                continue

            # split - truncate until beginning of new entry and create new activity for end
            if fact["start_time"] < start_time < fact["end_time"] and \
               fact["start_time"] < end_time < fact["end_time"]:

                logger.info("splitting %s" % fact["name"])
                # truncate until beginning of the new entry
                self.execute("""UPDATE facts
                                   SET end_time = ?
                                 WHERE id = ?""", (start_time, fact["id"]))
                fact_name = fact["name"]

                # create new fact for the end
                new_fact = Fact(fact["name"],
                                category = fact["category"],
                                description = fact["description"])
                new_fact_id = self.__add_fact(new_fact.serialized_name(), end_time, fact["end_time"])

                # copy tags
                tag_update = """INSERT INTO fact_tags(fact_id, tag_id)
                                     SELECT ?, tag_id
                                       FROM fact_tags
                                      WHERE fact_id = ?"""
                self.execute(tag_update, (new_fact_id, fact["id"])) #clone tags

            # overlap start
            elif start_time < fact["start_time"] < end_time:
                logger.info("Overlapping start of %s" % fact["name"])
                self.execute("UPDATE facts SET start_time=? WHERE id=?",
                             (end_time, fact["id"]))

            # overlap end
            elif start_time < fact["end_time"] < end_time:
                logger.info("Overlapping end of %s" % fact["name"])
                self.execute("UPDATE facts SET end_time=? WHERE id=?",
                             (start_time, fact["id"]))
962417
def _remove_overlaps(in_file, out_dir, data):
    
    out_file = os.path.join(out_dir, "%s-nooverlaps%s" % utils.splitext_plus(os.path.basename(in_file)))
    if not utils.file_uptodate(out_file, in_file):
        with file_transaction(data, out_file) as tx_out_file:
            with open(in_file) as in_handle:
                with open(tx_out_file, "w") as out_handle:
                    prev_line = None
                    for line in in_handle:
                        if prev_line:
                            pchrom, pstart, pend = prev_line.split("\t", 4)[:3]
                            cchrom, cstart, cend = line.split("\t", 4)[:3]
                            # Skip if chromosomes match and end overlaps start
                            if pchrom == cchrom and int(pend) > int(cstart):
                                pass
                            else:
                                out_handle.write(prev_line)
                        prev_line = line
                    out_handle.write(prev_line)
    return out_file
254120
protected void addToOverlaps(Intervalable interval, List<Intervalable> overlaps, List<Intervalable> newOverlaps)
    {
        for (Intervalable currentInterval : newOverlaps)
        {
            if (!currentInterval.equals(interval))
            {
                overlaps.add(currentInterval);
            }
        }
    }
917511
public boolean overlaps(Location location) {
         if (location.getBeginPosition()>=getBeginPosition() && location.getBeginPosition() <= getEndPosition()) 
             return true;
         if(location.getBeginPosition() <= getBeginPosition() && location.getEndPosition()>=getBeginPosition()) 
             return true;
        else {
            return false;
        }
    }
843586
function _processCodeWithPatterns(code, patterns, callback)
    {
        // we have to increase the level here so that the
        // replacements will not conflict with each other when
        // processing sub blocks of code
        ++CURRENT_LEVEL;

        // patterns are processed one at a time through this function
        function _workOnPatterns(patterns, i)
        {
            // still have patterns to process, keep going
            if (i < patterns.length) {
                return _processPattern(patterns[i]['pattern'], patterns[i], code, function() {
                    _workOnPatterns(patterns, ++i);
                });
            }

            // we are done processing the patterns
            // process the replacements and update the DOM
            _processReplacements(code, function(code) {

                // when we are done processing replacements
                // we are done at this level so we can go back down
                delete replacements[CURRENT_LEVEL];
                delete replacement_positions[CURRENT_LEVEL];
                --CURRENT_LEVEL;
                callback(code);
            });
        }

        _workOnPatterns(patterns, 0);
    }
454437
def overlap(self, x, ctrs, kdtree=None):
        """"""

        q = len(self.within(x, ctrs, kdtree=kdtree))

        return q
1147156
public List<String> getSuggestedReplacements() {
    List<String> l = new ArrayList<>();
    for (SuggestedReplacement repl : suggestedReplacements) {
      l.add(repl.getReplacement());
    }
    return Collections.unmodifiableList(l);
  }
88991
private void failOnOverlapOfClearedPropagated() {
        HashSet<String> overlap = new HashSet<String>(cleared);
        overlap.retainAll(propagated);
        if (overlap.isEmpty()) // only possible if builder is concurrently modified during build
            throw new ConcurrentModificationException();
        throw new IllegalStateException(Tr.formatMessage(tc, "CWWKC1151.context.lists.overlap", overlap));
    }
275849
def overlaps(self, other):
        
        return (
            self.right > other.left and
            self.left < other.right and
            self.top < other.bottom and
            self.bottom > other.top
        )
325789
def check_overlap(pos, ins, thresh):
    
    ins_pos = ins[0]
    ins_len = ins[2]
    ol = overlap(ins_pos, pos)
    feat_len = pos[1] - pos[0] + 1
#    print float(ol) / float(feat_len)
    if float(ol) / float(feat_len) >= thresh:
        return True
    return False
1196403
def check_overlap(current, hit, overlap = 200):
    
    for prev in current:
        p_coords = prev[2:4]
        coords = hit[2:4]
        if get_overlap(coords, p_coords) >= overlap:
            return True
    return False
1233369
public final boolean overlaps(@NotNull final HourRanges other) {
        final BitSet thisMinutes = this.toMinutes();
        final BitSet otherMinutes = other.toMinutes();
        thisMinutes.and(otherMinutes);
        return !thisMinutes.isEmpty();
    }