Top Description Fields Constructors Methods
org.apache.derby.impl.store.access.sort

pack-priv final Class NodeAllocator

extends Object
Class Inheritance

NodeAllocator manages an array of nodes which can be reused.

Field Summary

Modifier and TypeField and Description
private Node[]
private static final int
private static final int
private Node
private static final int
private int
private int

Constructor Summary

AccessConstructor and Description
public
NodeAllocator()

Construct an empty allocator.

Method Summary

Modifier and TypeMethod and Description
public int
public void
public void
freeNode(Node n)

Return a node to the allocator.

public void
grow(int percent)

Expand the node allocator's capacity by certain percent.

public boolean
init()

Initialize the allocator with default values for initial and maximum size.

public boolean
init(int maxSize)

Initialize the allocator with default values for initial size and the provided maximum size.

public boolean
init(int initSize, int maxSize)

Initialize the allocator with the given initial and maximum sizes.

public Node
public void
reset()

Clear all nodes that this allocator has allocated.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private Node[] array
DEFAULT_INIT_SIZEback to summary
private static final int DEFAULT_INIT_SIZE
DEFAULT_MAX_SIZEback to summary
private static final int DEFAULT_MAX_SIZE
freeListback to summary
private Node freeList
GROWTH_MULTIPLIERback to summary
private static final int GROWTH_MULTIPLIER
maxSizeback to summary
private int maxSize
nAllocatedback to summary
private int nAllocated

Constructor Detail

NodeAllocatorback to summary
public NodeAllocator()

Construct an empty allocator. The caller must call init() before using it.

Method Detail

capacityback to summary
public int capacity()
closeback to summary
public void close()
freeNodeback to summary
public void freeNode(Node n)

Return a node to the allocator.

growback to summary
public void grow(int percent)

Expand the node allocator's capacity by certain percent.

initback 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.

initback 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.

initback 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.

newNodeback to summary
public Node newNode()
resetback to summary
public void reset()

Clear all nodes that this allocator has allocated. The allocator must already have been initialized.