org.apache.uima.cas.impl

## Class Heap

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

-     public final class Heap
      extends Object

  A heap for CAS.

  This class is agnostic about what you store on the heap. It only copies values from integer arrays.

- - ### Field Summary

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

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.

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

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

- - ### Field Detail

    - #### 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 Detail

    - #### 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 Detail

    - #### 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()

Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.