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 #935

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
38 changes: 5 additions & 33 deletions lib/change_detection/change_detection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,11 @@ abstract class MapChangeRecord<K, V> {
/// The underlying map object
Map get map;

/// A list of [CollectionKeyValue]s which are in the iteration order. */
KeyValue<K, V> get mapHead;
PreviousKeyValue<K, V> get previousMapHead;
/// A list of changed items.
ChangedKeyValue<K, V> get changesHead;
/// A list of new added items.
AddedKeyValue<K, V> get additionsHead;
/// A list of removed items
RemovedKeyValue<K, V> get removalsHead;

void forEachChange(void f(ChangedKeyValue<K, V> change));
void forEachAddition(void f(AddedKeyValue<K, V> addition));
void forEachRemoval(void f(RemovedKeyValue<K, V> removal));
void forEachItem(void f(MapKeyValue<K, V> item));
void forEachPreviousItem(void f(MapKeyValue<K, V> previousItem));
void forEachChange(void f(MapKeyValue<K, V> change));
void forEachAddition(void f(MapKeyValue<K, V> addition));
void forEachRemoval(void f(MapKeyValue<K, V> removal));
}

/**
Expand All @@ -144,26 +136,6 @@ abstract class MapKeyValue<K, V> {
V get currentValue;
}

abstract class KeyValue<K, V> extends MapKeyValue<K, V> {
KeyValue<K, V> get nextKeyValue;
}

abstract class PreviousKeyValue<K, V> extends MapKeyValue<K, V> {
PreviousKeyValue<K, V> get previousNextKeyValue;
}

abstract class AddedKeyValue<K, V> extends MapKeyValue<K, V> {
AddedKeyValue<K, V> get nextAddedKeyValue;
}

abstract class RemovedKeyValue<K, V> extends MapKeyValue<K, V> {
RemovedKeyValue<K, V> get nextRemovedKeyValue;
}

abstract class ChangedKeyValue<K, V> extends MapKeyValue<K, V> {
ChangedKeyValue<K, V> get nextChangedKeyValue;
}

/**
* If the [ChangeDetector] is watching an [Iterable] then the [currentValue] of
* [Record] will contain an instance of [CollectionChangeRecord]. The
Expand Down
Loading