Java Doc for IndexedUnorderSet.java in  » 6.0-JDK-Modules » java-3d » javax » media » j3d » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » javax.media.j3d 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.media.j3d.IndexedUnorderSet

IndexedUnorderSet
class IndexedUnorderSet implements Cloneable,java.io.Serializable(Code)
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:

    1) The array return is a copied of internal array.
    2) Don't use arr.length , use IUset.arraySize();
    3) IndexedObject contains an array of listIndex, the number of array elements depends on the number of different types of IndexedUnorderSet that use it.
    4) No need to do casting for individual element as in ArrayList.
    5) IndexedUnorderSet is thread safe.
    6) Object implement this interface MUST initialize the index to -1.

Limitation:

    1) Order of IndexedObject in list is not important
    2) Can't modify the clone() copy.
    3) IndexedObject can't be null


Field Summary
transient  ObjectcloneData
    
transient  intcloneSize
    
 ClasscomponentType
    
final static  booleandebug
    
transient  IndexedObjectelementData
     The array buffer into which the elements of the ArrayList are stored.
transient  booleanisDirty
    
 intlistType
    
 intsize
     The size of the ArrayList (the number of elements it contains).
 VirtualUniverseuniv
    

Constructor Summary
 IndexedUnorderSet(int initialCapacity, Class componentType, int listType, VirtualUniverse univ)
     Constructs an empty list with the specified initial capacity.
 IndexedUnorderSet(Class componentType, int listType, VirtualUniverse univ)
     Constructs an empty list.
 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
final synchronized  voidadd(IndexedObject o)
     Appends the specified element to the end of this list.
final  intarraySize()
     Returns the size of entry use in toArray() number of elements in this list.
final synchronized  voidclear()
     Removes all of the elements from this list.
final synchronized  voidclearMirror()
    
final protected synchronized  Objectclone()
     Returns a shallow copy of this ArrayList instance.
final synchronized  booleancontains(IndexedObject o)
     Returns true if this list contains the specified element.
final synchronized  Objectget(int index)
     Returns the element at the specified position in this list.
Parameters:
  index - index of element to return.
final  ClassgetComponentType()
    
final synchronized  intindexOf(IndexedObject o)
     Searches for the last occurence of the given argument, testing for equality using the equals method.
final static  voidinit(IndexedObject obj, int len)
    
final  booleanisEmpty()
     Tests if this list has no elements.
final synchronized  voidremove(int index)
     Removes the element at the specified position in this list.
final synchronized  booleanremove(IndexedObject o)
     Removes the specified element in this list. Replace the removed element by the last one.
Parameters:
  o - the element to removed.
final synchronized  ObjectremoveLastElement()
     Removes the element at the last position in this list.
final synchronized  voidset(int index, IndexedObject o)
     Replaces the element at the specified position in this list with the specified element.
Parameters:
  index - index of element to replace.
Parameters:
  o - element to be stored at the specified position.
final  intsize()
     Returns the number of elements in this list.
final synchronized  Object[]toArray(boolean copy)
     Returns an array containing all of the elements in this list. The size of the array may longer than the actual size.
final synchronized  Object[]toArray()
     Returns an array containing all of the elements in this list. The size of the array may longer than the actual size.
final synchronized  Object[]toArray(IndexedObject startElement)
     Returns an array containing elements starting from startElement all of the elements in this list.
final synchronized  voidtrimToSize()
     Trims the capacity of this ArrayList instance to be the list's current size.

Field Detail
cloneData
transient Object cloneData(Code)
Clone copy of elementData return by toArray(true);



cloneSize
transient int cloneSize(Code)



componentType
Class componentType(Code)
Component Type of individual array element entry



debug
final static boolean debug(Code)



elementData
transient IndexedObject elementData(Code)
The array buffer into which the elements of the ArrayList are stored. The capacity of the ArrayList is the length of this array buffer. It is non-private to enable compiler do inlining for get(), set(), remove() when -O flag turn on.



isDirty
transient boolean isDirty(Code)



listType
int listType(Code)



size
int size(Code)
The size of the ArrayList (the number of elements it contains). We make it non-private to enable compiler do inlining for getSize() when -O flag turn on.



univ
VirtualUniverse univ(Code)




Constructor Detail
IndexedUnorderSet
IndexedUnorderSet(int initialCapacity, Class componentType, int listType, VirtualUniverse univ)(Code)
Constructs an empty list with the specified initial capacity. and the class data Type
Parameters:
  initialCapacity - the initial capacity of the list.
