| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 library observable; | 5 library observable; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 part 'ChangeEvent.dart'; | 9 part 'ChangeEvent.dart'; |
| 10 part 'EventBatch.dart'; | 10 part 'EventBatch.dart'; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 if (compare == null) compare = Comparable.compare; | 168 if (compare == null) compare = Comparable.compare; |
| 169 _internal.sort(compare); | 169 _internal.sort(compare); |
| 170 recordGlobalChange(); | 170 recordGlobalChange(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void add(T element) { | 173 void add(T element) { |
| 174 recordListInsert(length, element); | 174 recordListInsert(length, element); |
| 175 _internal.add(element); | 175 _internal.add(element); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void addLast(T element) { | |
| 179 add(element); | |
| 180 } | |
| 181 | |
| 182 void addAll(Iterable<T> elements) { | 178 void addAll(Iterable<T> elements) { |
| 183 for (T element in elements) { | 179 for (T element in elements) { |
| 184 add(element); | 180 add(element); |
| 185 } | 181 } |
| 186 } | 182 } |
| 187 | 183 |
| 188 int push(T element) { | 184 int push(T element) { |
| 189 recordListInsert(length, element); | 185 recordListInsert(length, element); |
| 190 _internal.add(element); | 186 _internal.add(element); |
| 191 return _internal.length; | 187 return _internal.length; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 // Only fire on an actual change. | 335 // Only fire on an actual change. |
| 340 if (!identical(newValue, _value)) { | 336 if (!identical(newValue, _value)) { |
| 341 final oldValue = _value; | 337 final oldValue = _value; |
| 342 _value = newValue; | 338 _value = newValue; |
| 343 recordPropertyUpdate("value", newValue, oldValue); | 339 recordPropertyUpdate("value", newValue, oldValue); |
| 344 } | 340 } |
| 345 } | 341 } |
| 346 | 342 |
| 347 T _value; | 343 T _value; |
| 348 } | 344 } |
| OLD | NEW |