Java Doc for RecordEnumeration.java in  » 6.0-JDK-Modules » j2me » javax » microedition » rms » 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 » j2me » javax.microedition.rms 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.microedition.rms.RecordEnumeration

All known Subclasses:   javax.microedition.rms.RecordEnumerationImpl,
RecordEnumeration
public interface RecordEnumeration (Code)
An interface representing a bidirectional record store Record enumerator. The RecordEnumeration logically maintains a sequence of the recordId's of the records in a record store. The enumerator will iterate over all (or a subset, if an optional record filter has been supplied) of the records in an order determined by an optional record comparator.

By using an optional RecordFilter, a subset of the records can be chosen that match the supplied filter. This can be used for providing search capabilities.

By using an optional RecordComparator, the enumerator can index through the records in an order determined by the comparator. This can be used for providing sorting capabilities.

If, while indexing through the enumeration, some records are deleted from the record store, the recordId's returned by the enumeration may no longer represent valid records. To avoid this problem, the RecordEnumeration can optionally become a listener of the RecordStore and react to record additions and deletions by recreating its internal index. Use special care when using this option however, in that every record addition, change and deletion will cause the index to be rebuilt, which may have serious performance impacts.

If the RecordStore used by this RecordEnumeration is closed, this RecordEnumeration becomes invalid and all subsequent operations performed on it may give invalid results or throw a RecordStoreNotOpenException, even if the same RecordStore is later opened again. In addition, calls to hasNextElement() and hasPreviousElement() will return false.

The first call to nextRecord() returns the record data from the first record in the sequence. Subsequent calls to nextRecord() return the next consecutive record's data. To return the record data from the previous consecutive from any given point in the enumeration, call previousRecord(). On the other hand, if after creation, the first call is to previousRecord(), the record data of the last element of the enumeration will be returned. Each subsequent call to previousRecord() will step backwards through the sequence until the beginning is reached.

Final note, to do record store searches, create a RecordEnumeration with no RecordComparator, and an appropriate RecordFilter with the desired search criterion.


since:
   MIDP 1.0




Method Summary
public  voiddestroy()
     Frees internal resources used by this RecordEnumeration. MIDlets should call this method when they are done using a RecordEnumeration.
public  booleanhasNextElement()
     Returns true if more elements exist in the next direction.
public  booleanhasPreviousElement()
     Returns true if more elements exist in the previous direction.
public  booleanisKeptUpdated()
     Returns true if the enumeration keeps its enumeration current with any changes in the records.
public  voidkeepUpdated(boolean keepUpdated)
     Used to set whether the enumeration will be keep its internal index up to date with the record store record additions/deletions/changes.
public  byte[]nextRecord()
     Returns a copy of the next record in this enumeration, where next is defined by the comparator and/or filter supplied in the constructor of this enumerator.
public  intnextRecordId()
     Returns the recordId of the next record in this enumeration, where next is defined by the comparator and/or filter supplied in the constructor of this enumerator.
public  intnumRecords()
     Returns the number of records available in this enumeration's set.
public  byte[]previousRecord()
     Returns a copy of the previous record in this enumeration, where previous is defined by the comparator and/or filter supplied in the constructor of this enumerator.
public  intpreviousRecordId()
     Returns the recordId of the previous record in this enumeration, where previous is defined by the comparator and/or filter supplied in the constructor of this enumerator.
public  voidrebuild()
     Request that the enumeration be updated to reflect the current record set.
public  voidreset()
     Returns the enumeration index to the same state as right after the enumeration was created.



Method Detail
destroy
public void destroy()(Code)
Frees internal resources used by this RecordEnumeration. MIDlets should call this method when they are done using a RecordEnumeration. If a MIDlet tries to use a RecordEnumeration after this method has been called, it will throw a IllegalStateException. Note that this method is used for manually aiding in the minimization of immediate resource requirements when this enumeration is no longer needed.



hasNextElement
public boolean hasNextElement()(Code)
Returns true if more elements exist in the next direction. true if more elements exist in the nextdirection



hasPreviousElement
public boolean hasPreviousElement()(Code)
Returns true if more elements exist in the previous direction. true if more elements exist in the previousdirection



