| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 removeAt(i); | 232 removeAt(i); |
| 233 // adjust index since remove shifted elements. | 233 // adjust index since remove shifted elements. |
| 234 i--; | 234 i--; |
| 235 count++; | 235 count++; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 return count; | 238 return count; |
| 239 } | 239 } |
| 240 | 240 |
| 241 void copyFrom(List<T> src, int srcStart, int dstStart, int count) { | 241 void copyFrom(List<T> src, int srcStart, int dstStart, int count) { |
| 242 Arrays.copy(src, srcStart, this, dstStart, count); | 242 List dst = this; |
| 243 if (srcStart == null) srcStart = 0; |
| 244 if (dstStart == null) dstStart = 0; |
| 245 |
| 246 if (srcStart < dstStart) { |
| 247 for (int i = srcStart + count - 1, j = dstStart + count - 1; |
| 248 i >= srcStart; i--, j--) { |
| 249 dst[j] = src[i]; |
| 250 } |
| 251 } else { |
| 252 for (int i = srcStart, j = dstStart; i < srcStart + count; i++, j++) { |
| 253 dst[j] = src[i]; |
| 254 } |
| 255 } |
| 243 } | 256 } |
| 244 | 257 |
| 245 void setRange(int start, int length, List from, [int startFrom = 0]) { | 258 void setRange(int start, int length, List from, [int startFrom = 0]) { |
| 246 throw new UnimplementedError(); | 259 throw new UnimplementedError(); |
| 247 } | 260 } |
| 248 | 261 |
| 249 void removeRange(int start, int length) { | 262 void removeRange(int start, int length) { |
| 250 throw new UnimplementedError(); | 263 throw new UnimplementedError(); |
| 251 } | 264 } |
| 252 | 265 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // Only fire on an actual change. | 330 // Only fire on an actual change. |
| 318 if (!identical(newValue, _value)) { | 331 if (!identical(newValue, _value)) { |
| 319 final oldValue = _value; | 332 final oldValue = _value; |
| 320 _value = newValue; | 333 _value = newValue; |
| 321 recordPropertyUpdate("value", newValue, oldValue); | 334 recordPropertyUpdate("value", newValue, oldValue); |
| 322 } | 335 } |
| 323 } | 336 } |
| 324 | 337 |
| 325 T _value; | 338 T _value; |
| 326 } | 339 } |
| OLD | NEW |