Java Doc for StoredIterator.java in  » JMX » je » com » sleepycat » collections » 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 » JMX » je » com.sleepycat.collections 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sleepycat.collections.StoredIterator

StoredIterator
public class StoredIterator implements BaseIterator,Cloneable(Code)
The Iterator returned by all stored collections.

While in general this class conforms to the Iterator interface, it is important to note that all iterators for stored collections must be explicitly closed with StoredIterator.close() . The static method StoredIterator.close(java.util.Iterator) allows calling close for all iterators without harm to iterators that are not from stored collections, and also avoids casting. If a stored iterator is not closed, unpredictable behavior including process death may result.

This class implements the Iterator interface for all stored iterators. It also implements ListIterator because some list iterator methods apply to all stored iterators, for example, StoredIterator.previous and StoredIterator.hasPrevious . Other list iterator methods are always supported for lists, but for other types of collections are only supported under certain conditions. See StoredIterator.nextIndex , StoredIterator.previousIndex , StoredIterator.add and StoredIterator.set for details.

In addition, this class provides the following methods for stored collection iterators only. Note that the use of these methods is not compatible with the standard Java collections interface.


author:
   Mark Hayes



Constructor Summary
 StoredIterator(StoredCollection coll, boolean writeAllowed, DataCursor joinCursor)
    

Method Summary
public  voidadd(Object value)
     Inserts the specified element into the list or inserts a duplicate into other types of collections (optional operation).
public static  voidclose(Iterator i)
     Closes the given iterator using StoredIterator.close() if it is a StoredIterator .
public  voidclose()
     Closes this iterator. This method does not exist in the standard Iterator or ListIterator interfaces.

After being closed, only the StoredIterator.hasNext and StoredIterator.hasPrevious methods may be called and these will return false.

public  intcount()
     Returns the number of elements having the same key value as the key value of the element last returned by next() or previous().
final public  ListIteratordup()
    
final public  StoredCollectiongetCollection()
     Returns the collection associated with this iterator.
public  booleanhasNext()
     Returns true if this iterator has more elements when traversing in the forward direction.
public  booleanhasPrevious()
     Returns true if this iterator has more elements when traversing in the reverse direction.
final public  booleanisCurrentData(Object currentData)
    
final public  booleanisReadModifyWrite()
     Returns whether write-locks will be obtained when reading with this cursor.
final public  booleanmoveToIndex(int index)
    
public  Objectnext()
     Returns the next element in the iteration.
public  intnextIndex()
     Returns the index of the element that would be returned by a subsequent call to next. This method conforms to the ListIterator.nextIndex interface except that it returns Integer.MAX_VALUE for stored lists when positioned at the end of the list, rather than returning the list size as specified by the ListIterator interface.
public  Objectprevious()
     Returns the next element in the iteration.
public  intpreviousIndex()
     Returns the index of the element that would be returned by a subsequent call to previous.
public  voidremove()
     Removes the last element that was returned by next or previous (optional operation).
public  voidset(Object value)
     Replaces the last element returned by next or previous with the specified element (optional operation).
public  voidsetReadModifyWrite(boolean lockForWrite)
     Changes whether write-locks will be obtained when reading with this cursor.


Constructor Detail
StoredIterator
StoredIterator(StoredCollection coll, boolean writeAllowed, DataCursor joinCursor)(Code)




Method Detail
add
public void add(Object value)(Code)
Inserts the specified element into the list or inserts a duplicate into other types of collections (optional operation). This method conforms to the ListIterator.add interface when the collection is a list and the RECNO-RENUMBER access method is used. Otherwise, this method may only be called when duplicates are allowed. If duplicates are unsorted, the new value will be inserted in the same manner as list elements. If duplicates are sorted, the new value will be inserted in sort order.

Note that for the JE product, RECNO-RENUMBER databases are not supported, and therefore this method may only be used to add duplicates.


Parameters:
  value - the new value.
throws:
  UnsupportedOperationException - if the collection is a sublist, orif the collection is indexed, or if the collection is read-only, or ifthe collection is a list and the RECNO-RENUMBER access method was notused, or if the collection is not a list and duplicates are not allowed.
throws:
  IllegalStateException - if the collection is empty and is not alist with RECNO-RENUMBER access.
throws:
  IllegalArgumentException - if a duplicate value is being addedthat already exists and duplicates are sorted.
throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



close
public static void close(Iterator i)(Code)
Closes the given iterator using StoredIterator.close() if it is a StoredIterator . If the given iterator is not a StoredIterator , this method does nothing.
Parameters:
  i - is the iterator to close.
