Example usage for com.google.common.collect RangeMap remove

List of usage examples for com.google.common.collect RangeMap remove

Introduction

In this page you can find the example usage for com.google.common.collect RangeMap remove.

Prototype

void remove(Range<K> range);

Source Link

Document

Removes all associations from this range map in the specified range (optional operation).

Usage

From source file:radsoft.syntaxhighlighter.SyntaxHighlighter.java

private static void removeMatches(RangeMap<Integer, String> matches, int start, int end) {
    Range<Integer> r = Range.closedOpen(start, end);
    matches.remove(r);
}

From source file:radsoft.syntaxhighlighter.SyntaxHighlighter.java

private static void addMatch(RangeMap<Integer, String> matches, int start, int end, String styleKey) {
    if (styleKey == null)
        throw new NullPointerException("argument 'styleKey' cannot be null");
    Map.Entry<Range<Integer>, String> e = matches.getEntry(start);
    if (e == null || start < e.getKey().lowerEndpoint()) {
        if (e != null)
            matches.remove(e.getKey());
        e = matches.getEntry(end - 1);/* www.  ja  va 2  s  .c o m*/
        if (e != null)
            matches.remove(e.getKey());

        Range<Integer> r = Range.closedOpen(start, end);
        matches.put(r, styleKey);
    }
}