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

Side by Side Diff: pkg/observe/lib/src/change_record.dart

Issue 20149004: [mdv] implement Node.createBinding and Node.createBindings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of observe; 5 part of observe;
6 6
7 /** Records a change to an [Observable]. */ 7 /** Records a change to an [Observable]. */
8 abstract class ChangeRecord { 8 abstract class ChangeRecord {
9 // TODO(jmesserly): rename this--it's confusing. Perhaps "matches"?
9 /** True if the change affected the given item, otherwise false. */ 10 /** True if the change affected the given item, otherwise false. */
10 bool change(key); 11 bool changes(key);
11 } 12 }
12 13
13 /** A change record to a field of an observable object. */ 14 /** A change record to a field of an observable object. */
14 class PropertyChangeRecord extends ChangeRecord { 15 class PropertyChangeRecord extends ChangeRecord {
15 /** The field that was changed. */ 16 /** The field that was changed. */
16 final Symbol field; 17 final Symbol field;
17 18
18 PropertyChangeRecord(this.field); 19 PropertyChangeRecord(this.field);
19 20
20 bool changes(key) => key is Symbol && field == key; 21 bool changes(key) => key is Symbol && field == key;
(...skipping 27 matching lines...) Expand all
48 // If this was a shift operation, anything after index is changed. 49 // If this was a shift operation, anything after index is changed.
49 if (addedCount != removedCount) return true; 50 if (addedCount != removedCount) return true;
50 51
51 // Otherwise, anything in the update range was changed. 52 // Otherwise, anything in the update range was changed.
52 return key < index + addedCount; 53 return key < index + addedCount;
53 } 54 }
54 55
55 String toString() => '#<ListChangeRecord index: $index, ' 56 String toString() => '#<ListChangeRecord index: $index, '
56 'removed: $removedCount, addedCount: $addedCount>'; 57 'removed: $removedCount, addedCount: $addedCount>';
57 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698