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 insertAt(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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 | 259 |
255 E operator [](int index) native "ObjectArray_getIndexed"; | 260 E operator [](int index) native "ObjectArray_getIndexed"; |
256 | 261 |
257 void operator []=(int index, E value) { | 262 void operator []=(int index, E value) { |
258 throw new UnsupportedError( | 263 throw new UnsupportedError( |
259 "Cannot modify an immutable array"); | 264 "Cannot modify an immutable array"); |
260 } | 265 } |
261 | 266 |
262 int get length native "ObjectArray_getLength"; | 267 int get length native "ObjectArray_getLength"; |
263 | 268 |
269 void insertAt(int index, E element) { | |
270 throw new UnsupportedError( | |
271 "Cannot add to a non-extendable array"); | |
srdjan
2013/03/04 00:53:47
to an immutable array
Lasse Reichstein Nielsen
2013/03/04 09:06:02
Consider changing "immutable" to "unmodifiable" wh
floitsch
2013/03/05 17:51:58
Done.
floitsch
2013/03/05 17:51:58
not in this CL. Filed http://dartbug.com/8925
| |
272 } | |
273 | |
264 E removeAt(int index) { | 274 E removeAt(int index) { |
265 throw new UnsupportedError( | 275 throw new UnsupportedError( |
266 "Cannot modify an immutable array"); | 276 "Cannot modify an immutable array"); |
267 } | 277 } |
268 | 278 |
269 void remove(Object element) { | 279 void remove(Object element) { |
270 throw new UnsupportedError( | 280 throw new UnsupportedError( |
271 "Cannot modify an immutable array"); | 281 "Cannot modify an immutable array"); |
272 } | 282 } |
273 | 283 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 } | 508 } |
499 _position = _length; | 509 _position = _length; |
500 _current = null; | 510 _current = null; |
501 return false; | 511 return false; |
502 } | 512 } |
503 | 513 |
504 E get current { | 514 E get current { |
505 return _current; | 515 return _current; |
506 } | 516 } |
507 } | 517 } |
OLD | NEW |