@@ -114,52 +114,6 @@ public <D extends MaybeDocument> DocumentChanges computeDocChanges(
114
114
return computeDocChanges (docChanges , null );
115
115
}
116
116
117
- /**
118
- * Computes the initial set of document changes based on the provided documents.
119
- *
120
- * <p>Unlike `computeDocChanges`, documents with committed mutations don't raise
121
- * `hasPendingWrites`. This distinction allows us to only raise `hasPendingWrite` events for
122
- * documents that changed during the lifetime of the View.
123
- *
124
- * @param docs The docs to apply to this view.
125
- * @return A new set of docs, changes, and refill flag.
126
- */
127
- public <D extends MaybeDocument > DocumentChanges computeInitialChanges (
128
- ImmutableSortedMap <DocumentKey , D > docs ) {
129
- hardAssert (
130
- this .documentSet .isEmpty (), "computeInitialChanges() called when docs are already present" );
131
-
132
- DocumentViewChangeSet changeSet = new DocumentViewChangeSet ();
133
- ImmutableSortedSet <DocumentKey > newMutatedKeys = this .mutatedKeys ;
134
- DocumentSet newDocumentSet = this .documentSet ;
135
-
136
- for (Map .Entry <DocumentKey , ? extends MaybeDocument > entry : docs ) {
137
- DocumentKey key = entry .getKey ();
138
- MaybeDocument maybeDoc = entry .getValue ();
139
-
140
- if (maybeDoc instanceof Document ) {
141
- Document doc = (Document ) maybeDoc ;
142
- if (this .query .matches (doc )) {
143
- changeSet .addChange (DocumentViewChange .create (Type .ADDED , doc ));
144
- newDocumentSet = newDocumentSet .add (doc );
145
- if (doc .hasLocalMutations ()) {
146
- newMutatedKeys = newMutatedKeys .insert (key );
147
- }
148
- }
149
- }
150
- }
151
-
152
- if (this .query .hasLimit ()) {
153
- for (long i = newDocumentSet .size () - this .query .getLimit (); i > 0 ; --i ) {
154
- Document oldDoc = newDocumentSet .getLastDocument ();
155
- newDocumentSet = newDocumentSet .remove (oldDoc .getKey ());
156
- newMutatedKeys = newMutatedKeys .remove (oldDoc .getKey ());
157
- changeSet .addChange (DocumentViewChange .create (Type .REMOVED , oldDoc ));
158
- }
159
- }
160
- return new DocumentChanges (newDocumentSet , changeSet , newMutatedKeys , /*needsRefill=*/ false );
161
- }
162
-
163
117
/**
164
118
* Iterates over a set of doc changes, applies the query limit, and computes what the new results
165
119
* should be, what the changes were, and whether we may need to go back to the local cache for
0 commit comments