public class IntRangesBuffer extends IntArrayBuffer implements RangesBuffer
IntArrayBuffer that adds convenience functions for arrays of integer ranges
in the form:
[
inclusive lower bound of range 1, inclusive upper bound of range 1,
inclusive lower bound of range 2, inclusive upper bound of range 2,
inclusive lower bound of range 3, inclusive upper bound of range 3,
...
]
buf| Constructor and Description |
|---|
IntRangesBuffer() |
IntRangesBuffer(int initialSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendRange(int lo,
int hi)
Appends
[lo hi] to this list. |
void |
appendRangesTo(RangesBuffer buffer,
int startIndex,
int endIndex)
Append all ranges from
startIndex (inclusive) to endIndex (exclusive) to the
given buffer. |
IntRangesBuffer |
create()
Create a new instance of this class.
|
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. |
int |
getMaxValue()
Returns the maximum value that may be contained in an instance of this list.
|
int |
getMinValue()
Returns the minimum value that may be contained in an instance of this list.
|
void |
insertRange(int index,
int lo,
int hi)
Insert
[lo hi] at the given index. |
void |
replaceRanges(int fromIndex,
int toIndex,
int lo,
int hi)
Replace all ranges from
fromIndex (inclusive) to toIndex (exclusive) with the
single range [lo hi]. |
int |
size()
Returns the number of disjoint ranges contained in this list.
|
String |
toString() |
add, getBuffer, toArrayclear, ensureCapacity, isEmpty, length, setLengthclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddRange, clearaddRangeTo, adjacent, adjacent, adjacent, binarySearch, binarySearchExactMatch, binarySearchExactMatch, binarySearchGetFirstIntersecting, binarySearchGetFirstIntersecting, binarySearchGetFirstIntersectingOrAdjacent, binarySearchGetFirstIntersectingOrAdjacent, binarySearchNoIntersectingFound, containedBy, contains, contains, contains, contains, contains, defaultToString, equal, equal, equalsListOfRanges, intersects, intersects, intersects, intersects, inverseRangesToString, inverseValueCount, isEmpty, isSingle, leftOf, leftOf, leftOf, leftOf, matches2CharsWith1BitDifference, matchesEverything, matchesNothing, matchesSingleAscii, matchesSingleChar, matchesSomething, rangesAreSortedAndDisjoint, rangesToString, rangeToString, rightOf, rightOf, rightOf, rightOf, size, sizeOfInverse, union, valueCountpublic IntRangesBuffer()
public IntRangesBuffer(int initialSize)
public int getMinValue()
SortedListOfRangesgetMinValue in interface SortedListOfRangespublic int getMaxValue()
SortedListOfRangesgetMaxValue in interface SortedListOfRangespublic int getLo(int i)
SortedListOfRangesi.getLo in interface SortedListOfRangespublic int getHi(int i)
SortedListOfRangesi.getHi in interface SortedListOfRangespublic int size()
SortedListOfRangessize in interface SortedListOfRangespublic void appendRange(int lo,
int hi)
RangesBuffer[lo hi] to this list. The given range must be right of and non-adjacent to the last range in this list.appendRange in interface RangesBufferpublic void insertRange(int index,
int lo,
int hi)
RangesBuffer[lo hi] at the given index. The given range must be
right of and non-adjacent to the range at index - 1,
and left of and non-adjacent to the range at index.insertRange in interface RangesBufferpublic void replaceRanges(int fromIndex,
int toIndex,
int lo,
int hi)
RangesBufferfromIndex (inclusive) to toIndex (exclusive) with the
single range [lo hi]. The given range must be right
of and non-adjacent to the range at fromIndex - 1, and left of and non-adjacent to the range at toIndex.replaceRanges in interface RangesBufferpublic void appendRangesTo(RangesBuffer buffer, int startIndex, int endIndex)
SortedListOfRangesstartIndex (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.appendRangesTo in interface SortedListOfRangespublic IntRangesBuffer create()
RangesBuffercreate in interface RangesBuffer