Java Doc for CursorableLinkedList.java in  » Library » Apache-common-Collections » org » apache » commons » collections » list » 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 » Library » Apache common Collections » org.apache.commons.collections.list 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.collections.list.AbstractLinkedList
      org.apache.commons.collections.list.CursorableLinkedList

CursorableLinkedList
public class CursorableLinkedList extends AbstractLinkedList implements Serializable(Code)
A List implementation with a ListIterator that allows concurrent modifications to the underlying list.

This implementation supports all of the optional List operations. It extends AbstractLinkedList and thus provides the stack/queue/dequeue operations available in java.util.LinkedList .

The main feature of this class is the ability to modify the list and the iterator at the same time. Both the CursorableLinkedList.listIterator() and CursorableLinkedList.cursor() methods provides access to a Cursor instance which extends ListIterator. The cursor allows changes to the list concurrent with changes to the iterator. Note that the CursorableLinkedList.iterator() method and sublists do not provide this cursor behaviour.

The Cursor class is provided partly for backwards compatibility and partly because it allows the cursor to be directly closed. Closing the cursor is optional because references are held via a WeakReference. For most purposes, simply modify the iterator and list at will, and then let the garbage collector to the rest.

Note that this implementation is not synchronized.
See Also:   java.util.LinkedList
since:
   Commons Collections 1.0
version:
   $Revision: 348013 $ $Date: 2005-11-21 23:24:45 +0000 (Mon, 21 Nov 2005) $
author:
   Rodney Waldhoff
author:
   Janek Bogucki
author:
   Simon Kitching
author:
   Stephen Colebourne


Inner Class :public static class Cursor extends AbstractLinkedList.LinkedListIterator
Inner Class :protected static class SubCursor extends Cursor

Field Summary
protected transient  Listcursors
    

Constructor Summary
public  CursorableLinkedList()
     Constructor that creates.
public  CursorableLinkedList(Collection coll)
    

Method Summary
protected  voidaddNode(Node nodeToInsert, Node insertBeforeNode)
     Inserts a new node into the list.
protected  voidbroadcastNodeChanged(Node node)
     Informs all of my registered cursors that the specified element was changed.
protected  voidbroadcastNodeInserted(Node node)
     Informs all of my registered cursors that the specified element was just added to my list.
protected  voidbroadcastNodeRemoved(Node node)
     Informs all of my registered cursors that the specified element was just removed from my list.
protected  ListIteratorcreateSubListListIterator(LinkedSubList subList, int fromIndex)
     Creates a list iterator for the sublist.
public  CursorableLinkedList.Cursorcursor()
     Returns a Cursor for iterating through the elements of this list.

A Cursor is a ListIterator with an additional close() method.

public  CursorableLinkedList.Cursorcursor(int fromIndex)
     Returns a Cursor for iterating through the elements of this list starting from a specified index.

A Cursor is a ListIterator with an additional close() method.

protected  voidinit()
     The equivalent of a default constructor called by any constructor and by readObject.
public  Iteratoriterator()
     Returns an iterator that does not support concurrent modification.
public  ListIteratorlistIterator()
     Returns a cursor iterator that allows changes to the underlying list in parallel.

The cursor enables iteration and list changes to occur in any order without invalidating the iterator (from one thread).

public  ListIteratorlistIterator(int fromIndex)
     Returns a cursor iterator that allows changes to the underlying list in parallel.

The cursor enables iteration and list changes to occur in any order without invalidating the iterator (from one thread).

protected  voidregisterCursor(Cursor cursor)
     Registers a cursor to be notified of changes to this list.
protected  voidremoveAllNodes()
     Removes all nodes by iteration.
protected  voidremoveNode(Node node)
     Removes the specified node from the list.
protected  voidunregisterCursor(Cursor cursor)
     Deregisters a cursor from the list to be notified of changes.
protected  voidupdateNode(Node node, Object value)
     Updates the node with a new value.

Field Detail
cursors
protected transient List cursors(Code)
A list of the cursor currently open on this list




Constructor Detail
CursorableLinkedList
public CursorableLinkedList()(Code)
Constructor that creates.



CursorableLinkedList
public CursorableLinkedList(Collection coll)(Code)
Constructor that copies the specified collection
Parameters:
  coll - the collection to copy




