Class IntRangesBuffer
java.lang.Object
com.oracle.truffle.regex.tregex.buffer.AbstractArrayBuffer
com.oracle.truffle.regex.tregex.buffer.IntArrayBuffer
com.oracle.truffle.regex.tregex.buffer.IntRangesBuffer
- All Implemented Interfaces:
CharacterSet,RangesBuffer,SortedListOfRanges,Iterable<Integer>
Extension of
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,
...
]
-
Field Summary
Fields inherited from class com.oracle.truffle.regex.tregex.buffer.IntArrayBuffer
buf -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSingleValue(int newValue) Adds a new value.voidappendRange(int lo, int hi) Appends[lo hi]to this list.voidappendRangeAllowAdjacent(int lo, int hi) voidappendRangeConcatAdjacent(int lo, int hi) voidappendRangesTo(RangesBuffer buffer, int startIndex, int endIndex) Append all ranges fromstartIndex(inclusive) toendIndex(exclusive) to the givenbuffer.create()Create a new instance of this class.intgetHi(int i) Returns the inclusive upper bound of the range stored at indexi.intgetLo(int i) Returns the inclusive lower bound of the range stored at indexi.voidinsertRange(int index, int lo, int hi) Insert[lo hi]at the given index.voidreplaceRanges(int fromIndex, int toIndex, int lo, int hi) Replace all ranges fromfromIndex(inclusive) totoIndex(exclusive) with the single range[lo hi].intsize()Returns the number of disjoint ranges contained in this list.toString()Methods inherited from class com.oracle.truffle.regex.tregex.buffer.IntArrayBuffer
add, addAll, asFixedSizeArray, get, getBuffer, getLast, inc, iterator, removeLast, set, toArrayMethods inherited from class com.oracle.truffle.regex.tregex.buffer.AbstractArrayBuffer
clear, ensureCapacity, isEmpty, length, setLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.oracle.truffle.regex.charset.RangesBuffer
addRange, clearMethods inherited from interface com.oracle.truffle.regex.charset.SortedListOfRanges
addRangeTo, adjacent, adjacent, binarySearch, binarySearchExactMatch, binarySearchExactMatch, binarySearchGetFirstIntersecting, binarySearchGetFirstIntersecting, binarySearchGetFirstIntersectingOrAdjacent, binarySearchGetFirstIntersectingOrAdjacent, binarySearchNoIntersectingFound, containedBy, contains, contains, contains, contains, defaultToString, equal, equal, equalsListOfRanges, getMax, getMin, intersects, intersects, intersects, inverseGetMax, inverseGetMin, inverseRangesToString, inverseValueCount, isEmpty, isSingle, leftOf, leftOf, matches2CharsWith1BitDifference, matchesEverything, matchesMinAndMax, matchesNothing, matchesSingleAscii, matchesSingleChar, matchesSomething, rangesAreSortedAndDisjoint, rangesAreSortedNonAdjacentAndDisjoint, rangesToString, rightOf, rightOf, size, sizeOfInverse, valueCount, valueCountEquals, valueCountMax
-
Constructor Details
-
IntRangesBuffer
public IntRangesBuffer() -
IntRangesBuffer
public IntRangesBuffer(int initialSize)
-
-
Method Details
-
getLo
public int getLo(int i) Description copied from interface:SortedListOfRangesReturns the inclusive lower bound of the range stored at indexi.- Specified by:
getLoin interfaceSortedListOfRanges
-
getHi
public int getHi(int i) Description copied from interface:SortedListOfRangesReturns the inclusive upper bound of the range stored at indexi.- Specified by:
getHiin interfaceSortedListOfRanges
-
size
public int size()Description copied from interface:SortedListOfRangesReturns the number of disjoint ranges contained in this list.- Specified by:
sizein interfaceSortedListOfRanges
-
appendRange
public void appendRange(int lo, int hi) Description copied from interface:RangesBufferAppends[lo hi]to this list. The given range must beright ofand non-adjacent to the last range in this list.- Specified by:
appendRangein interfaceRangesBuffer
-
addSingleValue
public void addSingleValue(int newValue) Adds a new value. The value can be adjacent to the last range, in which case the last range is extended. -
appendRangeAllowAdjacent
public void appendRangeAllowAdjacent(int lo, int hi) -
appendRangeConcatAdjacent
public void appendRangeConcatAdjacent(int lo, int hi) -
insertRange
public void insertRange(int index, int lo, int hi) Description copied from interface:RangesBufferInsert[lo hi]at the given index. The given range must beright ofand non-adjacent to the range atindex - 1, andleft ofand non-adjacent to the range atindex.- Specified by:
insertRangein interfaceRangesBuffer
-
replaceRanges
public void replaceRanges(int fromIndex, int toIndex, int lo, int hi) Description copied from interface:RangesBufferReplace all ranges fromfromIndex(inclusive) totoIndex(exclusive) with the single range[lo hi]. The given range must beright ofand non-adjacent to the range atfromIndex - 1, andleft ofand non-adjacent to the range attoIndex.- Specified by:
replaceRangesin interfaceRangesBuffer
-
appendRangesTo
Description copied from interface:SortedListOfRangesAppend all ranges fromstartIndex(inclusive) toendIndex(exclusive) to the givenbuffer. The caller is responsible for not violating the target buffer's sortedness; This effectively means that the range atstartIndexmust berightOfthe buffer's last range.- Specified by:
appendRangesToin interfaceSortedListOfRanges
-
create
Description copied from interface:RangesBufferCreate a new instance of this class.- Specified by:
createin interfaceRangesBuffer
-
rangesIterator
-
toString
-