Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: pkg/observe/lib/src/change_record.dart

Issue 53743002: introduce ObservableList.listChanges to keep list changes separate from property changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/observe/lib/src/change_notifier.dart ('k') | pkg/observe/lib/src/list_diff.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/src/change_record.dart
diff --git a/pkg/observe/lib/src/change_record.dart b/pkg/observe/lib/src/change_record.dart
index 39e5964b6d7fd9e1e2010b3f243e790c556f6e9b..985e3721217b132c7c96e9b143fc0546193f1d3f 100644
--- a/pkg/observe/lib/src/change_record.dart
+++ b/pkg/observe/lib/src/change_record.dart
@@ -30,37 +30,3 @@ class PropertyChangeRecord<T> extends ChangeRecord {
String toString() =>
'#<PropertyChangeRecord $name from: $oldValue to: $newValue>';
}
-
-/** A change record for an observable list. */
-class ListChangeRecord extends ChangeRecord {
- /** The starting index of the change. */
- final int index;
-
- /** The number of items removed. */
- final int removedCount;
-
- /** The number of items added. */
- final int addedCount;
-
- ListChangeRecord(this.index, {this.removedCount: 0, this.addedCount: 0}) {
- if (addedCount == 0 && removedCount == 0) {
- throw new ArgumentError('added and removed counts should not both be '
- 'zero. Use 1 if this was a single item update.');
- }
- }
-
- /** Returns true if the provided index was changed by this operation. */
- bool indexChanged(otherIndex) {
- // If key isn't an int, or before the index, then it wasn't changed.
- if (otherIndex is! int || otherIndex < index) return false;
-
- // If this was a shift operation, anything after index is changed.
- if (addedCount != removedCount) return true;
-
- // Otherwise, anything in the update range was changed.
- return otherIndex < index + addedCount;
- }
-
- String toString() => '#<ListChangeRecord index: $index, '
- 'removed: $removedCount, addedCount: $addedCount>';
-}
« no previous file with comments | « pkg/observe/lib/src/change_notifier.dart ('k') | pkg/observe/lib/src/list_diff.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698