|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jibx.runtime.impl.GrowableBase
Base class for various types of collections based on type-specific growable arrays. The underlying array used for storage of items doubles in size each time more space is required, up to an optional maximum growth increment specified by the user.
com.sosnoski.util.array.ArrayBase
,
com.sosnoski.util.queue.QueueBase
,
com.sosnoski.util.stack.StackBase
Field Summary | |
static int |
DEFAULT_SIZE
Default initial array size. |
protected int |
m_countLimit
Size of the current array. |
protected int |
m_maximumGrowth
Maximum size increment for growing array. |
Constructor Summary | |
GrowableBase(GrowableBase base)
Copy (clone) constructor. |
|
GrowableBase(int size,
java.lang.Class type)
Constructor with partial specification. |
|
GrowableBase(int size,
int growth,
java.lang.Class type)
Constructor with full specification. |
Method Summary | |
protected java.lang.Object |
buildArray(java.lang.Class type,
int offset,
int length)
Constructs and returns a simple array containing the same data as held in a portion of this growable array. |
protected void |
discardValues(int from,
int to)
Discards values for a range of indices in the array. |
void |
ensureCapacity(int min)
Ensure that the array has the capacity for at least the specified number of values. |
protected abstract java.lang.Object |
getArray()
Get the backing array. |
protected void |
growArray(int required)
Increase the size of the array to at least a specified size. |
protected void |
resizeCopy(java.lang.Object base,
java.lang.Object grown)
Copy data after array resize. |
protected abstract void |
setArray(java.lang.Object array)
Set the backing array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_SIZE
protected int m_countLimit
protected int m_maximumGrowth
Constructor Detail |
public GrowableBase(int size, int growth, java.lang.Class type)
size
- number of elements in initial arraygrowth
- maximum size increment for growing arraytype
- array element typepublic GrowableBase(int size, java.lang.Class type)
size
- number of elements initially allowed in arraytype
- array element typepublic GrowableBase(GrowableBase base)
base
- instance being copiedMethod Detail |
protected abstract java.lang.Object getArray()
protected abstract void setArray(java.lang.Object array)
protected void resizeCopy(java.lang.Object base, java.lang.Object grown)
base
- original array containing datagrown
- resized array for dataprotected void discardValues(int from, int to)
from
- index of first value to be discardedto
- index past last value to be discardedprotected void growArray(int required)
required
- new minimum size requiredpublic final void ensureCapacity(int min)
min
- minimum capacity to be guaranteedprotected java.lang.Object buildArray(java.lang.Class type, int offset, int length)
type
- element type for constructed arrayoffset
- start offset in arraylength
- number of characters to use
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |