Package org.apache.uima.cas.impl

# Class Heap

java.lang.Object
org.apache.uima.cas.impl.Heap

public final class Heap extends Object
the v2 CAS heap - used in modeling some binary (de)serialization

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_SIZE`
  Default size of the heap.
  `static final int`
  `MIN_SIZE`
  Minimum size of the heap.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Heap()`
  Default constructor.
  `Heap(int initialSize)`
  Constructor lets you set initial heap size.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `add(int[] fs)`
  Add a structure to the heap.
  `int`
  `add(int len, int val)`
  Reserve space for `len` items on the heap and set the first item to `val`.
  `int`
  `getInitialSize()`
  `int`
  `getNextId()`
  `void`
  `grow(int len)`
  `void`
  `reset()`
  Reset the temporary heap.
  `int[]`
  `toArray()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### MIN_SIZE

    public static final int MIN_SIZE
    Minimum size of the heap. Currently set to `1000`.
    See Also:
      - Constant Field Values

  - ### DEFAULT_SIZE

    public static final int DEFAULT_SIZE
    Default size of the heap. Currently set to `500000`(2 MB).
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### Heap

    public Heap()
    Default constructor.

  - ### Heap

    public Heap(int initialSize)
    Constructor lets you set initial heap size. Use only if you know what you're doing.
    Parameters:
      `initialSize` - The initial heap size. If this is smaller than the `MIN_SIZE`, the default will be used instead.

- ## Method Details

  - ### reset

    public void reset()
    Reset the temporary heap.

  - ### add

    public int add(int[] fs)
    Add a structure to the heap.
    Parameters:
      `fs` - The input structure.
    Returns:
      The position where the structure was added, i.e., a pointer to the first element of the structure.

  - ### add

    public int add(int len, int val)
    Reserve space for `len` items on the heap and set the first item to `val`. The other items are set to `0`.
    Parameters:
      `len` - The length of the new structure.
      `val` - The value of the first cell in the new structure.
    Returns:
      The position where the structure was added, i.e., a pointer to the first element of the structure.

  - ### getNextId

    public int getNextId()

  - ### grow

    public void grow(int len)

  - ### getInitialSize

    public int getInitialSize()

  - ### toArray

    public int[] toArray()