Method Detail
addNode
protected void addNode(Node nodeToInsert, Node insertBeforeNode)(Code)
Inserts a new node into the list.
Parameters:
  nodeToInsert - new node to insert
Parameters:
  insertBeforeNode - node to insert before
throws:
  NullPointerException - if either node is null



broadcastNodeChanged
protected void broadcastNodeChanged(Node node)(Code)
Informs all of my registered cursors that the specified element was changed.
Parameters:
  node - the node that was changed



broadcastNodeInserted
protected void broadcastNodeInserted(Node node)(Code)
Informs all of my registered cursors that the specified element was just added to my list.
Parameters:
  node - the node that was changed



broadcastNodeRemoved
protected void broadcastNodeRemoved(Node node)(Code)
Informs all of my registered cursors that the specified element was just removed from my list.
Parameters:
  node - the node that was changed



createSubListListIterator
protected ListIterator createSubListListIterator(LinkedSubList subList, int fromIndex)(Code)
Creates a list iterator for the sublist.
Parameters:
  subList - the sublist to get an iterator for
Parameters:
  fromIndex - the index to start from, relative to the sublist



cursor
public CursorableLinkedList.Cursor cursor()(Code)
Returns a Cursor for iterating through the elements of this list.

A Cursor is a ListIterator with an additional close() method. Calling this method immediately discards the references to the cursor. If it is not called, then the garbage collector will still remove the reference as it is held via a WeakReference.

The cursor enables iteration and list changes to occur in any order without invalidating the iterator (from one thread). When elements are added to the list, an event is fired to all active cursors enabling them to adjust to the change in the list.

When the "current" (i.e., last returned by ListIterator.next or ListIterator.previous ) element of the list is removed, the cursor automatically adjusts to the change (invalidating the last returned value such that it cannot be removed).

The CursorableLinkedList.listIterator() method returns the same as this method, and can be cast to a Cursor if the close method is required. a new cursor iterator




cursor
public CursorableLinkedList.Cursor cursor(int fromIndex)(Code)
Returns a Cursor for iterating through the elements of this list starting from a specified index.

A Cursor is a ListIterator with an additional close() method. Calling this method immediately discards the references to the cursor. If it is not called, then the garbage collector will still remove the reference as it is held via a WeakReference.

The cursor enables iteration and list changes to occur in any order without invalidating the iterator (from one thread). When elements are added to the list, an event is fired to all active cursors enabling them to adjust to the change in the list.

When the "current" (i.e., last returned by ListIterator.next or ListIterator.previous ) element of the list is removed, the cursor automatically adjusts to the change (invalidating the last returned value such that it cannot be removed).

The CursorableLinkedList.listIterator(int) method returns the same as this method, and can be cast to a Cursor if the close method is required.
Parameters:
  fromIndex - the index to start from a new cursor iterator
throws:
  IndexOutOfBoundsException - if the index is out of range(index < 0 || index > size()).




init
protected void init()(Code)
The equivalent of a default constructor called by any constructor and by readObject.



iterator
public Iterator iterator()(Code)
Returns an iterator that does not support concurrent modification.

If the underlying list is modified while iterating using this iterator a ConcurrentModificationException will occur. The cursor behaviour is available via CursorableLinkedList.listIterator() . a new iterator that does not support concurrent modification




listIterator
public ListIterator listIterator()(Code)
Returns a cursor iterator that allows changes to the underlying list in parallel.

The cursor enables iteration and list changes to occur in any order without invalidating the iterator (from one thread). When elements are added to the list, an event is fired to all active cursors enabling them to adjust to the change in the list.

When the "current" (i.e., last returned by ListIterator.next or ListIterator.previous ) element of the list is removed, the cursor automatically adjusts to the change (invalidating the last returned value such that it cannot be removed). a new cursor iterator




listIterator
public ListIterator listIterator(int fromIndex)(Code)
Returns a cursor iterator that allows changes to the underlying list in parallel.

The cursor enables iteration and list changes to occur in any order without invalidating the iterator (from one thread). When elements are added to the list, an event is fired to all active cursors enabling them to adjust to the change in the list.

