| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 5 |
| 6 // TODO(srdjan): Use shared array implementation. | 6 // TODO(srdjan): Use shared array implementation. |
| 7 class _ObjectArray<E> implements List<E> { | 7 class _ObjectArray<E> implements List<E> { |
| 8 | 8 |
| 9 factory _ObjectArray(length) native "ObjectArray_allocate"; | 9 factory _ObjectArray(length) native "ObjectArray_allocate"; |
| 10 | 10 |
| 11 E operator [](int index) native "ObjectArray_getIndexed"; | 11 E operator [](int index) native "ObjectArray_getIndexed"; |
| 12 | 12 |
| 13 void operator []=(int index, E value) native "ObjectArray_setIndexed"; | 13 void operator []=(int index, E value) native "ObjectArray_setIndexed"; |
| 14 | 14 |
| 15 String toString() { | 15 String toString() { |
| 16 return Collections.collectionToString(this); | 16 return Collections.collectionToString(this); |
| 17 } | 17 } |
| 18 | 18 |
| 19 int get length native "ObjectArray_getLength"; | 19 int get length native "ObjectArray_getLength"; |
| 20 | 20 |
| 21 void _copyFromObjectArray(_ObjectArray src, | 21 void _copyFromObjectArray(_ObjectArray src, |
| 22 int srcStart, | 22 int srcStart, |
| 23 int dstStart, | 23 int dstStart, |
| 24 int count) | 24 int count) |
| 25 native "ObjectArray_copyFromObjectArray"; | 25 native "ObjectArray_copyFromObjectArray"; |
| 26 | 26 |
| 27 void insert(int index, E element) { |
| 28 throw new UnsupportedError( |
| 29 "Cannot add to a non-extendable array"); |
| 30 } |
| 31 |
| 27 E removeAt(int index) { | 32 E removeAt(int index) { |
| 28 throw new UnsupportedError( | 33 throw new UnsupportedError( |
| 29 "Cannot remove element of a non-extendable array"); | 34 "Cannot remove element of a non-extendable array"); |
| 30 } | 35 } |
| 31 | 36 |
| 32 void remove(Object element) { | 37 void remove(Object element) { |
| 33 throw new UnsupportedError( | 38 throw new UnsupportedError( |
| 34 "Cannot remove element of a non-extendable array"); | 39 "Cannot remove element of a non-extendable array"); |
| 35 } | 40 } |
| 36 | 41 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 263 |
| 259 E operator [](int index) native "ObjectArray_getIndexed"; | 264 E operator [](int index) native "ObjectArray_getIndexed"; |
| 260 | 265 |
| 261 void operator []=(int index, E value) { | 266 void operator []=(int index, E value) { |
| 262 throw new UnsupportedError( | 267 throw new UnsupportedError( |
| 263 "Cannot modify an immutable array"); | 268 "Cannot modify an immutable array"); |
| 264 } | 269 } |
| 265 | 270 |
| 266 int get length native "ObjectArray_getLength"; | 271 int get length native "ObjectArray_getLength"; |
| 267 | 272 |
| 273 void insert(int index, E element) { |
| 274 throw new UnsupportedError( |
| 275 "Cannot add to an immutable array"); |
| 276 } |
| 277 |
| 268 E removeAt(int index) { | 278 E removeAt(int index) { |
| 269 throw new UnsupportedError( | 279 throw new UnsupportedError( |
| 270 "Cannot modify an immutable array"); | 280 "Cannot modify an immutable array"); |
| 271 } | 281 } |
| 272 | 282 |
| 273 void remove(Object element) { | 283 void remove(Object element) { |
| 274 throw new UnsupportedError( | 284 throw new UnsupportedError( |
| 275 "Cannot modify an immutable array"); | 285 "Cannot modify an immutable array"); |
| 276 } | 286 } |
| 277 | 287 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 516 } |
| 507 _position = _length; | 517 _position = _length; |
| 508 _current = null; | 518 _current = null; |
| 509 return false; | 519 return false; |
| 510 } | 520 } |
| 511 | 521 |
| 512 E get current { | 522 E get current { |
| 513 return _current; | 523 return _current; |
| 514 } | 524 } |
| 515 } | 525 } |
| OLD | NEW |