| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void set length(int value) { | 155 void set length(int value) { |
| 156 _internal.length = value; | 156 _internal.length = value; |
| 157 recordGlobalChange(); | 157 recordGlobalChange(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void clear() { | 160 void clear() { |
| 161 _internal.clear(); | 161 _internal.clear(); |
| 162 recordGlobalChange(); | 162 recordGlobalChange(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 List<T> get reversed => _internal.reversed; | 165 Iterable<T> get reversed => _internal.reversed; |
| 166 | 166 |
| 167 void sort([int compare(var a, var b)]) { | 167 void sort([int compare(var a, var b)]) { |
| 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); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 throw new UnimplementedError(); | 277 throw new UnimplementedError(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 | 280 |
| 281 // Iterable<T>: | 281 // Iterable<T>: |
| 282 Iterator<T> get iterator => _internal.iterator; | 282 Iterator<T> get iterator => _internal.iterator; |
| 283 | 283 |
| 284 // Collection<T>: | 284 // Collection<T>: |
| 285 Iterable<T> where(bool f(T element)) => _internal.where(f); | 285 Iterable<T> where(bool f(T element)) => _internal.where(f); |
| 286 Iterable map(f(T element)) => _internal.map(f); | 286 Iterable map(f(T element)) => _internal.map(f); |
| 287 List mappedBy(f(T element)) => _internal.mappedBy(f); | |
| 288 Iterable expand(Iterable f(T element)) => _internal.expand(f); | 287 Iterable expand(Iterable f(T element)) => _internal.expand(f); |
| 289 List<T> skip(int count) => _internal.skip(count); | 288 List<T> skip(int count) => _internal.skip(count); |
| 290 List<T> take(int count) => _internal.take(count); | 289 List<T> take(int count) => _internal.take(count); |
| 291 bool every(bool f(T element)) => _internal.every(f); | 290 bool every(bool f(T element)) => _internal.every(f); |
| 292 bool any(bool f(T element)) => _internal.any(f); | 291 bool any(bool f(T element)) => _internal.any(f); |
| 293 void forEach(void f(T element)) { _internal.forEach(f); } | 292 void forEach(void f(T element)) { _internal.forEach(f); } |
| 294 String join([String separator]) => _internal.join(separator); | 293 String join([String separator]) => _internal.join(separator); |
| 295 T firstMatching(bool test(T value), {T orElse()}) { | 294 T firstMatching(bool test(T value), {T orElse()}) { |
| 296 return _internal.firstMatching(test, orElse: orElse); | 295 return _internal.firstMatching(test, orElse: orElse); |
| 297 } | 296 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 325 // Only fire on an actual change. | 324 // Only fire on an actual change. |
| 326 if (!identical(newValue, _value)) { | 325 if (!identical(newValue, _value)) { |
| 327 final oldValue = _value; | 326 final oldValue = _value; |
| 328 _value = newValue; | 327 _value = newValue; |
| 329 recordPropertyUpdate("value", newValue, oldValue); | 328 recordPropertyUpdate("value", newValue, oldValue); |
| 330 } | 329 } |
| 331 } | 330 } |
| 332 | 331 |
| 333 T _value; | 332 T _value; |
| 334 } | 333 } |
| OLD | NEW |