public final class Heap
extends java.lang.Object
This class is agnostic about what you store on the heap. It only copies values from integer arrays.
| 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 and Description |
|---|
Heap()
Default constructor.
|
Heap(int initialSize)
Constructor lets you set initial heap size.
|
public static final int MIN_SIZE
1000.public static final int DEFAULT_SIZE
500000(2 MB).public Heap()
public Heap(int initialSize)
initialSize - The initial heap size. If this is smaller than the
MIN_SIZE, the default will be used
instead.public void reset()
public int add(int[] fs)
fs - The input structure.public int add(int len,
int val)
len items on the heap and set the first
item to val. The other items are set to 0.len - The length of the new structure.val - The value of the first cell in the new structure.public int getNextId()
public void grow(int len)
Copyright © 2013. All Rights Reserved.