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 patch class Int8List { | 5 patch class Int8List { |
6 /* patch */ factory Int8List(int length) { | 6 /* patch */ factory Int8List(int length) { |
7 return new _Int8Array(length); | 7 return new _Int8Array(length); |
8 } | 8 } |
9 | 9 |
10 /* patch */ factory Int8List.view(ByteArray array, | 10 /* patch */ factory Int8List.view(ByteArray array, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 abstract class _ByteArrayBase { | 117 abstract class _ByteArrayBase { |
118 abstract int lengthInBytes(); | 118 abstract int lengthInBytes(); |
119 | 119 |
120 abstract int bytesPerElement(); | 120 abstract int bytesPerElement(); |
121 | 121 |
122 abstract operator[](int index); | 122 abstract operator[](int index); |
123 | 123 |
124 // Methods implementing the Collection interface. | 124 // Methods implementing the Collection interface. |
125 | 125 |
126 bool contains(element) => Collections.contains(this, element); | |
127 | |
128 void forEach(void f(element)) { | 126 void forEach(void f(element)) { |
129 var len = this.length; | 127 var len = this.length; |
130 for (var i = 0; i < len; i++) { | 128 for (var i = 0; i < len; i++) { |
131 f(this[i]); | 129 f(this[i]); |
132 } | 130 } |
133 } | 131 } |
134 | 132 |
135 Collection map(f(element)) { | 133 Collection map(f(element)) { |
136 return Collections.map(this, new List(), f); | 134 return Collections.map(this, new List(), f); |
137 } | 135 } |
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2411 } | 2409 } |
2412 _rangeCheck(this.length, start, length); | 2410 _rangeCheck(this.length, start, length); |
2413 return _array.subByteArray(_offset + start, length); | 2411 return _array.subByteArray(_offset + start, length); |
2414 } | 2412 } |
2415 | 2413 |
2416 static const int _BYTES_PER_ELEMENT = 8; | 2414 static const int _BYTES_PER_ELEMENT = 8; |
2417 final ByteArray _array; | 2415 final ByteArray _array; |
2418 final int _offset; | 2416 final int _offset; |
2419 final int _length; | 2417 final int _length; |
2420 } | 2418 } |
OLD | NEW |