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

Commit 478a5b2

Browse files
vicbmhevery
authored andcommitted
refactor(dccd): Simplify both the interface and the implementation
#909 cont'd. This commit is for the map changes (909 is for collection). Closes #935
1 parent 400e236 commit 478a5b2

File tree

4 files changed

+153
-198
lines changed

4 files changed

+153
-198
lines changed

lib/change_detection/change_detection.dart

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,11 @@ abstract class MapChangeRecord<K, V> {
114114
/// The underlying map object
115115
Map get map;
116116

117-
/// A list of [CollectionKeyValue]s which are in the iteration order. */
118-
KeyValue<K, V> get mapHead;
119-
PreviousKeyValue<K, V> get previousMapHead;
120-
/// A list of changed items.
121-
ChangedKeyValue<K, V> get changesHead;
122-
/// A list of new added items.
123-
AddedKeyValue<K, V> get additionsHead;
124-
/// A list of removed items
125-
RemovedKeyValue<K, V> get removalsHead;
126-
127-
void forEachChange(void f(ChangedKeyValue<K, V> change));
128-
void forEachAddition(void f(AddedKeyValue<K, V> addition));
129-
void forEachRemoval(void f(RemovedKeyValue<K, V> removal));
117+
void forEachItem(void f(MapKeyValue<K, V> item));
118+
void forEachPreviousItem(void f(MapKeyValue<K, V> previousItem));
119+
void forEachChange(void f(MapKeyValue<K, V> change));
120+
void forEachAddition(void f(MapKeyValue<K, V> addition));
121+
void forEachRemoval(void f(MapKeyValue<K, V> removal));
130122
}
131123

132124
/**
@@ -144,26 +136,6 @@ abstract class MapKeyValue<K, V> {
144136
V get currentValue;
145137
}
146138

147-
abstract class KeyValue<K, V> extends MapKeyValue<K, V> {
148-
KeyValue<K, V> get nextKeyValue;
149-
}
150-
151-
abstract class PreviousKeyValue<K, V> extends MapKeyValue<K, V> {
152-
PreviousKeyValue<K, V> get previousNextKeyValue;
153-
}
154-
155-
abstract class AddedKeyValue<K, V> extends MapKeyValue<K, V> {
156-
AddedKeyValue<K, V> get nextAddedKeyValue;
157-
}
158-
159-
abstract class RemovedKeyValue<K, V> extends MapKeyValue<K, V> {
160-
RemovedKeyValue<K, V> get nextRemovedKeyValue;
161-
}
162-
163-
abstract class ChangedKeyValue<K, V> extends MapKeyValue<K, V> {
164-
ChangedKeyValue<K, V> get nextChangedKeyValue;
165-
}
166-
167139
/**
168140
* If the [ChangeDetector] is watching an [Iterable] then the [currentValue] of
169141
* [Record] will contain an instance of [CollectionChangeRecord]. The

0 commit comments

Comments
 (0)