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

refactor(dccd): Simplify both the interface and the implementation #909

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 5 additions & 49 deletions lib/change_detection/change_detection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,11 @@ abstract class CollectionChangeRecord<V> {
Iterable get iterable;
int get length;

/** A list of [CollectionItem]s which are in the iteration order. */
CollectionItem<V> get collectionHead;
PreviousCollectionItem<V> get previousCollectionHead;
/** A list of new [AddedItem]s. */
AddedItem<V> get additionsHead;
/** A list of [MovedItem]s. */
MovedItem<V> get movesHead;
/** A list of [RemovedItem]s. */
RemovedItem<V> get removalsHead;

void forEachAddition(void f(AddedItem<V> addition));
void forEachMove(void f(MovedItem<V> move));
void forEachRemoval(void f(RemovedItem<V> removal));
void forEachItem(void f(CollectionChangeItem<V> item));
void forEachPreviousItem(void f(CollectionChangeItem<V> previousItem));
void forEachAddition(void f(CollectionChangeItem<V> addition));
void forEachMove(void f(CollectionChangeItem<V> move));
void forEachRemoval(void f(CollectionChangeItem<V> removal));
}

/**
Expand All @@ -206,42 +198,6 @@ abstract class CollectionChangeItem<V> {
V get item;
}

/**
* Used to create a linked list of collection items. These items are always in
* the iteration order of the collection.
*/
abstract class CollectionItem<V> extends CollectionChangeItem<V> {
CollectionItem<V> get nextCollectionItem;
}

/**
* A linked list of new items added to the collection. These items are always in
* the iteration order of the collection.
*/
abstract class PreviousCollectionItem<V> extends CollectionChangeItem<V> {
PreviousCollectionItem<V> get previousNextItem;
}

abstract class AddedItem<V> extends CollectionChangeItem<V> {
AddedItem<V> get nextAddedItem;
}

/**
* A linked list of items moved in the collection. These items are always in
* the iteration order of the collection.
*/
abstract class MovedItem<V> extends CollectionChangeItem<V> {
MovedItem<V> get nextMovedItem;
}

/**
* A linked list of items removed from the collection. These items are always
* in the iteration order of the collection.
*/
abstract class RemovedItem<V> extends CollectionChangeItem<V> {
RemovedItem<V> get nextRemovedItem;
}

typedef dynamic FieldGetter(object);
typedef void FieldSetter(object, value);

Expand Down
Loading