| java.lang.Object javax.microedition.rms.RecordEnumerationImpl
Constructor Summary | |
| RecordEnumerationImpl(RecordStore inp_recordStore, RecordFilter inp_filter, RecordComparator inp_comparator, boolean keepUpdated) Builds an enumeration to traverse a set of records in the
given record store in an optionally specified order.
The filter, if non-null, will be used to determine what
subset of the record store records will be used.
The comparator, if non-null, will be used to determine the
order in which the records are returned.
If both the filter and comparator are null, the enumeration
will traverse all records in the record store in an undefined
order. |
Method Summary | |
public synchronized void | destroy() Implements RecordEnumeration.destroy() interface. | public boolean | hasNextElement() Returns true if more elements exist in the next direction. | public boolean | hasPreviousElement() Returns true if more elements exist in the previous direction. | public boolean | isKeptUpdated() Returns true if the enumeration keeps its enumeration
current with any changes in the records. | public void | keepUpdated(boolean keepUpdated) Used to set whether the enumeration should be registered
as a listener of the record store, and rebuild its internal
index with every record addition/deletion in the record store.
Note that this should be used carefully due to the potential
performance cost associated with maintaining the
enumeration with every change.
Parameters: keepUpdated - if true, the enumerator will keep its enumerationcurrent with any changes in the records of the record store.Use with caution as there are possible performance consequences.If false, the enumeration will not be kept current and may return recordIds for records that have been deleted or miss records that are added later. | public synchronized 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 synchronized int | nextRecordId() 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 synchronized int | numRecords() Returns the number of records available in this enumeration's
set. | public synchronized 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 synchronized int | previousRecordId() 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 void | rebuild() Request that the enumeration be updated to reflect the current
record set. | public synchronized void | recordAdded(RecordStore inp_recordStore, int recordId) From the RecordListener interface. | public synchronized void | recordChanged(RecordStore inp_recordStore, int recordId) From the RecordListener interface. | public synchronized void | recordDeleted(RecordStore inp_recordStore, int recordId) From the RecordListener interface. | public void | reset() Returns the index point of the enumeration to the beginning. |
RecordEnumerationImpl | RecordEnumerationImpl(RecordStore inp_recordStore, RecordFilter inp_filter, RecordComparator inp_comparator, boolean keepUpdated)(Code) | | Builds an enumeration to traverse a set of records in the
given record store in an optionally specified order.
The filter, if non-null, will be used to determine what
subset of the record store records will be used.
The comparator, if non-null, will be used to determine the
order in which the records are returned.
If both the filter and comparator are null, the enumeration
will traverse all records in the record store in an undefined
order. This is the most efficient way to traverse all of the
records in a record store.
Parameters: inp_recordStore - the RecordStore to enumerate. Parameters: inp_filter - if non-null, will be used to determine whatsubset of the record store records will be used. Parameters: inp_comparator - if non-null, will be used to determine theorder in which the records are returned. Parameters: keepUpdated - if true, the enumerator will keep its enumerationcurrent with any changes in the records of the record store. Use with caution as there are performance consequences. See Also: RecordEnumerationImpl.rebuild |
destroy | public synchronized void destroy()(Code) | | Implements RecordEnumeration.destroy() interface. Called
to signal that this enumeration will no longer be used, and that
its resources may be collected.
|
hasNextElement | public boolean hasNextElement()(Code) | | Returns true if more elements exist in the next direction.
true if more elements exist in the next direction. |
hasPreviousElement | public boolean hasPreviousElement()(Code) | | Returns true if more elements exist in the previous direction.
true if more elements exist in the previous direction. |
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 should be registered
as a listener of the record store, and rebuild its internal
index with every record addition/deletion in the record store.
Note that this should be used carefully due to the potential
performance cost associated with maintaining the
enumeration with every change.
Parameters: keepUpdated - if true, the enumerator will keep its enumerationcurrent with any changes in the records of the record store.Use with caution as there are possible performance consequences.If false, the enumeration will not be kept current and may return recordIds for records that have been deleted or miss records that are added later. It may also return records outof order that have been modified after the enumeration was built. See Also: RecordEnumerationImpl.rebuild |
nextRecord | public synchronized 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 - no more records are available the next record in this enumeration. |
nextRecordId | public synchronized 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 - no more records are available. the recordId of the next record in this enumeration. |
numRecords | public synchronized 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 matched the filter criterion. |
previousRecord | public synchronized 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 - no more records are available. the previous record in this enumeration. |
previousRecordId | public synchronized 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 this method
is called, the enumeration is advanced to the next (previous)
available record.
exception: InvalidRecordIDException - when no more records are available. 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 an application makes a number of
changes to the record store, and then wants an existing
RecordEnumeration to enumerate the new changes.
See Also: RecordEnumerationImpl.keepUpdated |
recordAdded | public synchronized void recordAdded(RecordStore inp_recordStore, int recordId)(Code) | | From the RecordListener interface. This method is called if
a record is added to recordStore .
Parameters: inp_recordStore - the record store to which a record was added Parameters: recordId - the record ID of the new record |
recordChanged | public synchronized void recordChanged(RecordStore inp_recordStore, int recordId)(Code) | | From the RecordListener interface. This method is called if
a record in recordStore is modified.
Parameters: inp_recordStore - the record store in which a record was modified Parameters: recordId - the record ID of the modified record. |
recordDeleted | public synchronized void recordDeleted(RecordStore inp_recordStore, int recordId)(Code) | | From the RecordListener interface. This method is called when a
record in recordStore is deleted.
Parameters: inp_recordStore - the record store from which a record was deleted Parameters: recordId - the record id of the deleted record |
reset | public void reset()(Code) | | Returns the index point of the enumeration to the beginning.
|
|
|