|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.util.ObjectArray
public class ObjectArray
Simple dynamic array structure that holds Object instances.
Idea is to save implementation weight when we don't really want to use a full java.util collections class, but don't want to have to re-implement the node copy/paste stuff every time.
Code is sourced from the Xj3D project.
Constructor Summary | |
---|---|
ObjectArray()
Create a new default array with size 512 items |
|
ObjectArray(int initialSize)
Create an array with the given initial size. |
Method Summary | |
---|---|
void |
add(java.lang.Object newNode)
Add a new value to the array. |
void |
add(java.lang.Object[] values)
Add an array of values in bulk to the array. |
void |
clear()
Clear the array so that it contains no values |
java.lang.Object |
get(int index)
Get the value at the given index. |
java.lang.Object |
remove(int index)
Remove the value at the given index. |
java.lang.Object |
remove(java.lang.Object obj)
Remove the first instance of the object found from this array. |
void |
set(int index,
java.lang.Object value)
Set the value at the given index. |
int |
size()
Get the count of the number of items in the array. |
java.lang.Object[] |
toArray()
Turn the values of this array into a real array. |
java.lang.Object[] |
toArray(java.lang.Object[] values)
Turn the values of this array into a real array by copying them into the given array if possible. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectArray()
public ObjectArray(int initialSize)
initialSize
- The size to start withMethod Detail |
---|
public int size()
public void clear()
public void add(java.lang.Object newNode)
newNode
- the value to be addedpublic void add(java.lang.Object[] values)
values
- The values to be addedpublic java.lang.Object get(int index)
index
- The position to get values from
java.lang.IndexOutOfBoundsException
- The index was not legalpublic void set(int index, java.lang.Object value)
index
- The position to get values fromvalue
- The new value to set
java.lang.IndexOutOfBoundsException
- The index was not legalpublic java.lang.Object remove(int index)
index
- The position to remove the value from
java.lang.IndexOutOfBoundsException
- The index was not legalpublic java.lang.Object remove(java.lang.Object obj)
obj
- The object instance to remove
public java.lang.Object[] toArray()
public java.lang.Object[] toArray(java.lang.Object[] values)
values
- The array to copy values to
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |