| 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:coreimpl'); | 7 #import('dart:coreimpl'); |
| 8 | 8 |
| 9 #source('ChangeEvent.dart'); | 9 #source('ChangeEvent.dart'); |
| 10 #source('EventBatch.dart'); | 10 #source('EventBatch.dart'); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return false; | 203 return false; |
| 204 } | 204 } |
| 205 return true; | 205 return true; |
| 206 }); | 206 }); |
| 207 if (found != null) { | 207 if (found != null) { |
| 208 recordListRemove(index, found); | 208 recordListRemove(index, found); |
| 209 } | 209 } |
| 210 return found; | 210 return found; |
| 211 } | 211 } |
| 212 | 212 |
| 213 int indexOf(T element, int startIndex) { | 213 int indexOf(T element, [int start = 0]) { |
| 214 return _internal.indexOf(element, startIndex); | 214 return _internal.indexOf(element, start); |
| 215 } | 215 } |
| 216 | 216 |
| 217 int lastIndexOf(T element, int startIndex) { | 217 int lastIndexOf(T element, [int start = null]) { |
| 218 return _internal.lastIndexOf(element, startIndex); | 218 if (start === null) start = length - 1; |
| 219 return _internal.lastIndexOf(element, start); |
| 219 } | 220 } |
| 220 | 221 |
| 221 bool removeFirstElement(T element) { | 222 bool removeFirstElement(T element) { |
| 222 // the removeAt above will record the event. | 223 // the removeAt above will record the event. |
| 223 return (removeAt(indexOf(element, 0)) != null); | 224 return (removeAt(indexOf(element, 0)) != null); |
| 224 } | 225 } |
| 225 | 226 |
| 226 int removeAllElements(T element) { | 227 int removeAllElements(T element) { |
| 227 int count = 0; | 228 int count = 0; |
| 228 for (int i = 0; i < length; i++) { | 229 for (int i = 0; i < length; i++) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // equality check should be done? | 289 // equality check should be done? |
| 289 if (newValue !== _value) { | 290 if (newValue !== _value) { |
| 290 final oldValue = _value; | 291 final oldValue = _value; |
| 291 _value = newValue; | 292 _value = newValue; |
| 292 recordPropertyUpdate("value", newValue, oldValue); | 293 recordPropertyUpdate("value", newValue, oldValue); |
| 293 } | 294 } |
| 294 } | 295 } |
| 295 | 296 |
| 296 T _value; | 297 T _value; |
| 297 } | 298 } |
| OLD | NEW |