java.lang.Object
org.htmlunit.xpath.compiler.OpMapVector
High-performance primitive int array vector for OpMap operations.
- Author:
- Apache Xalan, Ronald Brill
-
Constructor Summary
ConstructorsConstructorDescriptionOpMapVector(int initialCapacity, int incrementSize, int lengthPos) Constructs anOpMapVectorwith the specified initial capacity, increment size, and length position. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Resets the logical size to zero without releasing the backing array, preserving its capacity for reuse.final intelementAt(int i) Get the nth element.int[]getMap()final voidsetElementAt(int value, int index) Sets the component at the specified index of this vector to be the specified object.final voidsetToSize(int size)
-
Constructor Details
-
OpMapVector
public OpMapVector(int initialCapacity, int incrementSize, int lengthPos) Constructs anOpMapVectorwith the specified initial capacity, increment size, and length position.- Parameters:
initialCapacity- initial size of the vector arrayincrementSize- amount by which to expand the backing array when fulllengthPos- index position in the array where length metadata is stored
-
-
Method Details
-
elementAt
public final int elementAt(int i) Get the nth element.- Parameters:
i- index of object to get- Returns:
- object at given index
-
setElementAt
public final void setElementAt(int value, int index) Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded.The index must be a value greater than or equal to 0 and less than the current size of the vector.
- Parameters:
value- object to setindex- Index of where to set the object
-
setToSize
public final void setToSize(int size) -
clear
public void clear()Resets the logical size to zero without releasing the backing array, preserving its capacity for reuse.This is analogous to
ArrayList.clear()— O(1), no allocation. The backing array is retained so subsequentsetElementAt(int, int)calls can fill it without triggering growth. -
getMap
public int[] getMap()
-