|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.media.j3d.IndexedUnorderSet
class IndexedUnorderSet
A strongly type indexed unorder set. All operations remove(IndexedObject, ListType), add(IndexedObject, ListType), contains(IndexedObject, ListType) etc. 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.
IndexedUnorderSet IUset = new IndexedUnorderSet(YourClass.class, listType); // add element here YourClass[] arr = (YourClass []) IUset.toArray(); int size = IUset.arraySize(); for (int i=0; i < size; i++) { YourClass obj = arr[i]; .... }
Note:
Limitation:
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) static boolean |
debug
|
(package private) IndexedObject[] |
elementData
The array buffer into which the elements of the ArrayList are stored. |
(package private) boolean |
isDirty
|
(package private) int |
listType
|
(package private) int |
size
The size of the ArrayList (the number of elements it contains). |
(package private) VirtualUniverse |
univ
|
Constructor Summary | |
---|---|
IndexedUnorderSet(java.lang.Class componentType,
int listType,
VirtualUniverse univ)
Constructs an empty list. |
|
IndexedUnorderSet(int initialCapacity,
java.lang.Class componentType,
int listType,
VirtualUniverse univ)
Constructs an empty list with the specified initial capacity. |
|
IndexedUnorderSet(int initialCapacity,
int listType,
VirtualUniverse univ)
Constructs an empty list with the specified initial capacity. |
|
IndexedUnorderSet(int listType,
VirtualUniverse univ)
Constructs an empty list. |
Method Summary | |
---|---|
(package private) void |
add(IndexedObject o)
Appends the specified element to the end of this list. |
(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(IndexedObject 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(IndexedObject o)
Searches for the last occurence of the given argument, testing for equality using the equals method. |
(package private) static void |
init(IndexedObject obj,
int len)
Initialize all indexes to -1 |
(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) boolean |
remove(IndexedObject o)
Removes the specified element in this list. |
(package private) void |
remove(int index)
Removes the element at the specified position in this list. |
(package private) java.lang.Object |
removeLastElement()
Removes the element at the last position in this list. |
(package private) void |
set(int index,
IndexedObject o)
Replaces the element at the specified position in this list with the specified element. |
(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(IndexedObject startElement)
Returns an array containing elements starting from startElement all of the elements in this list. |
(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, toString, wait, wait, wait |
Field Detail |
---|
static final boolean debug
transient IndexedObject[] elementData
transient java.lang.Object[] cloneData
transient int cloneSize
transient boolean isDirty
java.lang.Class componentType
int size
int listType
VirtualUniverse univ
Constructor Detail |
---|
IndexedUnorderSet(int initialCapacity, java.lang.Class componentType, int listType, VirtualUniverse univ)
initialCapacity
- the initial capacity of the list.componentType
- class type of element in the list.IndexedUnorderSet(java.lang.Class componentType, int listType, VirtualUniverse univ)
componentType
- class type of element in the list.IndexedUnorderSet(int initialCapacity, int listType, VirtualUniverse univ)
initialCapacity
- the initial capacity of the list.IndexedUnorderSet(int listType, VirtualUniverse univ)
listType
- default to Object.Method Detail |
---|
static final void init(IndexedObject obj, int len)
final int size()
final int arraySize()
final boolean isEmpty()
final boolean contains(IndexedObject o)
o
- element whose presence in this List is to be tested.final int indexOf(IndexedObject 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(IndexedObject startElement)
startElement
- starting element to copy
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, IndexedObject o)
index
- index of element to replace.o
- element to be stored at the specified position.
java.lang.IndexOutOfBoundsException
- if index out of range
(index < 0 || index >= size()).final void add(IndexedObject 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 java.lang.Object removeLastElement()
java.lang.IndexOutOfBoundsException
- if array is emptyfinal boolean remove(IndexedObject 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()
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 |