Package org.apache.uima.cas.impl
Class Heap
- java.lang.Object
-
- org.apache.uima.cas.impl.Heap
-
public final class Heap extends java.lang.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 Description static int
DEFAULT_SIZE
Default size of the heap.static int
MIN_SIZE
Minimum size of the heap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
add(int[] fs)
Add a structure to the heap.int
add(int len, int val)
Reserve space forlen
items on the heap and set the first item toval
.int
getInitialSize()
int
getNextId()
void
grow(int len)
void
reset()
Reset the temporary heap.
-
-
-
Field Detail
-
MIN_SIZE
public static final int MIN_SIZE
Minimum size of the heap. Currently set to1000
.- See Also:
- Constant Field Values
-
DEFAULT_SIZE
public static final int DEFAULT_SIZE
Default size of the heap. Currently set to500000
(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 theMIN_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 forlen
items on the heap and set the first item toval
. The other items are set to0
.- 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()
-
-