When the "current" (i.e., last returned by ListIterator.next or ListIterator.previous ) element of the list is removed, the cursor automatically adjusts to the change (invalidating the last returned value such that it cannot be removed).
Parameters:
  fromIndex - the index to start from a new cursor iterator




registerCursor
protected void registerCursor(Cursor cursor)(Code)
Registers a cursor to be notified of changes to this list.
Parameters:
  cursor - the cursor to register



removeAllNodes
protected void removeAllNodes()(Code)
Removes all nodes by iteration.



removeNode
protected void removeNode(Node node)(Code)
Removes the specified node from the list.
Parameters:
  node - the node to remove
throws:
  NullPointerException - if node is null



unregisterCursor
protected void unregisterCursor(Cursor cursor)(Code)
Deregisters a cursor from the list to be notified of changes.
Parameters:
  cursor - the cursor to deregister



updateNode
protected void updateNode(Node node, Object value)(Code)
Updates the node with a new value. This implementation sets the value on the node. Subclasses can override this to record the change.
Parameters:
  node - node to update
Parameters:
  value - new value of the node



Fields inherited from org.apache.commons.collections.list.AbstractLinkedList
protected transient Node header(Code)(Java Doc)
protected transient int modCount(Code)(Java Doc)
protected transient int size(Code)(Java Doc)

Methods inherited from org.apache.commons.collections.list.AbstractLinkedList
public boolean add(Object value)(Code)(Java Doc)
public void add(int index, Object value)(Code)(Java Doc)
public boolean addAll(Collection coll)(Code)(Java Doc)
public boolean addAll(int index, Collection coll)(Code)(Java Doc)
public boolean addFirst(Object o)(Code)(Java Doc)
public boolean addLast(Object o)(Code)(Java Doc)
protected void addNode(Node nodeToInsert, Node insertBeforeNode)(Code)(Java Doc)
protected void addNodeAfter(Node node, Object value)(Code)(Java Doc)
protected void addNodeBefore(Node node, Object value)(Code)(Java Doc)
public void clear()(Code)(Java Doc)
public boolean contains(Object value)(Code)(Java Doc)
public boolean containsAll(Collection coll)(Code)(Java Doc)
protected Node createHeaderNode()(Code)(Java Doc)
protected Node createNode(Object value)(Code)(Java Doc)
protected Iterator createSubListIterator(LinkedSubList subList)(Code)(Java Doc)
protected ListIterator createSubListListIterator(LinkedSubList subList, int fromIndex)(Code)(Java Doc)
protected void doReadObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException(Code)(Java Doc)
protected void doWriteObject(ObjectOutputStream outputStream) throws IOException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
public Object get(int index)(Code)(Java Doc)
public Object getFirst()(Code)(Java Doc)
public Object getLast()(Code)(Java Doc)
protected Node getNode(int index, boolean endMarkerAllowed) throws IndexOutOfBoundsException(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public int indexOf(Object value)(Code)(Java Doc)
protected void init()(Code)(Java Doc)
public boolean isEmpty()(Code)(Java Doc)
protected boolean isEqualValue(Object value1, Object value2)(Code)(Java Doc)
public Iterator iterator()(Code)(Java Doc)
public int lastIndexOf(Object value)(Code)(Java Doc)
public ListIterator listIterator()(Code)(Java Doc)
public ListIterator listIterator(int fromIndex)(Code)(Java Doc)
public Object remove(int index)(Code)(Java Doc)
public boolean remove(Object value)(Code)(Java Doc)
public boolean removeAll(Collection coll)(Code)(Java Doc)
protected void removeAllNodes()(Code)(Java Doc)
public Object removeFirst()(Code)(Java Doc)
public Object removeLast()(Code)(Java Doc)
protected void removeNode(Node node)(Code)(Java Doc)
public boolean retainAll(Collection coll)(Code)(Java Doc)
public Object set(int index, Object value)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public List subList(int fromIndexInclusive, int toIndexExclusive)(Code)(Java Doc)
public Object[] toArray()(Code)(Java Doc)
public Object[] toArray(Object[] array)(Code)(Java Doc)
public String toString()(Code)(Java Doc)
protected void updateNode(Node node, Object value)(Code)(Java Doc)

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.