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. |