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 => new ReversedListView<T>(this, 0, null); |
| 166 |
165 void sort([int compare(var a, var b)]) { | 167 void sort([int compare(var a, var b)]) { |
166 if (compare == null) compare = Comparable.compare; | 168 if (compare == null) compare = Comparable.compare; |
167 _internal.sort(compare); | 169 _internal.sort(compare); |
168 recordGlobalChange(); | 170 recordGlobalChange(); |
169 } | 171 } |
170 | 172 |
171 void add(T element) { | 173 void add(T element) { |
172 recordListInsert(length, element); | 174 recordListInsert(length, element); |
173 _internal.add(element); | 175 _internal.add(element); |
174 } | 176 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // Only fire on an actual change. | 321 // Only fire on an actual change. |
320 if (!identical(newValue, _value)) { | 322 if (!identical(newValue, _value)) { |
321 final oldValue = _value; | 323 final oldValue = _value; |
322 _value = newValue; | 324 _value = newValue; |
323 recordPropertyUpdate("value", newValue, oldValue); | 325 recordPropertyUpdate("value", newValue, oldValue); |
324 } | 326 } |
325 } | 327 } |
326 | 328 |
327 T _value; | 329 T _value; |
328 } | 330 } |
OLD | NEW |