| Modifier and Type | Field and Description |
|---|---|
| private Node[] | |
| private static final int | |
| private static final int | |
| private Node | |
| private static final int | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public void | |
| public void | |
| public void | |
| public boolean | |
| public boolean | init(int maxSize)
Initialize the allocator with default values for initial size and the provided maximum size. |
| public boolean | |
| public Node | |
| public void |
| array | back to summary |
|---|---|
| private Node[] array | |
| DEFAULT_INIT_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_INIT_SIZE | |
| DEFAULT_MAX_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_MAX_SIZE | |
| freeList | back to summary |
|---|---|
| private Node freeList | |
| GROWTH_MULTIPLIER | back to summary |
|---|---|
| private static final int GROWTH_MULTIPLIER | |
| maxSize | back to summary |
|---|---|
| private int maxSize | |
| nAllocated | back to summary |
|---|---|
| private int nAllocated | |
| NodeAllocator | back to summary |
|---|---|
| public NodeAllocator() Construct an empty allocator. The caller must call init() before using it. | |
| capacity | back to summary |
|---|---|
| public int capacity() | |
| close | back to summary |
|---|---|
| public void close() | |
| freeNode | back to summary |
|---|---|
| public void freeNode(Node n) Return a node to the allocator. | |
| grow | back to summary |
|---|---|
| public void grow(int percent) Expand the node allocator's capacity by certain percent. | |
| init | back to summary |
|---|---|
| public boolean init() Initialize the allocator with default values for initial and maximum size. Returns false if sufficient memory could not be allocated. | |
| init | back to summary |
|---|---|
| public boolean init(int maxSize) Initialize the allocator with default values for initial size and the provided maximum size. Returns false if sufficient memory could not be allocated. | |
| init | back to summary |
|---|---|
| public boolean init(int initSize, int maxSize) Initialize the allocator with the given initial and maximum sizes. This method does not check, but assumes that the value of initSize is less than the value of maxSize, and that they are both powers of two. Returns false if sufficient memory could not be allocated. | |
| newNode | back to summary |
|---|---|
| public Node newNode() | |
| reset | back to summary |
|---|---|
| public void reset() Clear all nodes that this allocator has allocated. The allocator must already have been initialized. | |