public class TextRangeUtil
extends java.lang.Object
TextRange
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<TextRange> |
RANGE_COMPARATOR |
Modifier and Type | Method and Description |
---|---|
static java.lang.Iterable<TextRange> |
excludeRanges(TextRange original,
java.util.List<? extends TextRange> excludedRanges)
Excludes ranges from the original range.
|
static int |
getDistance(Segment r2,
Segment r1) |
static TextRange |
getEnclosingTextRange(java.util.List<? extends TextRange> textRanges)
Return least text range that contains all of passed text ranges.
|
static boolean |
intersectsOneOf(TextRange range,
java.util.List<? extends TextRange> rangeList)
Checks that the given range intersects one of the ranges in the list by performing a binary search.
|
static boolean |
rangesContain(java.util.List<? extends TextRange> rangeList,
int offset)
Checks that the given offset is contained in one of the ranges in the list by performing a binary search.
|
public static final java.util.Comparator<TextRange> RANGE_COMPARATOR
public static java.lang.Iterable<TextRange> excludeRanges(TextRange original, java.util.List<? extends TextRange> excludedRanges)
original
- The original range to exclude the ranges from.excludedRanges
- The list of ranges to exclude.public static TextRange getEnclosingTextRange(java.util.List<? extends TextRange> textRanges)
textRanges
- The list of ranges to processpublic static boolean intersectsOneOf(TextRange range, java.util.List<? extends TextRange> rangeList)
range
- The range to check.rangeList
- The range list. The list must be ordered by range start offset.public static boolean rangesContain(java.util.List<? extends TextRange> rangeList, int offset)
range
- The range to check.rangeList
- The range list. The list must be ordered by range start offset.