isKeptUpdated
public boolean isKeptUpdated()(Code)
Returns true if the enumeration keeps its enumeration current with any changes in the records. true if the enumeration keeps its enumerationcurrent with any changes in the records



keepUpdated
public void keepUpdated(boolean keepUpdated)(Code)
Used to set whether the enumeration will be keep its internal index up to date with the record store record additions/deletions/changes. Note that this should be used carefully due to the potential performance problems associated with maintaining the enumeration with every change.
Parameters:
  keepUpdated - if true, the enumerator will keep itsenumeration current with any changes in the records ofthe record store. Use with caution as there arepossible performance consequences. CallingkeepUpdated(true) has the same effect ascalling RecordEnumeration.rebuild: theenumeration will be updated to reflect the currentrecord set. If false the enumeration will not be keptcurrent and may return recordIds for records that havebeen deleted or miss records that are added later. Itmay also return records out of order that have beenmodified after the enumeration was built. Note thatany changes to records in the record store areaccurately reflected when the record is laterretrieved, either directly or through theenumeration. The thing that is risked by setting thisparameter false is the filtering and sorting order ofthe enumeration when records are modified, added, ordeleted.
See Also:   RecordEnumeration.rebuild



nextRecord
public byte[] nextRecord() throws InvalidRecordIDException, RecordStoreNotOpenException, RecordStoreException(Code)
Returns a copy of the next record in this enumeration, where next is defined by the comparator and/or filter supplied in the constructor of this enumerator. The byte array returned is a copy of the record. Any changes made to this array will NOT be reflected in the record store. After calling this method, the enumeration is advanced to the next available record.
exception:
  InvalidRecordIDException - when no more records areavailable. Subsequent calls to this method willcontinue to throw this exception untilreset() has been called to reset theenumeration.
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  RecordStoreException - if a general record storeexception occurs the next record in this enumeration



nextRecordId
public int nextRecordId() throws InvalidRecordIDException(Code)
Returns the recordId of the next record in this enumeration, where next is defined by the comparator and/or filter supplied in the constructor of this enumerator. After calling this method, the enumeration is advanced to the next available record.
exception:
  InvalidRecordIDException - when no more records areavailable. Subsequent calls to this method willcontinue to throw this exception untilreset() has been called to reset theenumeration. the recordId of the next record in this enumeration



numRecords
public int numRecords()(Code)
Returns the number of records available in this enumeration's set. That is, the number of records that have matched the filter criterion. Note that this forces the RecordEnumeration to fully build the enumeration by applying the filter to all records, which may take a non-trivial amount of time if there are a lot of records in the record store. the number of records available in this enumeration'sset. That is, the number of records that have matchedthe filter criterion.



previousRecord
public byte[] previousRecord() throws InvalidRecordIDException, RecordStoreNotOpenException, RecordStoreException(Code)
Returns a copy of the previous record in this enumeration, where previous is defined by the comparator and/or filter supplied in the constructor of this enumerator. The byte array returned is a copy of the record. Any changes made to this array will NOT be reflected in the record store. After calling this method, the enumeration is advanced to the next (previous) available record.
exception:
  InvalidRecordIDException - when no more records areavailable. Subsequent calls to this method willcontinue to throw this exception untilreset() has been called to reset theenumeration.
exception:
  RecordStoreNotOpenException - if the record store isnot open
exception:
  RecordStoreException - if a general record storeexception occurs. the previous record in this enumeration



previousRecordId
public int previousRecordId() throws InvalidRecordIDException(Code)
Returns the recordId of the previous record in this enumeration, where previous is defined by the comparator and/or filter supplied in the constructor of this enumerator. After calling this method, the enumeration is advanced to the next (previous) available record.
exception:
  InvalidRecordIDException - when no more records areavailable. Subsequent calls to this method willcontinue to throw this exception untilreset() has been called to reset theenumeration. the recordId of the previous record in this enumeration



rebuild
public void rebuild()(Code)
Request that the enumeration be updated to reflect the current record set. Useful for when a MIDlet makes a number of changes to the record store, and then wants an existing RecordEnumeration to enumerate the new changes.
See Also:   RecordEnumeration.keepUpdated



reset
public void reset()(Code)
Returns the enumeration index to the same state as right after the enumeration was created.



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