|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--com.sosnoski.util.GrowableBase
|
+--com.sosnoski.util.array.ArrayBase
|
+--com.sosnoski.util.array.ObjectArray
Growable Object array with type specific access methods. This
implementation is unsynchronized in order to provide the best possible
performance for typical usage scenarios, so explicit synchronization must
be implemented by a wrapper class or directly by the application in cases
where instances are modified in a multithreaded environment. See the base
classes for other details of the implementation.
| Field Summary | |
protected java.lang.Object[] |
m_baseArray
The underlying array used for storing the data. |
| Fields inherited from class com.sosnoski.util.array.ArrayBase |
m_countPresent |
| Fields inherited from class com.sosnoski.util.GrowableBase |
DEFAULT_SIZE, m_countLimit, m_maximumGrowth |
| Constructor Summary | |
ObjectArray()
Default constructor. |
|
ObjectArray(int size)
Constructor with initial size specified. |
|
ObjectArray(int size,
int growth)
Constructor with full specification. |
|
ObjectArray(ObjectArray base)
Copy (clone) constructor. |
|
| Method Summary | |
void |
add(int index,
java.lang.Object value)
Add a value at a specified index in the array. |
int |
add(java.lang.Object value)
Add a value to the array, appending it after the current values. |
java.lang.Object |
clone()
Duplicates the object with the generic call. |
java.lang.Object |
get(int index)
Retrieve the value present at an index position in the array. |
protected java.lang.Object |
getArray()
Get the backing array. |
java.util.Iterator |
iterator()
Return an iterator for the Objects in this array. |
void |
set(int index,
java.lang.Object value)
Set the value at an index position in the array. |
protected void |
setArray(java.lang.Object array)
Set the backing array. |
java.lang.Object[] |
toArray()
Constructs and returns a simple array containing the same data as held in this growable array. |
java.lang.Object[] |
toArray(java.lang.Class type)
Constructs and returns a type-specific array containing the same data as held in this growable generic array. |
java.lang.Object[] |
toArray(java.lang.Class type,
int offset,
int length)
Constructs and returns a type-specific array containing the same data as held in a portion of this growable generic array. |
java.lang.Object[] |
toArray(int offset,
int length)
Constructs and returns a simple array containing the same data as held in a portion of this growable array. |
| Methods inherited from class com.sosnoski.util.array.ArrayBase |
buildArray, clear, getAddIndex, getArray, makeInsertSpace, remove, remove, setSize, size |
| Methods inherited from class com.sosnoski.util.GrowableBase |
discardValues, ensureCapacity, growArray, resizeCopy |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.Object[] m_baseArray
| Constructor Detail |
public ObjectArray(int size,
int growth)
size - number of Object values initially allowed in
arraygrowth - maximum size increment for growing arraypublic ObjectArray(int size)
size - number of chars to size array for initiallypublic ObjectArray()
public ObjectArray(ObjectArray base)
base - instance being copied| Method Detail |
protected final java.lang.Object getArray()
getArray in class GrowableBaseprotected final void setArray(java.lang.Object array)
setArray in class GrowableBasebacking - array objectpublic final int add(java.lang.Object value)
value - value to be added
public void add(int index,
java.lang.Object value)
index - index position at which to insert elementvalue - value to be inserted into arraypublic final java.lang.Object get(int index)
index - index position for value to be retrieved
public final void set(int index,
java.lang.Object value)
index - index position to be setvalue - value to be setadd(java.lang.Object)public final java.util.Iterator iterator()
Objects in this array. The
iterator returns all values in order, but is not "live". Values
added to the array during iteration will not be returned by the
iteration, and any other changes to the array while the iteration is
in progress will give indeterminant results.public java.lang.Object[] toArray()
public java.lang.Object[] toArray(java.lang.Class type)
type - element type for constructed array
public java.lang.Object[] toArray(int offset,
int length)
offset - start offset in arraylength - number of characters to use
public java.lang.Object[] toArray(java.lang.Class type,
int offset,
int length)
type - element type for constructed arrayoffset - start offset in arraylength - number of characters to usepublic java.lang.Object clone()
clone in class java.lang.Object
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||