| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return new _Float64Array(length); | 108 return new _Float64Array(length); |
| 109 } | 109 } |
| 110 | 110 |
| 111 /* patch */ factory Float64List.view(ByteArray array, [int start = 0, int leng
th]) { | 111 /* patch */ factory Float64List.view(ByteArray array, [int start = 0, int leng
th]) { |
| 112 return new _Float64ArrayView(array, start, length); | 112 return new _Float64ArrayView(array, start, length); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 | 116 |
| 117 abstract class _ByteArrayBase { | 117 abstract class _ByteArrayBase { |
| 118 abstract int lengthInBytes(); | 118 int lengthInBytes(); |
| 119 | 119 |
| 120 abstract int bytesPerElement(); | 120 int bytesPerElement(); |
| 121 | 121 |
| 122 abstract operator[](int index); | 122 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); | 126 bool contains(element) => Collections.contains(this, element); |
| 127 | 127 |
| 128 void forEach(void f(element)) { | 128 void forEach(void f(element)) { |
| 129 var len = this.length; | 129 var len = this.length; |
| 130 for (var i = 0; i < len; i++) { | 130 for (var i = 0; i < len; i++) { |
| 131 f(this[i]); | 131 f(this[i]); |
| 132 } | 132 } |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 return _array._setFloat64(_offset + byteOffset, value); | 1598 return _array._setFloat64(_offset + byteOffset, value); |
| 1599 } | 1599 } |
| 1600 | 1600 |
| 1601 final _ByteArrayBase _array; | 1601 final _ByteArrayBase _array; |
| 1602 final int _offset; | 1602 final int _offset; |
| 1603 final int _length; | 1603 final int _length; |
| 1604 } | 1604 } |
| 1605 | 1605 |
| 1606 | 1606 |
| 1607 class _ByteArrayViewBase { | 1607 class _ByteArrayViewBase { |
| 1608 abstract num operator[](int index); | 1608 num operator[](int index); |
| 1609 | 1609 |
| 1610 // Methods implementing the Collection interface. | 1610 // Methods implementing the Collection interface. |
| 1611 | 1611 |
| 1612 void forEach(void f(element)) { | 1612 void forEach(void f(element)) { |
| 1613 var len = this.length; | 1613 var len = this.length; |
| 1614 for (var i = 0; i < len; i++) { | 1614 for (var i = 0; i < len; i++) { |
| 1615 f(this[i]); | 1615 f(this[i]); |
| 1616 } | 1616 } |
| 1617 } | 1617 } |
| 1618 | 1618 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 bool some(bool f(element)) { | 1636 bool some(bool f(element)) { |
| 1637 return Collections.some(this, f);; | 1637 return Collections.some(this, f);; |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 bool get isEmpty { | 1640 bool get isEmpty { |
| 1641 return this.length == 0; | 1641 return this.length == 0; |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 abstract int get length; | 1644 int get length; |
| 1645 | 1645 |
| 1646 // Methods implementing the List interface. | 1646 // Methods implementing the List interface. |
| 1647 | 1647 |
| 1648 set length(newLength) { | 1648 set length(newLength) { |
| 1649 throw new UnsupportedError( | 1649 throw new UnsupportedError( |
| 1650 "Cannot resize a non-extendable array"); | 1650 "Cannot resize a non-extendable array"); |
| 1651 } | 1651 } |
| 1652 | 1652 |
| 1653 void add(value) { | 1653 void add(value) { |
| 1654 throw new UnsupportedError( | 1654 throw new UnsupportedError( |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 } | 2419 } |
| 2420 _rangeCheck(this.length, start, length); | 2420 _rangeCheck(this.length, start, length); |
| 2421 return _array.subByteArray(_offset + start, length); | 2421 return _array.subByteArray(_offset + start, length); |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 static const int _BYTES_PER_ELEMENT = 8; | 2424 static const int _BYTES_PER_ELEMENT = 8; |
| 2425 final ByteArray _array; | 2425 final ByteArray _array; |
| 2426 final int _offset; | 2426 final int _offset; |
| 2427 final int _length; | 2427 final int _length; |
| 2428 } | 2428 } |
| OLD | NEW |