throws:
  RuntimeExceptionWrapper - if a DatabaseException is thrown.



close
public void close()(Code)
Closes this iterator. This method does not exist in the standard Iterator or ListIterator interfaces.

After being closed, only the StoredIterator.hasNext and StoredIterator.hasPrevious methods may be called and these will return false. StoredIterator.close() may also be called again and will do nothing. If other methods are called a NullPointerException will generally be thrown.


throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



count
public int count()(Code)
Returns the number of elements having the same key value as the key value of the element last returned by next() or previous(). If no duplicates are allowed, 1 is always returned. This method does not exist in the standard Iterator or ListIterator interfaces. the number of duplicates.
throws:
  IllegalStateException - if next() or previous() has not beencalled for this iterator, or if remove() or add() were called afterthe last call to next() or previous().



dup
final public ListIterator dup()(Code)



getCollection
final public StoredCollection getCollection()(Code)
Returns the collection associated with this iterator. This method does not exist in the standard Iterator or ListIterator interfaces. the collection associated with this iterator.



hasNext
public boolean hasNext()(Code)
Returns true if this iterator has more elements when traversing in the forward direction. False is returned if the iterator has been closed. This method conforms to the Iterator.hasNext interface. whether StoredIterator.next() will succeed.
throws:
  RuntimeExceptionWrapper - if a DatabaseException is thrown.



hasPrevious
public boolean hasPrevious()(Code)
Returns true if this iterator has more elements when traversing in the reverse direction. It returns false if the iterator has been closed. This method conforms to the ListIterator.hasPrevious interface. whether StoredIterator.previous() will succeed.
throws:
  RuntimeExceptionWrapper - if a DatabaseException is thrown.



isCurrentData
final public boolean isCurrentData(Object currentData)(Code)



isReadModifyWrite
final public boolean isReadModifyWrite()(Code)
Returns whether write-locks will be obtained when reading with this cursor. Obtaining write-locks can prevent deadlocks when reading and then modifying data. the write-lock setting.



moveToIndex
final public boolean moveToIndex(int index)(Code)



next
public Object next()(Code)
Returns the next element in the iteration. This method conforms to the Iterator.next interface. the next element.
throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



nextIndex
public int nextIndex()(Code)
Returns the index of the element that would be returned by a subsequent call to next. This method conforms to the ListIterator.nextIndex interface except that it returns Integer.MAX_VALUE for stored lists when positioned at the end of the list, rather than returning the list size as specified by the ListIterator interface. This is because the database size is not available. the next index.
throws:
  UnsupportedOperationException - if this iterator's collection doesnot use record number keys.
throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



previous
public Object previous()(Code)
Returns the next element in the iteration. This method conforms to the ListIterator.previous interface. the previous element.
throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



previousIndex
public int previousIndex()(Code)
Returns the index of the element that would be returned by a subsequent call to previous. This method conforms to the ListIterator.previousIndex interface. the previous index.
throws:
  UnsupportedOperationException - if this iterator's collection doesnot use record number keys.
throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



remove
public void remove()(Code)
Removes the last element that was returned by next or previous (optional operation). This method conforms to the ListIterator.remove interface except that when the collection is a list and the RECNO-RENUMBER access method is not used, list indices will not be renumbered.

In order to call this method, if the underlying Database is transactional then a transaction must be active when creating the iterator.

Note that for the JE product, RECNO-RENUMBER databases are not supported, and therefore list indices are never renumbered by this method.


throws:
  UnsupportedOperationException - if the collection is a sublist, orif the collection is read-only.
throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



set
public void set(Object value)(Code)
Replaces the last element returned by next or previous with the specified element (optional operation). This method conforms to the ListIterator.set interface.

In order to call this method, if the underlying Database is transactional then a transaction must be active when creating the iterator.


Parameters:
  value - the new value.
throws:
  UnsupportedOperationException - if the collection is a StoredKeySet (the set returned by java.util.Map.keySet), or ifduplicates are sorted since this would change the iterator position, orif the collection is indexed, or if the collection is read-only.
throws:
  IllegalArgumentException - if an entity value binding is used andthe primary key of the value given is different than the existing storedprimary key.
throws:
  RuntimeExceptionWrapper - if a DatabaseException isthrown.



setReadModifyWrite
public void setReadModifyWrite(boolean lockForWrite)(Code)
Changes whether write-locks will be obtained when reading with this cursor. Obtaining write-locks can prevent deadlocks when reading and then modifying data.
Parameters:
  lockForWrite - the write-lock setting.



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.