Chromium Code Reviews| 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 interface ByteArray { | 5 interface ByteArray { |
| 6 int lengthInBytes(); | 6 int lengthInBytes(); |
| 7 | 7 |
| 8 ByteArray subByteArray([int start, int length]); | 8 ByteArray subByteArray([int start, int length]); |
| 9 | 9 |
| 10 int getInt8(int byteOffset); | 10 int getInt8(int byteOffset); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 void addAll(Collection value) { | 253 void addAll(Collection value) { |
| 254 throw const UnsupportedOperationException( | 254 throw const UnsupportedOperationException( |
| 255 "Cannot add to a non-extendable array"); | 255 "Cannot add to a non-extendable array"); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void clear() { | 258 void clear() { |
| 259 throw const UnsupportedOperationException( | 259 throw const UnsupportedOperationException( |
| 260 "Cannot remove from a non-extendable array"); | 260 "Cannot remove from a non-extendable array"); |
| 261 } | 261 } |
| 262 | 262 |
| 263 int indexOf(var element, [int start = 0]) { | |
|
Søren Gjesse
2012/05/09 07:08:03
Normally we just leave out var in argument lists.
Anders Johnsen
2012/05/09 07:12:04
Done.
| |
| 264 for (int i = start; i < length; i++) { | |
| 265 if (this[i] == element) return i; | |
| 266 } | |
| 267 return -1; | |
| 268 } | |
| 269 | |
| 263 void insertRange(int start, int length, [initialValue]) { | 270 void insertRange(int start, int length, [initialValue]) { |
| 264 throw const UnsupportedOperationException( | 271 throw const UnsupportedOperationException( |
| 265 "Cannot add to a non-extendable array"); | 272 "Cannot add to a non-extendable array"); |
| 266 } | 273 } |
| 267 | 274 |
| 268 int get length() { | 275 int get length() { |
| 269 return _length(); | 276 return _length(); |
| 270 } | 277 } |
| 271 | 278 |
| 272 set length(newLength) { | 279 set length(newLength) { |
| (...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2423 } | 2430 } |
| 2424 _rangeCheck(start, length); | 2431 _rangeCheck(start, length); |
| 2425 return _array.subByteArray(_offset + start, length); | 2432 return _array.subByteArray(_offset + start, length); |
| 2426 } | 2433 } |
| 2427 | 2434 |
| 2428 static final int _BYTES_PER_ELEMENT = 8; | 2435 static final int _BYTES_PER_ELEMENT = 8; |
| 2429 final ByteArray _array; | 2436 final ByteArray _array; |
| 2430 final int _offset; | 2437 final int _offset; |
| 2431 final int _length; | 2438 final int _length; |
| 2432 } | 2439 } |
| OLD | NEW |