public final class Heap extends Object
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.
|
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.
|
int[] |
toArray() |
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)
public int getInitialSize()
public int[] toArray()
Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.