|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfreerails.util.GrowableBase
jfreerails.util.ArrayBase
public abstract class ArrayBase
Base class for type-specific growable array classes with any type of values
(including primitive types). This class builds on the basic structure
provided by GrowableBase, specializing it for usage as a
growable array. See the base class description for details of the
implementation.
Growable arrays based on this class are unsynchronized in order to provide the best possible performance for typical usage scenarios, so explicit synchronization must be implemented by the subclass or the application in cases where they are to be modified in a multithreaded environment.
Subclasses need to implement the abstract methods defined by the base class
for working with the data array, as well as the actual data access methods
(at least the basic add(), get(),
set(), and toArray() methods).
| Field Summary | |
|---|---|
protected int |
countPresent
The number of values currently present in the array. |
| Fields inherited from class jfreerails.util.GrowableBase |
|---|
countLimit, DEFAULT_SIZE, maximumGrowth |
| Constructor Summary | |
|---|---|
ArrayBase(ArrayBase base)
Copy (clone) constructor. |
|
ArrayBase(int size,
java.lang.Class type)
Constructor with partial specification. |
|
ArrayBase(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. |
void |
clear()
Set the array to the empty state. |
protected int |
getAddIndex()
Gets the array offset for appending a value to those in the array. |
protected static java.lang.Object |
getArray(ArrayBase other)
Get the array for another instance of this class. |
protected void |
makeInsertSpace(int index)
Makes room to insert a value at a specified index in the array. |
void |
remove(int index)
Remove a value from the array. |
void |
remove(int from,
int to)
Remove a range of value from the array. |
void |
setSize(int count)
Sets the number of values currently present in the array. |
int |
size()
Get the number of values currently present in the array. |
| Methods inherited from class jfreerails.util.GrowableBase |
|---|
discardValues, ensureCapacity, getArray, growArray, resizeCopy, setArray |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int countPresent
| Constructor Detail |
|---|
public ArrayBase(int size,
int growth,
java.lang.Class type)
size - number of elements initially allowed in arraygrowth - maximum size increment for growing arraytype - array element type
public ArrayBase(int size,
java.lang.Class type)
size - number of elements initially allowed in arraytype - array element typepublic ArrayBase(ArrayBase base)
base - instance being copied| Method Detail |
|---|
protected static java.lang.Object getArray(ArrayBase other)
other - subclass instance to get array from
protected final int getAddIndex()
protected void makeInsertSpace(int index)
index - index position at which to insert element
public void remove(int from,
int to)
from - index number of first value to be removedto - index number past last value to be removedpublic void remove(int index)
index - index number of value to be removedpublic final int size()
public void setSize(int count)
count - number of values to be setpublic final void clear()
protected java.lang.Object buildArray(java.lang.Class type,
int offset,
int length)
buildArray in class GrowableBasetype - 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 | |||||||||