|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.media.j3d.UnorderList
class UnorderList
A strongly type unorder array list. The operation add(Object o) & remove(int i) take O(1) time. The class is designed to optimize speed. So many reductance procedures call and range check as found in ArrayList are removed.
Use the following code to iterate through an array.
UnorderList list = new UnorderList(YourClass.class); // add element here YourClass[] arr = (YourClass []) list.toArray(); int size = list.arraySize(); for (int i=0; i < size; i++) { YourClass obj = arr[i]; .... }
Note:
Field Summary | |
---|---|
(package private) java.lang.Object[] |
cloneData
Clone copy of elementData return by toArray(true); |
(package private) int |
cloneSize
|
(package private) java.lang.Class |
componentType
Component Type of individual array element entry |
(package private) java.lang.Object[] |
elementData
The array buffer into which the elements of the ArrayList are stored. |
(package private) boolean |
isDirty
|
(package private) int |
size
The size of the ArrayList (the number of elements it contains). |
Constructor Summary | |
---|---|
UnorderList()
Constructs an empty list. |
|
UnorderList(java.lang.Class componentType)
Constructs an empty list. |
|
UnorderList(int initialCapacity)
Constructs an empty list with the specified initial capacity. |
|
UnorderList(int initialCapacity,
java.lang.Class componentType)
Constructs an empty list with the specified initial capacity. |
Method Summary | |
---|---|
(package private) void |
add(java.lang.Object o)
Appends the specified element to the end of this list. |
(package private) boolean |
addUnique(java.lang.Object o)
Add Object into the list if it is not already exists. |
(package private) int |
arraySize()
Returns the size of entry use in toArray() number of elements in this list. |
(package private) void |
clear()
Removes all of the elements from this list. |
(package private) void |
clearMirror()
|
protected java.lang.Object |
clone()
Returns a shallow copy of this ArrayList instance. |
(package private) boolean |
contains(java.lang.Object o)
Returns true if this list contains the specified element. |
(package private) java.lang.Object |
get(int index)
Returns the element at the specified position in this list. |
(package private) java.lang.Class |
getComponentType()
|
(package private) int |
indexOf(java.lang.Object o)
Searches for the last occurence of the given argument, testing for equality using the equals method. |
(package private) boolean |
isEmpty()
Tests if this list has no elements. |
private void |
readObject(java.io.ObjectInputStream s)
Reconstitute the ArrayList instance from a stream (that is, deserialize it). |
(package private) void |
remove(int index)
Removes the element at the specified position in this list. |
(package private) boolean |
remove(java.lang.Object o)
Removes the specified element in this list. |
(package private) java.lang.Object |
removeLastElement()
Removes the element at the last position in this list. |
(package private) void |
removeOrdered(int index)
Removes the element at the specified position in this list. |
(package private) void |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in this list with the specified element. |
(package private) void |
shift(java.lang.Object[] objs,
int idx)
|
(package private) int |
size()
Returns the number of elements in this list. |
(package private) java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this list. |
(package private) java.lang.Object[] |
toArray(boolean copy)
Returns an array containing all of the elements in this list. |
(package private) java.lang.Object[] |
toArray(java.lang.Object startElement)
Returns an array containing elements starting from startElement all of the elements in this list. |
(package private) void |
toArrayAndClear(java.lang.Object[] objs)
|
java.lang.String |
toString()
|
(package private) void |
trimToSize()
Trims the capacity of this ArrayList instance to be the list's current size. |
private void |
writeObject(java.io.ObjectOutputStream s)
Save the state of the ArrayList instance to a stream (that is, serialize it). |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
transient java.lang.Object[] elementData
transient java.lang.Object[] cloneData
transient int cloneSize
transient boolean isDirty
java.lang.Class componentType
int size
Constructor Detail |
---|
UnorderList(int initialCapacity, java.lang.Class componentType)
initialCapacity
- the initial capacity of the list.componentType
- class type of element in the list.UnorderList(java.lang.Class componentType)
componentType
- class type of element in the list.UnorderList(int initialCapacity)
initialCapacity
- the initial capacity of the list.UnorderList()
Method Detail |
---|
final int size()
final int arraySize()
final boolean isEmpty()
final boolean contains(java.lang.Object o)
o
- element whose presence in this List is to be tested.final boolean addUnique(java.lang.Object o)
o
- an object to add into the list
final int indexOf(java.lang.Object o)
o
- an object.
Object.equals(Object)
protected final java.lang.Object clone()
clone
in class java.lang.Object
final java.lang.Object[] toArray(boolean copy)
final java.lang.Object[] toArray()
final java.lang.Object[] toArray(java.lang.Object startElement)
startElement
- starting element to copy
final void toArrayAndClear(java.lang.Object[] objs)
final void trimToSize()
final java.lang.Object get(int index)
index
- index of element to return.
java.lang.IndexOutOfBoundsException
- if index is out of range (index
< 0 || index >= size()).final void set(int index, java.lang.Object element)
index
- index of element to replace.element
- element to be stored at the specified position.
java.lang.IndexOutOfBoundsException
- if index out of range
(index < 0 || index >= size()).final void add(java.lang.Object o)
o
- element to be appended to this list.final void remove(int index)
index
- the index of the element to removed.
java.lang.IndexOutOfBoundsException
- if index out of range (index
< 0 || index >= size()).final void removeOrdered(int index)
index
- the index of the element to removed.
java.lang.IndexOutOfBoundsException
- if index out of range (index
< 0 || index >= size()).final java.lang.Object removeLastElement()
java.lang.IndexOutOfBoundsException
- if array is emptyfinal void shift(java.lang.Object[] objs, int idx)
final boolean remove(java.lang.Object o)
o
- the element to removed.
java.lang.IndexOutOfBoundsException
- if index out of range (index
< 0 || index >= size()).final void clear()
final void clearMirror()
final java.lang.Class getComponentType()
public java.lang.String toString()
toString
in class java.lang.Object
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |