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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return _internal.length; | 191 return _internal.length; |
192 } | 192 } |
193 | 193 |
194 T get first => _internal.first; | 194 T get first => _internal.first; |
195 T get last => _internal.last; | 195 T get last => _internal.last; |
196 T get single => _internal.single; | 196 T get single => _internal.single; |
197 | 197 |
198 T min([int compare(T a, T b)]) => _internal.min(compare); | 198 T min([int compare(T a, T b)]) => _internal.min(compare); |
199 T max([int compare(T a, T b)]) => _internal.max(compare); | 199 T max([int compare(T a, T b)]) => _internal.max(compare); |
200 | 200 |
| 201 void insert(int index, T element) { |
| 202 _internal.insert(index, element); |
| 203 recordListInsert(index, element); |
| 204 } |
| 205 |
201 T removeLast() { | 206 T removeLast() { |
202 final result = _internal.removeLast(); | 207 final result = _internal.removeLast(); |
203 recordListRemove(length, result); | 208 recordListRemove(length, result); |
204 return result; | 209 return result; |
205 } | 210 } |
206 | 211 |
207 T removeAt(int index) { | 212 T removeAt(int index) { |
208 T result = _internal.removeAt(index); | 213 T result = _internal.removeAt(index); |
209 recordListRemove(index, result); | 214 recordListRemove(index, result); |
210 return result; | 215 return result; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // Only fire on an actual change. | 335 // Only fire on an actual change. |
331 if (!identical(newValue, _value)) { | 336 if (!identical(newValue, _value)) { |
332 final oldValue = _value; | 337 final oldValue = _value; |
333 _value = newValue; | 338 _value = newValue; |
334 recordPropertyUpdate("value", newValue, oldValue); | 339 recordPropertyUpdate("value", newValue, oldValue); |
335 } | 340 } |
336 } | 341 } |
337 | 342 |
338 T _value; | 343 T _value; |
339 } | 344 } |
OLD | NEW |