public interface SortedListOfRanges extends CharacterSet
SortedListOfRanges.rangesAreSortedAndDisjoint().| Modifier and Type | Method and Description |
|---|---|
default void |
addRangeTo(RangesBuffer buffer,
int i)
Appends the range at index
i to the given buffer. |
default boolean |
adjacent(int ia,
int bLo,
int bHi)
Returns
true if the range at index ia is adjacent to the range
[bLo, bHi]. |
static boolean |
adjacent(int aLo,
int aHi,
int bLo,
int bHi)
Returns
true if the ranges [aLo, aHi] and [bLo, bHi] are adjacent to
each other, meaning that the lower bound of one range immediately follows the upper bound of
the other. |
default boolean |
adjacent(int ia,
SortedListOfRanges o,
int ib)
Returns
true if the range at index ia is adjacent to the range in list
o at index ib. |
void |
appendRangesTo(RangesBuffer buffer,
int startIndex,
int endIndex)
Append all ranges from
startIndex (inclusive) to endIndex (exclusive) to the
given buffer. |
default int |
binarySearch(int keyLo)
Performs a binary search for a range with the given lower bound (
keyLo), in the same
way as Arrays.binarySearch(int[], int) would behave on an array containing
only the lower bounds of all ranges in this list. |
default boolean |
binarySearchExactMatch(int searchResult,
int bLo,
int bHi)
Returns
true if a given binary search result is equals to the range
[bLo, bHi]. |
default boolean |
binarySearchExactMatch(int searchResult,
SortedListOfRanges o,
int ib)
Returns
true if a given binary search result is equal to the range in list o
at index ib. |
default int |
binarySearchGetFirstIntersecting(int searchResult,
int bLo,
int bHi)
If there was no
exact match in a
binary search, this method will return the index of the first
range that intersects with the range [bLo, bHi], or SortedListOfRanges.size(). |
default int |
binarySearchGetFirstIntersecting(int searchResult,
SortedListOfRanges o,
int ib)
If there was no
exact match in a
binary search, this method will return the index of the first
range that intersects with the range in o at index ib, or SortedListOfRanges.size(). |
default int |
binarySearchGetFirstIntersectingOrAdjacent(int searchResult,
int bLo,
int bHi)
If there was no
exact match in a
binary search, this method will return the index of the first
range that intersects with or is adjacent to the range [bLo, bHi], or SortedListOfRanges.size()
. |
default int |
binarySearchGetFirstIntersectingOrAdjacent(int searchResult,
int oLo,
int oHi,
boolean includeAdjacent) |
default boolean |
binarySearchNoIntersectingFound(int firstIntersecting)
Returns
true if no intersecting range was found by a call to
SortedListOfRanges.binarySearchGetFirstIntersecting(int, int, int) or one if its variants. |
default boolean |
containedBy(int ia,
int bLo,
int bHi)
Returns
true if the range [bLo, bHi] contains the range at index ia. |
default boolean |
contains(int codePoint)
Returns
true if this list contains the given codePoint. |
default boolean |
contains(int ia,
int bLo,
int bHi)
Returns
true if the range at index ia contains the range [bLo, bHi]. |
static boolean |
contains(int aLo,
int aHi,
int bLo,
int bHi)
Returns
true if the range [aLo, aHi] contains the range [bLo, bHi]. |
default boolean |
contains(int ia,
SortedListOfRanges o,
int ib)
Returns
true if the range at index ia contains the range in list o at
index ib. |
default boolean |
contains(SortedListOfRanges o)
Returns
true if this list contains all values of o. |
default String |
defaultToString() |
default boolean |
equal(int ia,
int bLo,
int bHi)
Returns
true if the range at index ia is equal to the range
[bLo, bHi]. |
default boolean |
equal(int ia,
SortedListOfRanges o,
int ib)
Returns
true if the range at index ia is equal to the range in list o
at index ib. |
default boolean |
equalsListOfRanges(SortedListOfRanges o) |
int |
getHi(int i)
Returns the inclusive upper bound of the range stored at index
i. |
int |
getLo(int i)
Returns the inclusive lower bound of the range stored at index
i. |
default int |
getMax()
Returns the largest value contained in this set.
|
int |
getMaxValue()
Returns the maximum value that may be contained in an instance of this list.
|
default int |
getMin()
Returns the smallest value contained in this set.
|
int |
getMinValue()
Returns the minimum value that may be contained in an instance of this list.
|
default boolean |
intersects(int ia,
int bLo,
int bHi)
Returns
true if the range at index ia intersects with the range
[bLo, bHi]. |
static boolean |
intersects(int aLo,
int aHi,
int bLo,
int bHi)
Returns
true if the range [aLo, aHi] intersects with the range
[bLo, bHi]. |
default boolean |
intersects(int ia,
SortedListOfRanges o,
int ib)
Returns
true if the range at index ia intersects with the range in list
o at index ib. |
default boolean |
intersects(SortedListOfRanges o)
Returns
true if this list intersects with o. |
default String |
inverseRangesToString() |
default int |
inverseValueCount()
Returns the total number of values (from
SortedListOfRanges.getMinValue() to SortedListOfRanges.getMaxValue())
not contained in this list. |
default boolean |
isEmpty() |
default boolean |
isSingle(int i)
Returns
true if the range at index i consists of a single value, i.e. |
static boolean |
leftOf(int aHi,
int bLo)
Variant of
SortedListOfRanges.leftOf(int, int, int, int) without the unnecessary parameters. |
default boolean |
leftOf(int ia,
int bLo,
int bHi)
Returns
true if the range at index ia is "left of" the range
[bLo, bHi]. |
static boolean |
leftOf(int aLo,
int aHi,
int bLo,
int bHi)
Returns
true if the range [aLo, aHi] is "left of" the range
[bLo, bHi], where "left of" means "all values of range a are less than all values of
range b" - i.e. |
default boolean |
leftOf(int ia,
SortedListOfRanges o,
int ib)
Returns
true if the range at index ia is "left of" the range in list
o at index ib. |
default boolean |
matches2CharsWith1BitDifference()
Returns
true iff this code point set contains exactly two characters whose binary
representation differs in one bit only. |
default boolean |
matchesEverything()
Returns
true if this list is equal to [SortedListOfRanges.getMinValue() SortedListOfRanges.getMaxValue()
]. |
default boolean |
matchesMinAndMax()
Returns
true iff this set contains SortedListOfRanges.getMinValue() and SortedListOfRanges.getMaxValue(). |
default boolean |
matchesNothing()
Returns
true if this list is empty. |
default boolean |
matchesSingleAscii()
Returns
true if this list contains just one single value which is less than 128. |
default boolean |
matchesSingleChar()
Returns
true if this list contains just one single value. |
default boolean |
matchesSomething()
Returns
true if this list is non-empty. |
default boolean |
rangesAreSortedAndDisjoint()
Returns
true if this list is sorted and all of its ranges are disjoint and
non-adjacent. |
default String |
rangesToString() |
static boolean |
rightOf(int aLo,
int bHi)
Variant of
SortedListOfRanges.rightOf(int, int, int, int) without the unnecessary parameters. |
default boolean |
rightOf(int ia,
int bLo,
int bHi)
Returns
true if the range at index ia is "right of" the range
[bLo, bHi]. |
static boolean |
rightOf(int aLo,
int aHi,
int bLo,
int bHi)
Returns
true if the range [aLo, aHi] is "right of" the range
[bLo, bHi], where "right of" means "all values of range a are greater than all values
of range b" - i.e. |
default boolean |
rightOf(int ia,
SortedListOfRanges o,
int ib)
Returns
true if the range at index ia is "right of" the range in list
o at index ib. |
int |
size()
Returns the number of disjoint ranges contained in this list.
|
default int |
size(int i)
Returns the number of values contained in the range at index
i. |
default int |
sizeOfInverse()
Returns the number of disjoint ranges contained in the inverse (as defined by
ImmutableSortedListOfRanges.createInverse()) of this list. |
static void |
union(SortedListOfRanges a,
SortedListOfRanges b,
RangesBuffer target)
Converts
target to the union of a and b. |
default int |
valueCount()
Returns the total number of values contained in this list.
|
default boolean |
valueCountEquals(int cmp)
Returns
true iff the total number of values contained in this list is equal to
cmp. |
default boolean |
valueCountMax(int cmp)
Returns
true iff the total number of values contained in this list is less or equal
to cmp. |
int getLo(int i)
i.int getHi(int i)
i.int size()
int getMinValue()
int getMaxValue()
void appendRangesTo(RangesBuffer buffer, int startIndex, int endIndex)
startIndex (inclusive) to endIndex (exclusive) to the
given buffer. The caller is responsible for not violating the target buffer's
sortedness; This effectively means that the range at startIndex must be
rightOf the buffer's last range.default boolean isEmpty()
default boolean isSingle(int i)
true if the range at index i consists of a single value, i.e.
getLo(i) == getHi(i).default int size(int i)
i.default int sizeOfInverse()
ImmutableSortedListOfRanges.createInverse()) of this list.default int getMin()
default int getMax()
static boolean contains(int aLo,
int aHi,
int bLo,
int bHi)
true if the range [aLo, aHi] contains the range [bLo, bHi].default boolean contains(int ia,
SortedListOfRanges o,
int ib)
true if the range at index ia contains the range in list o at
index ib.default boolean contains(int ia,
int bLo,
int bHi)
true if the range at index ia contains the range [bLo, bHi].default boolean containedBy(int ia,
int bLo,
int bHi)
true if the range [bLo, bHi] contains the range at index ia.static boolean intersects(int aLo,
int aHi,
int bLo,
int bHi)
true if the range [aLo, aHi] intersects with the range
[bLo, bHi].default boolean intersects(int ia,
SortedListOfRanges o,
int ib)
true if the range at index ia intersects with the range in list
o at index ib.default boolean intersects(int ia,
int bLo,
int bHi)
true if the range at index ia intersects with the range
[bLo, bHi].static boolean leftOf(int aLo,
int aHi,
int bLo,
int bHi)
true if the range [aLo, aHi] is "left of" the range
[bLo, bHi], where "left of" means "all values of range a are less than all values of
range b" - i.e. {code aHi < bLo}.static boolean leftOf(int aHi,
int bLo)
SortedListOfRanges.leftOf(int, int, int, int) without the unnecessary parameters.default boolean leftOf(int ia,
SortedListOfRanges o,
int ib)
true if the range at index ia is "left of" the range in list
o at index ib.default boolean leftOf(int ia,
int bLo,
int bHi)
true if the range at index ia is "left of" the range
[bLo, bHi].static boolean rightOf(int aLo,
int aHi,
int bLo,
int bHi)
true if the range [aLo, aHi] is "right of" the range
[bLo, bHi], where "right of" means "all values of range a are greater than all values
of range b" - i.e. {code aLo > bHi}.static boolean rightOf(int aLo,
int bHi)
SortedListOfRanges.rightOf(int, int, int, int) without the unnecessary parameters.default boolean rightOf(int ia,
SortedListOfRanges o,
int ib)
true if the range at index ia is "right of" the range in list
o at index ib.default boolean rightOf(int ia,
int bLo,
int bHi)
true if the range at index ia is "right of" the range
[bLo, bHi].static boolean adjacent(int aLo,
int aHi,
int bLo,
int bHi)
true if the ranges [aLo, aHi] and [bLo, bHi] are adjacent to
each other, meaning that the lower bound of one range immediately follows the upper bound of
the other.default boolean adjacent(int ia,
SortedListOfRanges o,
int ib)
true if the range at index ia is adjacent to the range in list
o at index ib.default boolean adjacent(int ia,
int bLo,
int bHi)
true if the range at index ia is adjacent to the range
[bLo, bHi].default boolean equal(int ia,
SortedListOfRanges o,
int ib)
true if the range at index ia is equal to the range in list o
at index ib.default boolean equal(int ia,
int bLo,
int bHi)
true if the range at index ia is equal to the range
[bLo, bHi].default int binarySearch(int keyLo)
keyLo), in the same
way as Arrays.binarySearch(int[], int) would behave on an array containing
only the lower bounds of all ranges in this list.default boolean binarySearchExactMatch(int searchResult,
SortedListOfRanges o,
int ib)
true if a given binary search result is equal to the range in list o
at index ib.searchResult - the result of a call to SortedListOfRanges.binarySearch(int) with
o.getLo(ib) as the parameter.default boolean binarySearchExactMatch(int searchResult,
int bLo,
int bHi)
true if a given binary search result is equals to the range
[bLo, bHi].searchResult - the result of a call to SortedListOfRanges.binarySearch(int) with bLo as
the parameter.default int binarySearchGetFirstIntersecting(int searchResult,
SortedListOfRanges o,
int ib)
exact match in a
binary search, this method will return the index of the first
range that intersects with the range in o at index ib, or SortedListOfRanges.size().searchResult - the result of a call to SortedListOfRanges.binarySearch(int) with
o.getLo(ib) as the parameter.default int binarySearchGetFirstIntersecting(int searchResult,
int bLo,
int bHi)
exact match in a
binary search, this method will return the index of the first
range that intersects with the range [bLo, bHi], or SortedListOfRanges.size().searchResult - the result of a call to SortedListOfRanges.binarySearch(int) with bLo as
the parameter.default int binarySearchGetFirstIntersectingOrAdjacent(int searchResult,
int bLo,
int bHi)
exact match in a
binary search, this method will return the index of the first
range that intersects with or is adjacent to the range [bLo, bHi], or SortedListOfRanges.size()
.searchResult - the result of a call to SortedListOfRanges.binarySearch(int) with bLo as
the parameter.default int binarySearchGetFirstIntersectingOrAdjacent(int searchResult,
int oLo,
int oHi,
boolean includeAdjacent)
default boolean binarySearchNoIntersectingFound(int firstIntersecting)
true if no intersecting range was found by a call to
SortedListOfRanges.binarySearchGetFirstIntersecting(int, int, int) or one if its variants.firstIntersecting - the result of a call to
SortedListOfRanges.binarySearchGetFirstIntersecting(int, int, int) or one if its variants.default void addRangeTo(RangesBuffer buffer, int i)
i to the given buffer.default boolean rangesAreSortedAndDisjoint()
true if this list is sorted and all of its ranges are disjoint and
non-adjacent. This property must hold at all times.default boolean contains(int codePoint)
true if this list contains the given codePoint.contains in interface CharacterSetdefault boolean contains(SortedListOfRanges o)
true if this list contains all values of o.default boolean intersects(SortedListOfRanges o)
true if this list intersects with o.static void union(SortedListOfRanges a, SortedListOfRanges b, RangesBuffer target)
target to the union of a and b.default boolean matchesNothing()
true if this list is empty.default boolean matchesSomething()
true if this list is non-empty.default boolean matchesSingleChar()
true if this list contains just one single value.default boolean matchesSingleAscii()
true if this list contains just one single value which is less than 128.default boolean matchesMinAndMax()
true iff this set contains SortedListOfRanges.getMinValue() and SortedListOfRanges.getMaxValue().default boolean matches2CharsWith1BitDifference()
true iff this code point set contains exactly two characters whose binary
representation differs in one bit only.default int valueCount()
default boolean valueCountEquals(int cmp)
true iff the total number of values contained in this list is equal to
cmp.default boolean valueCountMax(int cmp)
true iff the total number of values contained in this list is less or equal
to cmp.default int inverseValueCount()
SortedListOfRanges.getMinValue() to SortedListOfRanges.getMaxValue())
not contained in this list.default boolean matchesEverything()
true if this list is equal to [SortedListOfRanges.getMinValue() SortedListOfRanges.getMaxValue()
].default boolean equalsListOfRanges(SortedListOfRanges o)
default String defaultToString()
default String rangesToString()
default String inverseRangesToString()