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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 int push(T element) { | 184 int push(T element) { |
185 recordListInsert(length, element); | 185 recordListInsert(length, element); |
186 _internal.add(element); | 186 _internal.add(element); |
187 return _internal.length; | 187 return _internal.length; |
188 } | 188 } |
189 | 189 |
190 T get first => _internal.first; | 190 T get first => _internal.first; |
191 T get last => _internal.last; | 191 T get last => _internal.last; |
192 T get single => _internal.single; | 192 T get single => _internal.single; |
193 | 193 |
194 T min([int compare(T a, T b)]) => _internal.min(compare); | |
195 T max([int compare(T a, T b)]) => _internal.max(compare); | |
196 | |
197 void insert(int index, T element) { | 194 void insert(int index, T element) { |
198 _internal.insert(index, element); | 195 _internal.insert(index, element); |
199 recordListInsert(index, element); | 196 recordListInsert(index, element); |
200 } | 197 } |
201 | 198 |
202 T removeLast() { | 199 T removeLast() { |
203 final result = _internal.removeLast(); | 200 final result = _internal.removeLast(); |
204 recordListRemove(length, result); | 201 recordListRemove(length, result); |
205 return result; | 202 return result; |
206 } | 203 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 270 } |
274 | 271 |
275 List getRange(int start, int length) { | 272 List getRange(int start, int length) { |
276 throw new UnimplementedError(); | 273 throw new UnimplementedError(); |
277 } | 274 } |
278 | 275 |
279 bool contains(T element) { | 276 bool contains(T element) { |
280 throw new UnimplementedError(); | 277 throw new UnimplementedError(); |
281 } | 278 } |
282 | 279 |
283 dynamic reduce(var initialValue, | 280 T reduce(T combine(T previousValue, T element)) { |
284 dynamic combine(var previousValue, T element)) { | |
285 throw new UnimplementedError(); | 281 throw new UnimplementedError(); |
286 } | 282 } |
287 | 283 |
288 dynamic fold(var initialValue, | 284 dynamic fold(var initialValue, |
289 dynamic combine(var previousValue, T element)) { | 285 dynamic combine(var previousValue, T element)) { |
290 throw new UnimplementedError(); | 286 throw new UnimplementedError(); |
291 } | 287 } |
292 | 288 |
293 // Iterable<T>: | 289 // Iterable<T>: |
294 Iterator<T> get iterator => _internal.iterator; | 290 Iterator<T> get iterator => _internal.iterator; |
(...skipping 44 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 |