Class OpMapVector

java.lang.Object
org.htmlunit.xpath.compiler.OpMapVector

public class OpMapVector extends Object
High-performance primitive int array vector for OpMap operations.
Author:
Apache Xalan, Ronald Brill
  • Constructor Summary

    Constructors
    Constructor
    Description
    OpMapVector(int initialCapacity, int incrementSize, int lengthPos)
    Constructs an OpMapVector with the specified initial capacity, increment size, and length position.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Resets the logical size to zero without releasing the backing array, preserving its capacity for reuse.
    final int
    elementAt(int i)
    Get the nth element.
    int[]
     
    final void
    setElementAt(int value, int index)
    Sets the component at the specified index of this vector to be the specified object.
    final void
    setToSize(int size)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OpMapVector

      public OpMapVector(int initialCapacity, int incrementSize, int lengthPos)
      Constructs an OpMapVector with the specified initial capacity, increment size, and length position.
      Parameters:
      initialCapacity - initial size of the vector array
      incrementSize - amount by which to expand the backing array when full
      lengthPos - 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 set
      index - 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 subsequent setElementAt(int, int) calls can fill it without triggering growth.

    • getMap

      public int[] getMap()