| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 | 352 |
| 353 int operator[](int index) { | 353 int operator[](int index) { |
| 354 return _getIndexed(index); | 354 return _getIndexed(index); |
| 355 } | 355 } |
| 356 | 356 |
| 357 int operator[]=(int index, int value) { | 357 int operator[]=(int index, int value) { |
| 358 _setIndexed(index, _toInt8(value)); | 358 _setIndexed(index, _toInt8(value)); |
| 359 } | 359 } |
| 360 | 360 |
| 361 Iterator<int> iterator() { | 361 Iterator<int> get iterator { |
| 362 return new _ByteArrayIterator<int>(this); | 362 return new _ByteArrayIterator<int>(this); |
| 363 } | 363 } |
| 364 | 364 |
| 365 List<int> getRange(int start, int length) { | 365 List<int> getRange(int start, int length) { |
| 366 _rangeCheck(this.length, start, length); | 366 _rangeCheck(this.length, start, length); |
| 367 List<int> result = _new(length); | 367 List<int> result = _new(length); |
| 368 result.setRange(0, length, this, start); | 368 result.setRange(0, length, this, start); |
| 369 return result; | 369 return result; |
| 370 } | 370 } |
| 371 | 371 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 | 415 |
| 416 int operator[](int index) { | 416 int operator[](int index) { |
| 417 return _getIndexed(index); | 417 return _getIndexed(index); |
| 418 } | 418 } |
| 419 | 419 |
| 420 int operator[]=(int index, int value) { | 420 int operator[]=(int index, int value) { |
| 421 _setIndexed(index, _toUint8(value)); | 421 _setIndexed(index, _toUint8(value)); |
| 422 } | 422 } |
| 423 | 423 |
| 424 Iterator<int> iterator() { | 424 Iterator<int> get iterator { |
| 425 return new _ByteArrayIterator<int>(this); | 425 return new _ByteArrayIterator<int>(this); |
| 426 } | 426 } |
| 427 | 427 |
| 428 List<int> getRange(int start, int length) { | 428 List<int> getRange(int start, int length) { |
| 429 _rangeCheck(this.length, start, length); | 429 _rangeCheck(this.length, start, length); |
| 430 List<int> result = _new(length); | 430 List<int> result = _new(length); |
| 431 result.setRange(0, length, this, start); | 431 result.setRange(0, length, this, start); |
| 432 return result; | 432 return result; |
| 433 } | 433 } |
| 434 | 434 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 } | 477 } |
| 478 | 478 |
| 479 int operator[](int index) { | 479 int operator[](int index) { |
| 480 return _getIndexed(index); | 480 return _getIndexed(index); |
| 481 } | 481 } |
| 482 | 482 |
| 483 int operator[]=(int index, int value) { | 483 int operator[]=(int index, int value) { |
| 484 _setIndexed(index, _toInt16(value)); | 484 _setIndexed(index, _toInt16(value)); |
| 485 } | 485 } |
| 486 | 486 |
| 487 Iterator<int> iterator() { | 487 Iterator<int> get iterator { |
| 488 return new _ByteArrayIterator<int>(this); | 488 return new _ByteArrayIterator<int>(this); |
| 489 } | 489 } |
| 490 | 490 |
| 491 List<int> getRange(int start, int length) { | 491 List<int> getRange(int start, int length) { |
| 492 _rangeCheck(this.length, start, length); | 492 _rangeCheck(this.length, start, length); |
| 493 List<int> result = _new(length); | 493 List<int> result = _new(length); |
| 494 result.setRange(0, length, this, start); | 494 result.setRange(0, length, this, start); |
| 495 return result; | 495 return result; |
| 496 } | 496 } |
| 497 | 497 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 } | 540 } |
| 541 | 541 |
| 542 int operator[](int index) { | 542 int operator[](int index) { |
| 543 return _getIndexed(index); | 543 return _getIndexed(index); |
| 544 } | 544 } |
| 545 | 545 |
| 546 int operator[]=(int index, int value) { | 546 int operator[]=(int index, int value) { |
| 547 _setIndexed(index, _toUint16(value)); | 547 _setIndexed(index, _toUint16(value)); |
| 548 } | 548 } |
| 549 | 549 |
| 550 Iterator<int> iterator() { | 550 Iterator<int> get iterator { |
| 551 return new _ByteArrayIterator<int>(this); | 551 return new _ByteArrayIterator<int>(this); |
| 552 } | 552 } |
| 553 | 553 |
| 554 List<int> getRange(int start, int length) { | 554 List<int> getRange(int start, int length) { |
| 555 _rangeCheck(this.length, start, length); | 555 _rangeCheck(this.length, start, length); |
| 556 List<int> result = _new(length); | 556 List<int> result = _new(length); |
| 557 result.setRange(0, length, this, start); | 557 result.setRange(0, length, this, start); |
| 558 return result; | 558 return result; |
| 559 } | 559 } |
| 560 | 560 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 603 } |
| 604 | 604 |
| 605 int operator[](int index) { | 605 int operator[](int index) { |
| 606 return _getIndexed(index); | 606 return _getIndexed(index); |
| 607 } | 607 } |
| 608 | 608 |
| 609 int operator[]=(int index, int value) { | 609 int operator[]=(int index, int value) { |
| 610 _setIndexed(index, _toInt32(value)); | 610 _setIndexed(index, _toInt32(value)); |
| 611 } | 611 } |
| 612 | 612 |
| 613 Iterator<int> iterator() { | 613 Iterator<int> get iterator { |
| 614 return new _ByteArrayIterator<int>(this); | 614 return new _ByteArrayIterator<int>(this); |
| 615 } | 615 } |
| 616 | 616 |
| 617 List<int> getRange(int start, int length) { | 617 List<int> getRange(int start, int length) { |
| 618 _rangeCheck(this.length, start, length); | 618 _rangeCheck(this.length, start, length); |
| 619 List<int> result = _new(length); | 619 List<int> result = _new(length); |
| 620 result.setRange(0, length, this, start); | 620 result.setRange(0, length, this, start); |
| 621 return result; | 621 return result; |
| 622 } | 622 } |
| 623 | 623 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 } | 666 } |
| 667 | 667 |
| 668 int operator[](int index) { | 668 int operator[](int index) { |
| 669 return _getIndexed(index); | 669 return _getIndexed(index); |
| 670 } | 670 } |
| 671 | 671 |
| 672 int operator[]=(int index, int value) { | 672 int operator[]=(int index, int value) { |
| 673 _setIndexed(index, _toUint32(value)); | 673 _setIndexed(index, _toUint32(value)); |
| 674 } | 674 } |
| 675 | 675 |
| 676 Iterator<int> iterator() { | 676 Iterator<int> get iterator { |
| 677 return new _ByteArrayIterator<int>(this); | 677 return new _ByteArrayIterator<int>(this); |
| 678 } | 678 } |
| 679 | 679 |
| 680 List<int> getRange(int start, int length) { | 680 List<int> getRange(int start, int length) { |
| 681 _rangeCheck(this.length, start, length); | 681 _rangeCheck(this.length, start, length); |
| 682 List<int> result = _new(length); | 682 List<int> result = _new(length); |
| 683 result.setRange(0, length, this, start); | 683 result.setRange(0, length, this, start); |
| 684 return result; | 684 return result; |
| 685 } | 685 } |
| 686 | 686 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 } | 729 } |
| 730 | 730 |
| 731 int operator[](int index) { | 731 int operator[](int index) { |
| 732 return _getIndexed(index); | 732 return _getIndexed(index); |
| 733 } | 733 } |
| 734 | 734 |
| 735 int operator[]=(int index, int value) { | 735 int operator[]=(int index, int value) { |
| 736 _setIndexed(index, _toInt64(value)); | 736 _setIndexed(index, _toInt64(value)); |
| 737 } | 737 } |
| 738 | 738 |
| 739 Iterator<int> iterator() { | 739 Iterator<int> get iterator { |
| 740 return new _ByteArrayIterator<int>(this); | 740 return new _ByteArrayIterator<int>(this); |
| 741 } | 741 } |
| 742 | 742 |
| 743 List<int> getRange(int start, int length) { | 743 List<int> getRange(int start, int length) { |
| 744 _rangeCheck(this.length, start, length); | 744 _rangeCheck(this.length, start, length); |
| 745 List<int> result = _new(length); | 745 List<int> result = _new(length); |
| 746 result.setRange(0, length, this, start); | 746 result.setRange(0, length, this, start); |
| 747 return result; | 747 return result; |
| 748 } | 748 } |
| 749 | 749 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 } | 792 } |
| 793 | 793 |
| 794 int operator[](int index) { | 794 int operator[](int index) { |
| 795 return _getIndexed(index); | 795 return _getIndexed(index); |
| 796 } | 796 } |
| 797 | 797 |
| 798 int operator[]=(int index, int value) { | 798 int operator[]=(int index, int value) { |
| 799 _setIndexed(index, _toUint64(value)); | 799 _setIndexed(index, _toUint64(value)); |
| 800 } | 800 } |
| 801 | 801 |
| 802 Iterator<int> iterator() { | 802 Iterator<int> get iterator { |
| 803 return new _ByteArrayIterator<int>(this); | 803 return new _ByteArrayIterator<int>(this); |
| 804 } | 804 } |
| 805 | 805 |
| 806 List<int> getRange(int start, int length) { | 806 List<int> getRange(int start, int length) { |
| 807 _rangeCheck(this.length, start, length); | 807 _rangeCheck(this.length, start, length); |
| 808 List<int> result = _new(length); | 808 List<int> result = _new(length); |
| 809 result.setRange(0, length, this, start); | 809 result.setRange(0, length, this, start); |
| 810 return result; | 810 return result; |
| 811 } | 811 } |
| 812 | 812 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 } | 855 } |
| 856 | 856 |
| 857 double operator[](int index) { | 857 double operator[](int index) { |
| 858 return _getIndexed(index); | 858 return _getIndexed(index); |
| 859 } | 859 } |
| 860 | 860 |
| 861 int operator[]=(int index, double value) { | 861 int operator[]=(int index, double value) { |
| 862 _setIndexed(index, value); | 862 _setIndexed(index, value); |
| 863 } | 863 } |
| 864 | 864 |
| 865 Iterator<double> iterator() { | 865 Iterator<double> get iterator { |
| 866 return new _ByteArrayIterator<double>(this); | 866 return new _ByteArrayIterator<double>(this); |
| 867 } | 867 } |
| 868 | 868 |
| 869 List<double> getRange(int start, int length) { | 869 List<double> getRange(int start, int length) { |
| 870 _rangeCheck(this.length, start, length); | 870 _rangeCheck(this.length, start, length); |
| 871 List<double> result = _new(length); | 871 List<double> result = _new(length); |
| 872 result.setRange(0, length, this, start); | 872 result.setRange(0, length, this, start); |
| 873 return result; | 873 return result; |
| 874 } | 874 } |
| 875 | 875 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 918 } |
| 919 | 919 |
| 920 double operator[](int index) { | 920 double operator[](int index) { |
| 921 return _getIndexed(index); | 921 return _getIndexed(index); |
| 922 } | 922 } |
| 923 | 923 |
| 924 int operator[]=(int index, double value) { | 924 int operator[]=(int index, double value) { |
| 925 _setIndexed(index, value); | 925 _setIndexed(index, value); |
| 926 } | 926 } |
| 927 | 927 |
| 928 Iterator<double> iterator() { | 928 Iterator<double> get iterator { |
| 929 return new _ByteArrayIterator<double>(this); | 929 return new _ByteArrayIterator<double>(this); |
| 930 } | 930 } |
| 931 | 931 |
| 932 List<double> getRange(int start, int length) { | 932 List<double> getRange(int start, int length) { |
| 933 _rangeCheck(this.length, start, length); | 933 _rangeCheck(this.length, start, length); |
| 934 List<double> result = _new(length); | 934 List<double> result = _new(length); |
| 935 result.setRange(0, length, this, start); | 935 result.setRange(0, length, this, start); |
| 936 return result; | 936 return result; |
| 937 } | 937 } |
| 938 | 938 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 | 970 |
| 971 class _ExternalInt8Array extends _ByteArrayBase implements Int8List { | 971 class _ExternalInt8Array extends _ByteArrayBase implements Int8List { |
| 972 int operator[](int index) { | 972 int operator[](int index) { |
| 973 return _getIndexed(index); | 973 return _getIndexed(index); |
| 974 } | 974 } |
| 975 | 975 |
| 976 int operator[]=(int index, int value) { | 976 int operator[]=(int index, int value) { |
| 977 _setIndexed(index, _toInt8(value)); | 977 _setIndexed(index, _toInt8(value)); |
| 978 } | 978 } |
| 979 | 979 |
| 980 Iterator<int> iterator() { | 980 Iterator<int> get iterator { |
| 981 return new _ByteArrayIterator<int>(this); | 981 return new _ByteArrayIterator<int>(this); |
| 982 } | 982 } |
| 983 | 983 |
| 984 List<int> getRange(int start, int length) { | 984 List<int> getRange(int start, int length) { |
| 985 _rangeCheck(this.length, start, length); | 985 _rangeCheck(this.length, start, length); |
| 986 List<int> result = new Int8List(length); | 986 List<int> result = new Int8List(length); |
| 987 result.setRange(0, length, this, start); | 987 result.setRange(0, length, this, start); |
| 988 return result; | 988 return result; |
| 989 } | 989 } |
| 990 | 990 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1020 | 1020 |
| 1021 class _ExternalUint8Array extends _ByteArrayBase implements Uint8List { | 1021 class _ExternalUint8Array extends _ByteArrayBase implements Uint8List { |
| 1022 int operator[](int index) { | 1022 int operator[](int index) { |
| 1023 return _getIndexed(index); | 1023 return _getIndexed(index); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 int operator[]=(int index, int value) { | 1026 int operator[]=(int index, int value) { |
| 1027 _setIndexed(index, _toUint8(value)); | 1027 _setIndexed(index, _toUint8(value)); |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 Iterator<int> iterator() { | 1030 Iterator<int> get iterator { |
| 1031 return new _ByteArrayIterator<int>(this); | 1031 return new _ByteArrayIterator<int>(this); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 List<int> getRange(int start, int length) { | 1034 List<int> getRange(int start, int length) { |
| 1035 _rangeCheck(this.length, start, length); | 1035 _rangeCheck(this.length, start, length); |
| 1036 List<int> result = new Uint8List(length); | 1036 List<int> result = new Uint8List(length); |
| 1037 result.setRange(0, length, this, start); | 1037 result.setRange(0, length, this, start); |
| 1038 return result; | 1038 return result; |
| 1039 } | 1039 } |
| 1040 | 1040 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1070 | 1070 |
| 1071 class _ExternalInt16Array extends _ByteArrayBase implements Int16List { | 1071 class _ExternalInt16Array extends _ByteArrayBase implements Int16List { |
| 1072 int operator[](int index) { | 1072 int operator[](int index) { |
| 1073 return _getIndexed(index); | 1073 return _getIndexed(index); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 int operator[]=(int index, int value) { | 1076 int operator[]=(int index, int value) { |
| 1077 _setIndexed(index, _toInt16(value)); | 1077 _setIndexed(index, _toInt16(value)); |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 Iterator<int> iterator() { | 1080 Iterator<int> get iterator { |
| 1081 return new _ByteArrayIterator<int>(this); | 1081 return new _ByteArrayIterator<int>(this); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 List<int> getRange(int start, int length) { | 1084 List<int> getRange(int start, int length) { |
| 1085 _rangeCheck(this.length, start, length); | 1085 _rangeCheck(this.length, start, length); |
| 1086 List<int> result = new Int16List(length); | 1086 List<int> result = new Int16List(length); |
| 1087 result.setRange(0, length, this, start); | 1087 result.setRange(0, length, this, start); |
| 1088 return result; | 1088 return result; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1120 | 1120 |
| 1121 class _ExternalUint16Array extends _ByteArrayBase implements Uint16List { | 1121 class _ExternalUint16Array extends _ByteArrayBase implements Uint16List { |
| 1122 int operator[](int index) { | 1122 int operator[](int index) { |
| 1123 return _getIndexed(index); | 1123 return _getIndexed(index); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 int operator[]=(int index, int value) { | 1126 int operator[]=(int index, int value) { |
| 1127 _setIndexed(index, _toUint16(value)); | 1127 _setIndexed(index, _toUint16(value)); |
| 1128 } | 1128 } |
| 1129 | 1129 |
| 1130 Iterator<int> iterator() { | 1130 Iterator<int> get iterator { |
| 1131 return new _ByteArrayIterator<int>(this); | 1131 return new _ByteArrayIterator<int>(this); |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 List<int> getRange(int start, int length) { | 1134 List<int> getRange(int start, int length) { |
| 1135 _rangeCheck(this.length, start, length); | 1135 _rangeCheck(this.length, start, length); |
| 1136 List<int> result = new Uint16List(length); | 1136 List<int> result = new Uint16List(length); |
| 1137 result.setRange(0, length, this, start); | 1137 result.setRange(0, length, this, start); |
| 1138 return result; | 1138 return result; |
| 1139 } | 1139 } |
| 1140 | 1140 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 | 1172 |
| 1173 class _ExternalInt32Array extends _ByteArrayBase implements Int32List { | 1173 class _ExternalInt32Array extends _ByteArrayBase implements Int32List { |
| 1174 int operator[](int index) { | 1174 int operator[](int index) { |
| 1175 return _getIndexed(index); | 1175 return _getIndexed(index); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 int operator[]=(int index, int value) { | 1178 int operator[]=(int index, int value) { |
| 1179 _setIndexed(index, _toInt32(value)); | 1179 _setIndexed(index, _toInt32(value)); |
| 1180 } | 1180 } |
| 1181 | 1181 |
| 1182 Iterator<int> iterator() { | 1182 Iterator<int> get iterator { |
| 1183 return new _ByteArrayIterator<int>(this); | 1183 return new _ByteArrayIterator<int>(this); |
| 1184 } | 1184 } |
| 1185 | 1185 |
| 1186 List<int> getRange(int start, int length) { | 1186 List<int> getRange(int start, int length) { |
| 1187 _rangeCheck(this.length, start, length); | 1187 _rangeCheck(this.length, start, length); |
| 1188 List<int> result = new Int32List(length); | 1188 List<int> result = new Int32List(length); |
| 1189 result.setRange(0, length, this, start); | 1189 result.setRange(0, length, this, start); |
| 1190 return result; | 1190 return result; |
| 1191 } | 1191 } |
| 1192 | 1192 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 | 1224 |
| 1225 class _ExternalUint32Array extends _ByteArrayBase implements Uint32List { | 1225 class _ExternalUint32Array extends _ByteArrayBase implements Uint32List { |
| 1226 int operator[](int index) { | 1226 int operator[](int index) { |
| 1227 return _getIndexed(index); | 1227 return _getIndexed(index); |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 int operator[]=(int index, int value) { | 1230 int operator[]=(int index, int value) { |
| 1231 _setIndexed(index, _toUint32(value)); | 1231 _setIndexed(index, _toUint32(value)); |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 Iterator<int> iterator() { | 1234 Iterator<int> get iterator { |
| 1235 return new _ByteArrayIterator<int>(this); | 1235 return new _ByteArrayIterator<int>(this); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 List<int> getRange(int start, int length) { | 1238 List<int> getRange(int start, int length) { |
| 1239 _rangeCheck(this.length, start, length); | 1239 _rangeCheck(this.length, start, length); |
| 1240 List<int> result = new Uint32List(length); | 1240 List<int> result = new Uint32List(length); |
| 1241 result.setRange(0, length, this, start); | 1241 result.setRange(0, length, this, start); |
| 1242 return result; | 1242 return result; |
| 1243 } | 1243 } |
| 1244 | 1244 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 | 1276 |
| 1277 class _ExternalInt64Array extends _ByteArrayBase implements Int64List { | 1277 class _ExternalInt64Array extends _ByteArrayBase implements Int64List { |
| 1278 int operator[](int index) { | 1278 int operator[](int index) { |
| 1279 return _getIndexed(index); | 1279 return _getIndexed(index); |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 int operator[]=(int index, int value) { | 1282 int operator[]=(int index, int value) { |
| 1283 _setIndexed(index, _toInt64(value)); | 1283 _setIndexed(index, _toInt64(value)); |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 Iterator<int> iterator() { | 1286 Iterator<int> get iterator { |
| 1287 return new _ByteArrayIterator<int>(this); | 1287 return new _ByteArrayIterator<int>(this); |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 List<int> getRange(int start, int length) { | 1290 List<int> getRange(int start, int length) { |
| 1291 _rangeCheck(this.length, start, length); | 1291 _rangeCheck(this.length, start, length); |
| 1292 List<int> result = new Int64List(length); | 1292 List<int> result = new Int64List(length); |
| 1293 result.setRange(0, length, this, start); | 1293 result.setRange(0, length, this, start); |
| 1294 return result; | 1294 return result; |
| 1295 } | 1295 } |
| 1296 | 1296 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 | 1328 |
| 1329 class _ExternalUint64Array extends _ByteArrayBase implements Uint64List { | 1329 class _ExternalUint64Array extends _ByteArrayBase implements Uint64List { |
| 1330 int operator[](int index) { | 1330 int operator[](int index) { |
| 1331 return _getIndexed(index); | 1331 return _getIndexed(index); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 int operator[]=(int index, int value) { | 1334 int operator[]=(int index, int value) { |
| 1335 _setIndexed(index, _toUint64(value)); | 1335 _setIndexed(index, _toUint64(value)); |
| 1336 } | 1336 } |
| 1337 | 1337 |
| 1338 Iterator<int> iterator() { | 1338 Iterator<int> get iterator { |
| 1339 return new _ByteArrayIterator<int>(this); | 1339 return new _ByteArrayIterator<int>(this); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 List<int> getRange(int start, int length) { | 1342 List<int> getRange(int start, int length) { |
| 1343 _rangeCheck(this.length, start, length); | 1343 _rangeCheck(this.length, start, length); |
| 1344 List<int> result = new Uint64List(length); | 1344 List<int> result = new Uint64List(length); |
| 1345 result.setRange(0, length, this, start); | 1345 result.setRange(0, length, this, start); |
| 1346 return result; | 1346 return result; |
| 1347 } | 1347 } |
| 1348 | 1348 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 | 1380 |
| 1381 class _ExternalFloat32Array extends _ByteArrayBase implements Float32List { | 1381 class _ExternalFloat32Array extends _ByteArrayBase implements Float32List { |
| 1382 double operator[](int index) { | 1382 double operator[](int index) { |
| 1383 return _getIndexed(index); | 1383 return _getIndexed(index); |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 int operator[]=(int index, double value) { | 1386 int operator[]=(int index, double value) { |
| 1387 _setIndexed(index, value); | 1387 _setIndexed(index, value); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 Iterator<double> iterator() { | 1390 Iterator<double> get iterator { |
| 1391 return new _ByteArrayIterator<double>(this); | 1391 return new _ByteArrayIterator<double>(this); |
| 1392 } | 1392 } |
| 1393 | 1393 |
| 1394 List<double> getRange(int start, int length) { | 1394 List<double> getRange(int start, int length) { |
| 1395 _rangeCheck(this.length, start, length); | 1395 _rangeCheck(this.length, start, length); |
| 1396 List<double> result = new Float32List(length); | 1396 List<double> result = new Float32List(length); |
| 1397 result.setRange(0, length, this, start); | 1397 result.setRange(0, length, this, start); |
| 1398 return result; | 1398 return result; |
| 1399 } | 1399 } |
| 1400 | 1400 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 | 1432 |
| 1433 class _ExternalFloat64Array extends _ByteArrayBase implements Float64List { | 1433 class _ExternalFloat64Array extends _ByteArrayBase implements Float64List { |
| 1434 double operator[](int index) { | 1434 double operator[](int index) { |
| 1435 return _getIndexed(index); | 1435 return _getIndexed(index); |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 int operator[]=(int index, double value) { | 1438 int operator[]=(int index, double value) { |
| 1439 _setIndexed(index, value); | 1439 _setIndexed(index, value); |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 Iterator<double> iterator() { | 1442 Iterator<double> get iterator { |
| 1443 return new _ByteArrayIterator<double>(this); | 1443 return new _ByteArrayIterator<double>(this); |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 List<double> getRange(int start, int length) { | 1446 List<double> getRange(int start, int length) { |
| 1447 _rangeCheck(this.length, start, length); | 1447 _rangeCheck(this.length, start, length); |
| 1448 List<double> result = new Float64List(length); | 1448 List<double> result = new Float64List(length); |
| 1449 result.setRange(0, length, this, start); | 1449 result.setRange(0, length, this, start); |
| 1450 return result; | 1450 return result; |
| 1451 } | 1451 } |
| 1452 | 1452 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1477 | 1477 |
| 1478 double _getIndexed(int index) | 1478 double _getIndexed(int index) |
| 1479 native "ExternalFloat64Array_getIndexed"; | 1479 native "ExternalFloat64Array_getIndexed"; |
| 1480 int _setIndexed(int index, double value) | 1480 int _setIndexed(int index, double value) |
| 1481 native "ExternalFloat64Array_setIndexed"; | 1481 native "ExternalFloat64Array_setIndexed"; |
| 1482 } | 1482 } |
| 1483 | 1483 |
| 1484 | 1484 |
| 1485 class _ByteArrayIterator<E> implements Iterator<E> { | 1485 class _ByteArrayIterator<E> implements Iterator<E> { |
| 1486 _ByteArrayIterator(List array) | 1486 _ByteArrayIterator(List array) |
| 1487 : _array = array, _length = array.length, _pos = 0 { | 1487 : _array = array, _length = array.length, _pos = -1 { |
| 1488 assert(array is _ByteArrayBase || array is _ByteArrayViewBase); | 1488 assert(array is _ByteArrayBase || array is _ByteArrayViewBase); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| 1491 bool get hasNext { | 1491 bool moveNext() { |
| 1492 return _length > _pos; | 1492 _pos++; |
| 1493 if (_pos < _length) return true; |
| 1494 _pos = _length; |
| 1495 return false; |
| 1493 } | 1496 } |
| 1494 | 1497 |
| 1495 E next() { | 1498 E get current { |
| 1496 if (!hasNext) { | 1499 if (0 <= _pos && _pos < _length) { |
| 1497 throw new StateError("No more elements"); | 1500 return _array[_pos]; |
| 1498 } | 1501 } |
| 1499 return _array[_pos++]; | 1502 // TODO(floitsch): adapt error message. |
| 1503 throw new StateError("No more elements"); |
| 1500 } | 1504 } |
| 1501 | 1505 |
| 1502 final List<E> _array; | 1506 final List<E> _array; |
| 1503 final int _length; | 1507 final int _length; |
| 1504 int _pos; | 1508 int _pos; |
| 1505 } | 1509 } |
| 1506 | 1510 |
| 1507 | 1511 |
| 1508 class _ByteArrayView implements ByteArray { | 1512 class _ByteArrayView implements ByteArray { |
| 1509 _ByteArrayView(this._array, this._offset, this._length) { | 1513 _ByteArrayView(this._array, this._offset, this._length) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 } | 1727 } |
| 1724 | 1728 |
| 1725 void operator[]=(int index, int value) { | 1729 void operator[]=(int index, int value) { |
| 1726 if (index < 0 || index >= _length) { | 1730 if (index < 0 || index >= _length) { |
| 1727 String message = "$index must be in the range [0..$_length)"; | 1731 String message = "$index must be in the range [0..$_length)"; |
| 1728 throw new RangeError(message); | 1732 throw new RangeError(message); |
| 1729 } | 1733 } |
| 1730 _array.setInt8(_offset + (index * _BYTES_PER_ELEMENT), _toInt8(value)); | 1734 _array.setInt8(_offset + (index * _BYTES_PER_ELEMENT), _toInt8(value)); |
| 1731 } | 1735 } |
| 1732 | 1736 |
| 1733 Iterator<int> iterator() { | 1737 Iterator<int> get iterator { |
| 1734 return new _ByteArrayIterator<int>(this); | 1738 return new _ByteArrayIterator<int>(this); |
| 1735 } | 1739 } |
| 1736 | 1740 |
| 1737 List<int> getRange(int start, int length) { | 1741 List<int> getRange(int start, int length) { |
| 1738 _rangeCheck(this.length, start, length); | 1742 _rangeCheck(this.length, start, length); |
| 1739 List<int> result = new Int8List(length); | 1743 List<int> result = new Int8List(length); |
| 1740 result.setRange(0, length, this, start); | 1744 result.setRange(0, length, this, start); |
| 1741 return result; | 1745 return result; |
| 1742 } | 1746 } |
| 1743 | 1747 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 } | 1799 } |
| 1796 | 1800 |
| 1797 void operator[]=(int index, int value) { | 1801 void operator[]=(int index, int value) { |
| 1798 if (index < 0 || index >= _length) { | 1802 if (index < 0 || index >= _length) { |
| 1799 String message = "$index must be in the range [0..$_length)"; | 1803 String message = "$index must be in the range [0..$_length)"; |
| 1800 throw new RangeError(message); | 1804 throw new RangeError(message); |
| 1801 } | 1805 } |
| 1802 _array.setUint8(_offset + (index * _BYTES_PER_ELEMENT), _toUint8(value)); | 1806 _array.setUint8(_offset + (index * _BYTES_PER_ELEMENT), _toUint8(value)); |
| 1803 } | 1807 } |
| 1804 | 1808 |
| 1805 Iterator<int> iterator() { | 1809 Iterator<int> get iterator { |
| 1806 return new _ByteArrayIterator<int>(this); | 1810 return new _ByteArrayIterator<int>(this); |
| 1807 } | 1811 } |
| 1808 | 1812 |
| 1809 List<int> getRange(int start, int length) { | 1813 List<int> getRange(int start, int length) { |
| 1810 _rangeCheck(this.length, start, length); | 1814 _rangeCheck(this.length, start, length); |
| 1811 List<int> result = new Uint8List(length); | 1815 List<int> result = new Uint8List(length); |
| 1812 result.setRange(0, length, this, start); | 1816 result.setRange(0, length, this, start); |
| 1813 return result; | 1817 return result; |
| 1814 } | 1818 } |
| 1815 | 1819 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 } | 1871 } |
| 1868 | 1872 |
| 1869 void operator[]=(int index, int value) { | 1873 void operator[]=(int index, int value) { |
| 1870 if (index < 0 || index >= _length) { | 1874 if (index < 0 || index >= _length) { |
| 1871 String message = "$index must be in the range [0..$_length)"; | 1875 String message = "$index must be in the range [0..$_length)"; |
| 1872 throw new RangeError(message); | 1876 throw new RangeError(message); |
| 1873 } | 1877 } |
| 1874 _array.setInt16(_offset + (index * _BYTES_PER_ELEMENT), _toInt16(value)); | 1878 _array.setInt16(_offset + (index * _BYTES_PER_ELEMENT), _toInt16(value)); |
| 1875 } | 1879 } |
| 1876 | 1880 |
| 1877 Iterator<int> iterator() { | 1881 Iterator<int> get iterator { |
| 1878 return new _ByteArrayIterator<int>(this); | 1882 return new _ByteArrayIterator<int>(this); |
| 1879 } | 1883 } |
| 1880 | 1884 |
| 1881 List<int> getRange(int start, int length) { | 1885 List<int> getRange(int start, int length) { |
| 1882 _rangeCheck(this.length, start, length); | 1886 _rangeCheck(this.length, start, length); |
| 1883 List<int> result = new Int16List(length); | 1887 List<int> result = new Int16List(length); |
| 1884 result.setRange(0, length, this, start); | 1888 result.setRange(0, length, this, start); |
| 1885 return result; | 1889 return result; |
| 1886 } | 1890 } |
| 1887 | 1891 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 } | 1943 } |
| 1940 | 1944 |
| 1941 void operator[]=(int index, int value) { | 1945 void operator[]=(int index, int value) { |
| 1942 if (index < 0 || index >= _length) { | 1946 if (index < 0 || index >= _length) { |
| 1943 String message = "$index must be in the range [0..$_length)"; | 1947 String message = "$index must be in the range [0..$_length)"; |
| 1944 throw new RangeError(message); | 1948 throw new RangeError(message); |
| 1945 } | 1949 } |
| 1946 _array.setUint16(_offset + (index * _BYTES_PER_ELEMENT), _toUint16(value)); | 1950 _array.setUint16(_offset + (index * _BYTES_PER_ELEMENT), _toUint16(value)); |
| 1947 } | 1951 } |
| 1948 | 1952 |
| 1949 Iterator<int> iterator() { | 1953 Iterator<int> get iterator { |
| 1950 return new _ByteArrayIterator<int>(this); | 1954 return new _ByteArrayIterator<int>(this); |
| 1951 } | 1955 } |
| 1952 | 1956 |
| 1953 List<int> getRange(int start, int length) { | 1957 List<int> getRange(int start, int length) { |
| 1954 _rangeCheck(this.length, start, length); | 1958 _rangeCheck(this.length, start, length); |
| 1955 List<int> result = new Uint16List(length); | 1959 List<int> result = new Uint16List(length); |
| 1956 result.setRange(0, length, this, start); | 1960 result.setRange(0, length, this, start); |
| 1957 return result; | 1961 return result; |
| 1958 } | 1962 } |
| 1959 | 1963 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 } | 2015 } |
| 2012 | 2016 |
| 2013 void operator[]=(int index, int value) { | 2017 void operator[]=(int index, int value) { |
| 2014 if (index < 0 || index >= _length) { | 2018 if (index < 0 || index >= _length) { |
| 2015 String message = "$index must be in the range [0..$_length)"; | 2019 String message = "$index must be in the range [0..$_length)"; |
| 2016 throw new RangeError(message); | 2020 throw new RangeError(message); |
| 2017 } | 2021 } |
| 2018 _array.setInt32(_offset + (index * _BYTES_PER_ELEMENT), _toInt32(value)); | 2022 _array.setInt32(_offset + (index * _BYTES_PER_ELEMENT), _toInt32(value)); |
| 2019 } | 2023 } |
| 2020 | 2024 |
| 2021 Iterator<int> iterator() { | 2025 Iterator<int> get iterator { |
| 2022 return new _ByteArrayIterator<int>(this); | 2026 return new _ByteArrayIterator<int>(this); |
| 2023 } | 2027 } |
| 2024 | 2028 |
| 2025 List<int> getRange(int start, int length) { | 2029 List<int> getRange(int start, int length) { |
| 2026 _rangeCheck(this.length, start, length); | 2030 _rangeCheck(this.length, start, length); |
| 2027 List<int> result = new Int32List(length); | 2031 List<int> result = new Int32List(length); |
| 2028 result.setRange(0, length, this, start); | 2032 result.setRange(0, length, this, start); |
| 2029 return result; | 2033 return result; |
| 2030 } | 2034 } |
| 2031 | 2035 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 } | 2087 } |
| 2084 | 2088 |
| 2085 void operator[]=(int index, int value) { | 2089 void operator[]=(int index, int value) { |
| 2086 if (index < 0 || index >= _length) { | 2090 if (index < 0 || index >= _length) { |
| 2087 String message = "$index must be in the range [0..$_length)"; | 2091 String message = "$index must be in the range [0..$_length)"; |
| 2088 throw new RangeError(message); | 2092 throw new RangeError(message); |
| 2089 } | 2093 } |
| 2090 _array.setUint32(_offset + (index * _BYTES_PER_ELEMENT), _toUint32(value)); | 2094 _array.setUint32(_offset + (index * _BYTES_PER_ELEMENT), _toUint32(value)); |
| 2091 } | 2095 } |
| 2092 | 2096 |
| 2093 Iterator<int> iterator() { | 2097 Iterator<int> get iterator { |
| 2094 return new _ByteArrayIterator<int>(this); | 2098 return new _ByteArrayIterator<int>(this); |
| 2095 } | 2099 } |
| 2096 | 2100 |
| 2097 List<int> getRange(int start, int length) { | 2101 List<int> getRange(int start, int length) { |
| 2098 _rangeCheck(this.length, start, length); | 2102 _rangeCheck(this.length, start, length); |
| 2099 List<int> result = new Uint32List(length); | 2103 List<int> result = new Uint32List(length); |
| 2100 result.setRange(0, length, this, start); | 2104 result.setRange(0, length, this, start); |
| 2101 return result; | 2105 return result; |
| 2102 } | 2106 } |
| 2103 | 2107 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 } | 2159 } |
| 2156 | 2160 |
| 2157 void operator[]=(int index, int value) { | 2161 void operator[]=(int index, int value) { |
| 2158 if (index < 0 || index >= _length) { | 2162 if (index < 0 || index >= _length) { |
| 2159 String message = "$index must be in the range [0..$_length)"; | 2163 String message = "$index must be in the range [0..$_length)"; |
| 2160 throw new RangeError(message); | 2164 throw new RangeError(message); |
| 2161 } | 2165 } |
| 2162 _array.setInt64(_offset + (index * _BYTES_PER_ELEMENT), _toInt64(value)); | 2166 _array.setInt64(_offset + (index * _BYTES_PER_ELEMENT), _toInt64(value)); |
| 2163 } | 2167 } |
| 2164 | 2168 |
| 2165 Iterator<int> iterator() { | 2169 Iterator<int> get iterator { |
| 2166 return new _ByteArrayIterator<int>(this); | 2170 return new _ByteArrayIterator<int>(this); |
| 2167 } | 2171 } |
| 2168 | 2172 |
| 2169 List<int> getRange(int start, int length) { | 2173 List<int> getRange(int start, int length) { |
| 2170 _rangeCheck(this.length, start, length); | 2174 _rangeCheck(this.length, start, length); |
| 2171 List<int> result = new Int64List(length); | 2175 List<int> result = new Int64List(length); |
| 2172 result.setRange(0, length, this, start); | 2176 result.setRange(0, length, this, start); |
| 2173 return result; | 2177 return result; |
| 2174 } | 2178 } |
| 2175 | 2179 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 } | 2231 } |
| 2228 | 2232 |
| 2229 void operator[]=(int index, int value) { | 2233 void operator[]=(int index, int value) { |
| 2230 if (index < 0 || index >= _length) { | 2234 if (index < 0 || index >= _length) { |
| 2231 String message = "$index must be in the range [0..$_length)"; | 2235 String message = "$index must be in the range [0..$_length)"; |
| 2232 throw new RangeError(message); | 2236 throw new RangeError(message); |
| 2233 } | 2237 } |
| 2234 _array.setUint64(_offset + (index * _BYTES_PER_ELEMENT), _toUint64(value)); | 2238 _array.setUint64(_offset + (index * _BYTES_PER_ELEMENT), _toUint64(value)); |
| 2235 } | 2239 } |
| 2236 | 2240 |
| 2237 Iterator<int> iterator() { | 2241 Iterator<int> get iterator { |
| 2238 return new _ByteArrayIterator<int>(this); | 2242 return new _ByteArrayIterator<int>(this); |
| 2239 } | 2243 } |
| 2240 | 2244 |
| 2241 List<int> getRange(int start, int length) { | 2245 List<int> getRange(int start, int length) { |
| 2242 _rangeCheck(this.length, start, length); | 2246 _rangeCheck(this.length, start, length); |
| 2243 List<int> result = new Uint64List(length); | 2247 List<int> result = new Uint64List(length); |
| 2244 result.setRange(0, length, this, start); | 2248 result.setRange(0, length, this, start); |
| 2245 return result; | 2249 return result; |
| 2246 } | 2250 } |
| 2247 | 2251 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 } | 2303 } |
| 2300 | 2304 |
| 2301 void operator[]=(int index, double value) { | 2305 void operator[]=(int index, double value) { |
| 2302 if (index < 0 || index >= _length) { | 2306 if (index < 0 || index >= _length) { |
| 2303 String message = "$index must be in the range [0..$_length)"; | 2307 String message = "$index must be in the range [0..$_length)"; |
| 2304 throw new RangeError(message); | 2308 throw new RangeError(message); |
| 2305 } | 2309 } |
| 2306 _array.setFloat32(_offset + (index * _BYTES_PER_ELEMENT), value); | 2310 _array.setFloat32(_offset + (index * _BYTES_PER_ELEMENT), value); |
| 2307 } | 2311 } |
| 2308 | 2312 |
| 2309 Iterator<double> iterator() { | 2313 Iterator<double> get iterator { |
| 2310 return new _ByteArrayIterator<double>(this); | 2314 return new _ByteArrayIterator<double>(this); |
| 2311 } | 2315 } |
| 2312 | 2316 |
| 2313 List<double> getRange(int start, int length) { | 2317 List<double> getRange(int start, int length) { |
| 2314 _rangeCheck(this.length, start, length); | 2318 _rangeCheck(this.length, start, length); |
| 2315 List<double> result = new Float32List(length); | 2319 List<double> result = new Float32List(length); |
| 2316 result.setRange(0, length, this, start); | 2320 result.setRange(0, length, this, start); |
| 2317 return result; | 2321 return result; |
| 2318 } | 2322 } |
| 2319 | 2323 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 } | 2375 } |
| 2372 | 2376 |
| 2373 void operator[]=(int index, double value) { | 2377 void operator[]=(int index, double value) { |
| 2374 if (index < 0 || index >= _length) { | 2378 if (index < 0 || index >= _length) { |
| 2375 String message = "$index must be in the range [0..$_length)"; | 2379 String message = "$index must be in the range [0..$_length)"; |
| 2376 throw new RangeError(message); | 2380 throw new RangeError(message); |
| 2377 } | 2381 } |
| 2378 _array.setFloat64(_offset + (index * _BYTES_PER_ELEMENT), value); | 2382 _array.setFloat64(_offset + (index * _BYTES_PER_ELEMENT), value); |
| 2379 } | 2383 } |
| 2380 | 2384 |
| 2381 Iterator<double> iterator() { | 2385 Iterator<double> get iterator { |
| 2382 return new _ByteArrayIterator<double>(this); | 2386 return new _ByteArrayIterator<double>(this); |
| 2383 } | 2387 } |
| 2384 | 2388 |
| 2385 List<double> getRange(int start, int length) { | 2389 List<double> getRange(int start, int length) { |
| 2386 _rangeCheck(this.length, start, length); | 2390 _rangeCheck(this.length, start, length); |
| 2387 List<double> result = new Float64List(length); | 2391 List<double> result = new Float64List(length); |
| 2388 result.setRange(0, length, this, start); | 2392 result.setRange(0, length, this, start); |
| 2389 return result; | 2393 return result; |
| 2390 } | 2394 } |
| 2391 | 2395 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2411 } | 2415 } |
| 2412 _rangeCheck(this.length, start, length); | 2416 _rangeCheck(this.length, start, length); |
| 2413 return _array.subByteArray(_offset + start, length); | 2417 return _array.subByteArray(_offset + start, length); |
| 2414 } | 2418 } |
| 2415 | 2419 |
| 2416 static const int _BYTES_PER_ELEMENT = 8; | 2420 static const int _BYTES_PER_ELEMENT = 8; |
| 2417 final ByteArray _array; | 2421 final ByteArray _array; |
| 2418 final int _offset; | 2422 final int _offset; |
| 2419 final int _length; | 2423 final int _length; |
| 2420 } | 2424 } |
| OLD | NEW |