Interface record enumeration


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Interface record enumeration

  1. 1. Interface RecordEnumeration Interface RecordEnumeration
  2. 2. • It is used to retrieve data from the record store • It also helps us to sort the records and searching the records • RecordEnumeration is build by calling enumerateRecords() method • 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. Interface RecordEnumeration
  3. 3. • 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. Interface RecordEnumeration
  4. 4. • • • 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. Interface RecordEnumeration
  5. 5. hasNextElement() • It checks whether there is next record(another) available in Record Enumeration. • It returns boolean ‘true’, if next record exists, false otherwise • Generally it is used in the looping statements Interface RecordEnumeration
  6. 6. Rebuild() • A RecordEnumeration can be rebuild by explicitly calling the rebuild(). • This method is required, when automatic updation mode is disabled and record store is updated. Interface RecordEnumeration
  7. 7. keepUpdated() • This method sets the RecordEnumeration to automatic updation mode, wherein the enumeration is rebuilt whenever the records are updated Interface RecordEnumeration