| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |