Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit d505f84

Browse files
vicbmhevery
authored andcommitted
refactor(dccd): Simplify both the interface and the implementation
Closes #909
1 parent f5bf7ef commit d505f84

File tree

5 files changed

+203
-247
lines changed

5 files changed

+203
-247
lines changed

lib/change_detection/change_detection.dart

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,11 @@ abstract class CollectionChangeRecord<V> {
176176
Iterable get iterable;
177177
int get length;
178178

179-
/** A list of [CollectionItem]s which are in the iteration order. */
180-
CollectionItem<V> get collectionHead;
181-
PreviousCollectionItem<V> get previousCollectionHead;
182-
/** A list of new [AddedItem]s. */
183-
AddedItem<V> get additionsHead;
184-
/** A list of [MovedItem]s. */
185-
MovedItem<V> get movesHead;
186-
/** A list of [RemovedItem]s. */
187-
RemovedItem<V> get removalsHead;
188-
189-
void forEachAddition(void f(AddedItem<V> addition));
190-
void forEachMove(void f(MovedItem<V> move));
191-
void forEachRemoval(void f(RemovedItem<V> removal));
179+
void forEachItem(void f(CollectionChangeItem<V> item));
180+
void forEachPreviousItem(void f(CollectionChangeItem<V> previousItem));
181+
void forEachAddition(void f(CollectionChangeItem<V> addition));
182+
void forEachMove(void f(CollectionChangeItem<V> move));
183+
void forEachRemoval(void f(CollectionChangeItem<V> removal));
192184
}
193185

194186
/**
@@ -206,42 +198,6 @@ abstract class CollectionChangeItem<V> {
206198
V get item;
207199
}
208200

209-
/**
210-
* Used to create a linked list of collection items. These items are always in
211-
* the iteration order of the collection.
212-
*/
213-
abstract class CollectionItem<V> extends CollectionChangeItem<V> {
214-
CollectionItem<V> get nextCollectionItem;
215-
}
216-
217-
/**
218-
* A linked list of new items added to the collection. These items are always in
219-
* the iteration order of the collection.
220-
*/
221-
abstract class PreviousCollectionItem<V> extends CollectionChangeItem<V> {
222-
PreviousCollectionItem<V> get previousNextItem;
223-
}
224-
225-
abstract class AddedItem<V> extends CollectionChangeItem<V> {
226-
AddedItem<V> get nextAddedItem;
227-
}
228-
229-
/**
230-
* A linked list of items moved in the collection. These items are always in
231-
* the iteration order of the collection.
232-
*/
233-
abstract class MovedItem<V> extends CollectionChangeItem<V> {
234-
MovedItem<V> get nextMovedItem;
235-
}
236-
237-
/**
238-
* A linked list of items removed from the collection. These items are always
239-
* in the iteration order of the collection.
240-
*/
241-
abstract class RemovedItem<V> extends CollectionChangeItem<V> {
242-
RemovedItem<V> get nextRemovedItem;
243-
}
244-
245201
typedef dynamic FieldGetter(object);
246202
typedef void FieldSetter(object, value);
247203

0 commit comments

Comments
 (0)