public interface OrderedCollectionChangeSet
OrderedCollectionChangeSet
is passed to the OrderedRealmCollectionChangeListener
which is registered
by RealmResults.addChangeListener(OrderedRealmCollectionChangeListener)
.
The change information is available in two formats: a simple array of row indices in the collection for each type of
change, or an array of OrderedCollectionChangeSet.Range
s.
Modifier and Type | Interface and Description |
---|---|
static class |
OrderedCollectionChangeSet.Range |
static class |
OrderedCollectionChangeSet.State
State describing the nature of the changeset.
|
Modifier and Type | Method and Description |
---|---|
OrderedCollectionChangeSet.Range[] |
getChangeRanges()
The modified ranges of objects in the new version of the collection.
|
int[] |
getChanges()
The modified indices in the new version of the collection.
|
OrderedCollectionChangeSet.Range[] |
getDeletionRanges()
The deleted ranges of objects in the previous version of the collection.
|
int[] |
getDeletions()
The deleted indices in the previous version of the collection.
|
Throwable |
getError()
Returns any error that happened.
|
OrderedCollectionChangeSet.Range[] |
getInsertionRanges()
The inserted ranges of objects in the new version of the collection.
|
int[] |
getInsertions()
The inserted indices in the new version of the collection.
|
OrderedCollectionChangeSet.State |
getState()
Returns the state represented by this change.
|
boolean |
isCompleteResult()
Returns
true if the query result is considered "complete". |
OrderedCollectionChangeSet.State getState()
OrderedCollectionChangeSet.State
for a description of the
different states a changeset can be in.OrderedCollectionChangeSet.State
int[] getDeletions()
int[] getInsertions()
int[] getChanges()
For RealmResults
, this means that one or more of the properties of the object at the given index were
modified (or an object linked to by that object was modified).
OrderedCollectionChangeSet.Range[] getDeletionRanges()
OrderedCollectionChangeSet.Range
array. A zero-sized array will be returned if no objects were deleted.OrderedCollectionChangeSet.Range[] getInsertionRanges()
OrderedCollectionChangeSet.Range
array. A zero-sized array will be returned if no objects were inserted.OrderedCollectionChangeSet.Range[] getChangeRanges()
OrderedCollectionChangeSet.Range
array. A zero-sized array will be returned if no objects were modified.Throwable getError()
boolean isCompleteResult()
true
if the query result is considered "complete". For all local Realms, or
fully synchronized Realms, this method will always return true
.
This method thus only makes sense for query-based synchronized Realms.
For those Realms, data is only downloaded when queried which means that until the data is downloaded, a local query might return a query result that would not have been possible on a fully synchronized Realm.
Consider the following case:
The first is when the "Realm" query runs for the first time. The local query will finish faster than the network can download data so the query will initially report an empty incomplete query result.
The second is when the "Database" query is run. The initial query result will not be empty, but contain all messages that contain both "Realm" and "Database", as they are already available offline.
In both cases, a new notification will be triggered as soon as the device is able to download the data required to produce a "complete" query result.
true
if the query result is fully consistent with the server at some point in
time. false
if the query was executed while the device was offline or all data
has not been downloaded yet.