Parameters:
  componentType - class type of element in the list.



IndexedUnorderSet
IndexedUnorderSet(Class componentType, int listType, VirtualUniverse univ)(Code)
Constructs an empty list.
Parameters:
  componentType - class type of element in the list.



IndexedUnorderSet
IndexedUnorderSet(int initialCapacity, int listType, VirtualUniverse univ)(Code)
Constructs an empty list with the specified initial capacity.
Parameters:
  initialCapacity - the initial capacity of the list.



IndexedUnorderSet
IndexedUnorderSet(int listType, VirtualUniverse univ)(Code)
Constructs an empty list.
Parameters:
  listType - default to Object.




Method Detail
add
final synchronized void add(IndexedObject o)(Code)
Appends the specified element to the end of this list. It is the user responsible to ensure that the element add is of the same type as array componentType.
Parameters:
  o - element to be appended to this list.



arraySize
final int arraySize()(Code)
Returns the size of entry use in toArray() number of elements in this list. the number of elements in this list.



clear
final synchronized void clear()(Code)
Removes all of the elements from this list. The list will be empty after this call returns.



clearMirror
final synchronized void clearMirror()(Code)



clone
final protected synchronized Object clone()(Code)
Returns a shallow copy of this ArrayList instance. (The elements themselves are not copied.) a clone of this ArrayList instance.



contains
final synchronized boolean contains(IndexedObject o)(Code)
Returns true if this list contains the specified element.
Parameters:
  o - element whose presence in this List is to be tested.



get
final synchronized Object get(int index)(Code)
Returns the element at the specified position in this list.
Parameters:
  index - index of element to return. the element at the specified position in this list.
throws:
  IndexOutOfBoundsException - if index is out of range (index< 0 || index >= size()).



getComponentType
final Class getComponentType()(Code)



indexOf
final synchronized int indexOf(IndexedObject o)(Code)
Searches for the last occurence of the given argument, testing for equality using the equals method.
Parameters:
  o - an object. the index of the first occurrence of the argument in thislist; returns -1 if the object is not found.
See Also:   Object.equals(Object)



init
final static void init(IndexedObject obj, int len)(Code)
Initialize all indexes to -1



isEmpty
final boolean isEmpty()(Code)
Tests if this list has no elements. true if this list has no elements;false otherwise.



remove
final synchronized void remove(int index)(Code)
Removes the element at the specified position in this list. Replace the removed element by the last one.
Parameters:
  index - the index of the element to removed.
throws:
  IndexOutOfBoundsException - if index out of range (index< 0 || index >= size()).



remove
final synchronized boolean remove(IndexedObject o)(Code)
Removes the specified element in this list. Replace the removed element by the last one.
Parameters:
  o - the element to removed. true if object remove
throws:
  IndexOutOfBoundsException - if index out of range (index< 0 || index >= size()).



removeLastElement
final synchronized Object removeLastElement()(Code)
Removes the element at the last position in this list. The element remove
throws:
  IndexOutOfBoundsException - if array is empty



set
final synchronized void set(int index, IndexedObject o)(Code)
Replaces the element at the specified position in this list with the specified element.
Parameters:
  index - index of element to replace.
Parameters:
  o - element to be stored at the specified position. the element previously at the specified position.
throws:
  IndexOutOfBoundsException - if index out of range(index < 0 || index >= size()).



size
final int size()(Code)
Returns the number of elements in this list. the number of elements in this list.



toArray
final synchronized Object[] toArray(boolean copy)(Code)
Returns an array containing all of the elements in this list. The size of the array may longer than the actual size. Use arraySize() to retrieve the size. The array return is a copied of internal array. if copy is true. an array containing all of the elements in this list



toArray
final synchronized Object[] toArray()(Code)
Returns an array containing all of the elements in this list. The size of the array may longer than the actual size. Use arraySize() to retrieve the size. The array return is a copied of internal array. So another thread can continue add/delete the current list. However, it should be noticed that two call to toArray() may return the same copy. an array containing all of the elements in this list



toArray
final synchronized Object[] toArray(IndexedObject startElement)(Code)
Returns an array containing elements starting from startElement all of the elements in this list. A new array of exact size is always allocated.
Parameters:
  startElement - starting element to copy an array containing elements starting fromstartElement, null if element not found.



trimToSize
final synchronized void trimToSize()(Code)
Trims the capacity of this ArrayList instance to be the list's current size. An application can use this operation to minimize the storage of an ArrayList instance.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.