Package org.antlr.v4.runtime.misc
Class IntegerList
java.lang.Object
org.antlr.v4.runtime.misc.IntegerList
- Direct Known Subclasses:
IntegerStack
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int[]private intprivate static final int[]private static final intprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionIntegerList(int capacity) IntegerList(Collection<Integer> list) IntegerList(IntegerList list) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadd(int value) final voidaddAll(int[] array) final voidaddAll(Collection<Integer> list) final voidaddAll(IntegerList list) final intbinarySearch(int key) final intbinarySearch(int fromIndex, int toIndex, int key) private intfinal voidclear()final booleancontains(int value) private voidensureCapacity(int capacity) booleanCompares the specified object with this list for equality.final intget(int index) inthashCode()Returns the hash code value for this list.final booleanisEmpty()final intremoveAt(int index) final voidremoveRange(int fromIndex, int toIndex) final intset(int index, int value) final intsize()final voidsort()final int[]toArray()final char[]Convert the int list to a char array where values > 0x7FFFF take 2 bytes.toString()Returns a string representation of this list.final void
-
Field Details
-
EMPTY_DATA
private static final int[] EMPTY_DATA -
INITIAL_SIZE
private static final int INITIAL_SIZE- See Also:
-
MAX_ARRAY_SIZE
private static final int MAX_ARRAY_SIZE- See Also:
-
_data
private int[] _data -
_size
private int _size
-
-
Constructor Details
-
IntegerList
public IntegerList() -
IntegerList
public IntegerList(int capacity) -
IntegerList
-
IntegerList
-
-
Method Details
-
add
public final void add(int value) -
addAll
public final void addAll(int[] array) -
addAll
-
addAll
-
get
public final int get(int index) -
contains
public final boolean contains(int value) -
set
public final int set(int index, int value) -
removeAt
public final int removeAt(int index) -
removeRange
public final void removeRange(int fromIndex, int toIndex) -
isEmpty
public final boolean isEmpty() -
size
public final int size() -
trimToSize
public final void trimToSize() -
clear
public final void clear() -
toArray
public final int[] toArray() -
sort
public final void sort() -
equals
Compares the specified object with this list for equality. Returnstrueif and only if the specified object is also anIntegerList, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. In other words, two lists are defined to be equal if they contain the same elements in the same order.This implementation first checks if the specified object is this list. If so, it returns
true; if not, it checks if the specified object is anIntegerList. If not, it returnsfalse; if so, it checks the size of both lists. If the lists are not the same size, it returnsfalse; otherwise it iterates over both lists, comparing corresponding pairs of elements. If any comparison returnsfalse, this method returnsfalse. -
hashCode
public int hashCode()Returns the hash code value for this list.This implementation uses exactly the code that is used to define the list hash function in the documentation for the
List.hashCode()method. -
toString
Returns a string representation of this list. -
binarySearch
public final int binarySearch(int key) -
binarySearch
public final int binarySearch(int fromIndex, int toIndex, int key) -
ensureCapacity
private void ensureCapacity(int capacity) -
toCharArray
public final char[] toCharArray()Convert the int list to a char array where values > 0x7FFFF take 2 bytes. TODO????? If all values are less than the 0x7FFF 16-bit code point limit (1 bit taken to indicatethen this is just a char array of 16-bit char as usual. For values in the supplementary range, encode them as two UTF-16 code units. -
charArraySize
private int charArraySize()
-