| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 classes for Int8List ..... Float64List and ByteData implementations. | 5 // patch classes for Int8List ..... Float64List and ByteData implementations. |
| 6 | 6 |
| 7 patch class Int8List { | 7 patch class Int8List { |
| 8 /* patch */ factory Int8List(int length) { | 8 /* patch */ factory Int8List(int length) { |
| 9 return new _Int8Array(length); | 9 return new _Int8Array(length); |
| 10 } | 10 } |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 List toList() { | 429 List toList() { |
| 430 return new List.from(this); | 430 return new List.from(this); |
| 431 } | 431 } |
| 432 | 432 |
| 433 Set toSet() { | 433 Set toSet() { |
| 434 return new Set.from(this); | 434 return new Set.from(this); |
| 435 } | 435 } |
| 436 | 436 |
| 437 List getRange(int start, int length) { | 437 List getRange(int start, int length) { |
| 438 _rangeCheck(this.length, start, length); | 438 _rangeCheck(this.length, start, length); |
| 439 List result = _new(length); | 439 List result = _createList(length); |
| 440 result.setRange(0, length, this, start); | 440 result.setRange(0, length, this, start); |
| 441 return result; | 441 return result; |
| 442 } | 442 } |
| 443 | 443 |
| 444 void setRange(int start, int length, List from, [int startFrom = 0]) { | 444 void setRange(int start, int length, List from, [int startFrom = 0]) { |
| 445 IterableMixinWorkaround.setRangeList(this, start, length, from, startFrom); | 445 IterableMixinWorkaround.setRangeList(this, start, length, from, startFrom); |
| 446 } | 446 } |
| 447 | 447 |
| 448 // Method(s) implementing Object interface. | 448 // Method(s) implementing Object interface. |
| 449 | 449 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 552 |
| 553 // Method(s) implementing TypedData interface. | 553 // Method(s) implementing TypedData interface. |
| 554 | 554 |
| 555 int get elementSizeInBytes { | 555 int get elementSizeInBytes { |
| 556 return Int8List.BYTES_PER_ELEMENT; | 556 return Int8List.BYTES_PER_ELEMENT; |
| 557 } | 557 } |
| 558 | 558 |
| 559 | 559 |
| 560 // Internal utility methods. | 560 // Internal utility methods. |
| 561 | 561 |
| 562 _Int8Array _createList(int length) { |
| 563 return _new(length); |
| 564 } |
| 565 |
| 562 static _Int8Array _new(int length) native "TypedData_Int8Array_new"; | 566 static _Int8Array _new(int length) native "TypedData_Int8Array_new"; |
| 563 } | 567 } |
| 564 | 568 |
| 565 | 569 |
| 566 class _Uint8Array extends _TypedList implements Uint8List { | 570 class _Uint8Array extends _TypedList implements Uint8List { |
| 567 // Factory constructors. | 571 // Factory constructors. |
| 568 | 572 |
| 569 factory _Uint8Array(int length) { | 573 factory _Uint8Array(int length) { |
| 570 if (length < 0) { | 574 if (length < 0) { |
| 571 String message = "$length must be greater than 0"; | 575 String message = "$length must be greater than 0"; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 Iterator<int> get iterator { | 607 Iterator<int> get iterator { |
| 604 return new _TypedListIterator<int>(this); | 608 return new _TypedListIterator<int>(this); |
| 605 } | 609 } |
| 606 | 610 |
| 607 | 611 |
| 608 // Methods implementing TypedData interface. | 612 // Methods implementing TypedData interface. |
| 609 int get elementSizeInBytes { | 613 int get elementSizeInBytes { |
| 610 return Uint8List.BYTES_PER_ELEMENT; | 614 return Uint8List.BYTES_PER_ELEMENT; |
| 611 } | 615 } |
| 612 | 616 |
| 617 |
| 613 // Internal utility methods. | 618 // Internal utility methods. |
| 614 | 619 |
| 620 _Uint8Array _createList(int length) { |
| 621 return _new(length); |
| 622 } |
| 623 |
| 615 static _Uint8Array _new(int length) native "TypedData_Uint8Array_new"; | 624 static _Uint8Array _new(int length) native "TypedData_Uint8Array_new"; |
| 616 } | 625 } |
| 617 | 626 |
| 618 | 627 |
| 619 class _Uint8ClampedArray extends _TypedList implements Uint8ClampedList { | 628 class _Uint8ClampedArray extends _TypedList implements Uint8ClampedList { |
| 620 // Factory constructors. | 629 // Factory constructors. |
| 621 | 630 |
| 622 factory _Uint8ClampedArray(int length) { | 631 factory _Uint8ClampedArray(int length) { |
| 623 if (length < 0) { | 632 if (length < 0) { |
| 624 String message = "$length must be greater than 0"; | 633 String message = "$length must be greater than 0"; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 669 |
| 661 | 670 |
| 662 // Methods implementing TypedData interface. | 671 // Methods implementing TypedData interface. |
| 663 int get elementSizeInBytes { | 672 int get elementSizeInBytes { |
| 664 return Uint8List.BYTES_PER_ELEMENT; | 673 return Uint8List.BYTES_PER_ELEMENT; |
| 665 } | 674 } |
| 666 | 675 |
| 667 | 676 |
| 668 // Internal utility methods. | 677 // Internal utility methods. |
| 669 | 678 |
| 679 _Uint8ClampedArray _createList(int length) { |
| 680 return _new(length); |
| 681 } |
| 682 |
| 670 static _Uint8ClampedArray _new(int length) | 683 static _Uint8ClampedArray _new(int length) |
| 671 native "TypedData_Uint8ClampedArray_new"; | 684 native "TypedData_Uint8ClampedArray_new"; |
| 672 } | 685 } |
| 673 | 686 |
| 674 | 687 |
| 675 class _Int16Array extends _TypedList implements Int16List { | 688 class _Int16Array extends _TypedList implements Int16List { |
| 676 // Factory constructors. | 689 // Factory constructors. |
| 677 | 690 |
| 678 factory _Int16Array(int length) { | 691 factory _Int16Array(int length) { |
| 679 if (length < 0) { | 692 if (length < 0) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 | 731 |
| 719 // Method(s) implementing TypedData interface. | 732 // Method(s) implementing TypedData interface. |
| 720 | 733 |
| 721 int get elementSizeInBytes { | 734 int get elementSizeInBytes { |
| 722 return Int16List.BYTES_PER_ELEMENT; | 735 return Int16List.BYTES_PER_ELEMENT; |
| 723 } | 736 } |
| 724 | 737 |
| 725 | 738 |
| 726 // Internal utility methods. | 739 // Internal utility methods. |
| 727 | 740 |
| 741 _Int16Array _createList(int length) { |
| 742 return _new(length); |
| 743 } |
| 744 |
| 728 static _Int16Array _new(int length) native "TypedData_Int16Array_new"; | 745 static _Int16Array _new(int length) native "TypedData_Int16Array_new"; |
| 729 } | 746 } |
| 730 | 747 |
| 731 | 748 |
| 732 class _Uint16Array extends _TypedList implements Uint16List { | 749 class _Uint16Array extends _TypedList implements Uint16List { |
| 733 // Factory constructors. | 750 // Factory constructors. |
| 734 | 751 |
| 735 factory _Uint16Array(int length) { | 752 factory _Uint16Array(int length) { |
| 736 if (length < 0) { | 753 if (length < 0) { |
| 737 String message = "$length must be greater than 0"; | 754 String message = "$length must be greater than 0"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 792 |
| 776 // Method(s) implementing the TypedData interface. | 793 // Method(s) implementing the TypedData interface. |
| 777 | 794 |
| 778 int get elementSizeInBytes { | 795 int get elementSizeInBytes { |
| 779 return Uint16List.BYTES_PER_ELEMENT; | 796 return Uint16List.BYTES_PER_ELEMENT; |
| 780 } | 797 } |
| 781 | 798 |
| 782 | 799 |
| 783 // Internal utility methods. | 800 // Internal utility methods. |
| 784 | 801 |
| 802 _Uint16Array _createList(int length) { |
| 803 return _new(length); |
| 804 } |
| 805 |
| 785 static _Uint16Array _new(int length) native "TypedData_Uint16Array_new"; | 806 static _Uint16Array _new(int length) native "TypedData_Uint16Array_new"; |
| 786 } | 807 } |
| 787 | 808 |
| 788 | 809 |
| 789 class _Int32Array extends _TypedList implements Int32List { | 810 class _Int32Array extends _TypedList implements Int32List { |
| 790 // Factory constructors. | 811 // Factory constructors. |
| 791 | 812 |
| 792 factory _Int32Array(int length) { | 813 factory _Int32Array(int length) { |
| 793 if (length < 0) { | 814 if (length < 0) { |
| 794 String message = "$length must be greater than 0"; | 815 String message = "$length must be greater than 0"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 | 853 |
| 833 // Method(s) implementing TypedData interface. | 854 // Method(s) implementing TypedData interface. |
| 834 | 855 |
| 835 int get elementSizeInBytes { | 856 int get elementSizeInBytes { |
| 836 return Int32List.BYTES_PER_ELEMENT; | 857 return Int32List.BYTES_PER_ELEMENT; |
| 837 } | 858 } |
| 838 | 859 |
| 839 | 860 |
| 840 // Internal utility methods. | 861 // Internal utility methods. |
| 841 | 862 |
| 863 _Int32Array _createList(int length) { |
| 864 return _new(length); |
| 865 } |
| 866 |
| 842 static _Int32Array _new(int length) native "TypedData_Int32Array_new"; | 867 static _Int32Array _new(int length) native "TypedData_Int32Array_new"; |
| 843 } | 868 } |
| 844 | 869 |
| 845 | 870 |
| 846 class _Uint32Array extends _TypedList implements Uint32List { | 871 class _Uint32Array extends _TypedList implements Uint32List { |
| 847 // Factory constructors. | 872 // Factory constructors. |
| 848 | 873 |
| 849 factory _Uint32Array(int length) { | 874 factory _Uint32Array(int length) { |
| 850 if (length < 0) { | 875 if (length < 0) { |
| 851 String message = "$length must be greater than 0"; | 876 String message = "$length must be greater than 0"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 914 |
| 890 // Method(s) implementing the TypedData interface. | 915 // Method(s) implementing the TypedData interface. |
| 891 | 916 |
| 892 int get elementSizeInBytes { | 917 int get elementSizeInBytes { |
| 893 return Uint32List.BYTES_PER_ELEMENT; | 918 return Uint32List.BYTES_PER_ELEMENT; |
| 894 } | 919 } |
| 895 | 920 |
| 896 | 921 |
| 897 // Internal utility methods. | 922 // Internal utility methods. |
| 898 | 923 |
| 924 _Uint32Array _createList(int length) { |
| 925 return _new(length); |
| 926 } |
| 927 |
| 899 static _Uint32Array _new(int length) native "TypedData_Uint32Array_new"; | 928 static _Uint32Array _new(int length) native "TypedData_Uint32Array_new"; |
| 900 } | 929 } |
| 901 | 930 |
| 902 | 931 |
| 903 class _Int64Array extends _TypedList implements Int64List { | 932 class _Int64Array extends _TypedList implements Int64List { |
| 904 // Factory constructors. | 933 // Factory constructors. |
| 905 | 934 |
| 906 factory _Int64Array(int length) { | 935 factory _Int64Array(int length) { |
| 907 if (length < 0) { | 936 if (length < 0) { |
| 908 String message = "$length must be greater than 0"; | 937 String message = "$length must be greater than 0"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 | 975 |
| 947 // Method(s) implementing the TypedData interface. | 976 // Method(s) implementing the TypedData interface. |
| 948 | 977 |
| 949 int get elementSizeInBytes { | 978 int get elementSizeInBytes { |
| 950 return Int64List.BYTES_PER_ELEMENT; | 979 return Int64List.BYTES_PER_ELEMENT; |
| 951 } | 980 } |
| 952 | 981 |
| 953 | 982 |
| 954 // Internal utility methods. | 983 // Internal utility methods. |
| 955 | 984 |
| 985 _Int64Array _createList(int length) { |
| 986 return _new(length); |
| 987 } |
| 988 |
| 956 static _Int64Array _new(int length) native "TypedData_Int64Array_new"; | 989 static _Int64Array _new(int length) native "TypedData_Int64Array_new"; |
| 957 } | 990 } |
| 958 | 991 |
| 959 | 992 |
| 960 class _Uint64Array extends _TypedList implements Uint64List { | 993 class _Uint64Array extends _TypedList implements Uint64List { |
| 961 // Factory constructors. | 994 // Factory constructors. |
| 962 | 995 |
| 963 factory _Uint64Array(int length) { | 996 factory _Uint64Array(int length) { |
| 964 if (length < 0) { | 997 if (length < 0) { |
| 965 String message = "$length must be greater than 0"; | 998 String message = "$length must be greater than 0"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1036 |
| 1004 // Method(s) implementing the TypedData interface. | 1037 // Method(s) implementing the TypedData interface. |
| 1005 | 1038 |
| 1006 int get elementSizeInBytes { | 1039 int get elementSizeInBytes { |
| 1007 return Uint64List.BYTES_PER_ELEMENT; | 1040 return Uint64List.BYTES_PER_ELEMENT; |
| 1008 } | 1041 } |
| 1009 | 1042 |
| 1010 | 1043 |
| 1011 // Internal utility methods. | 1044 // Internal utility methods. |
| 1012 | 1045 |
| 1046 _Uint64Array _createList(int length) { |
| 1047 return _new(length); |
| 1048 } |
| 1049 |
| 1013 static _Uint64Array _new(int length) native "TypedData_Uint64Array_new"; | 1050 static _Uint64Array _new(int length) native "TypedData_Uint64Array_new"; |
| 1014 } | 1051 } |
| 1015 | 1052 |
| 1016 | 1053 |
| 1017 class _Float32Array extends _TypedList implements Float32List { | 1054 class _Float32Array extends _TypedList implements Float32List { |
| 1018 // Factory constructors. | 1055 // Factory constructors. |
| 1019 | 1056 |
| 1020 factory _Float32Array(int length) { | 1057 factory _Float32Array(int length) { |
| 1021 if (length < 0) { | 1058 if (length < 0) { |
| 1022 String message = "$length must be greater than 0"; | 1059 String message = "$length must be greater than 0"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1097 |
| 1061 // Method(s) implementing the TypedData interface. | 1098 // Method(s) implementing the TypedData interface. |
| 1062 | 1099 |
| 1063 int get elementSizeInBytes { | 1100 int get elementSizeInBytes { |
| 1064 return Float32List.BYTES_PER_ELEMENT; | 1101 return Float32List.BYTES_PER_ELEMENT; |
| 1065 } | 1102 } |
| 1066 | 1103 |
| 1067 | 1104 |
| 1068 // Internal utility methods. | 1105 // Internal utility methods. |
| 1069 | 1106 |
| 1107 _Float32Array _createList(int length) { |
| 1108 return _new(length); |
| 1109 } |
| 1110 |
| 1070 static _Float32Array _new(int length) native "TypedData_Float32Array_new"; | 1111 static _Float32Array _new(int length) native "TypedData_Float32Array_new"; |
| 1071 } | 1112 } |
| 1072 | 1113 |
| 1073 | 1114 |
| 1074 class _Float64Array extends _TypedList implements Float64List { | 1115 class _Float64Array extends _TypedList implements Float64List { |
| 1075 // Factory constructors. | 1116 // Factory constructors. |
| 1076 | 1117 |
| 1077 factory _Float64Array(int length) { | 1118 factory _Float64Array(int length) { |
| 1078 if (length < 0) { | 1119 if (length < 0) { |
| 1079 String message = "$length must be greater than 0"; | 1120 String message = "$length must be greater than 0"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 | 1158 |
| 1118 // Method(s) implementing the TypedData interface. | 1159 // Method(s) implementing the TypedData interface. |
| 1119 | 1160 |
| 1120 int get elementSizeInBytes { | 1161 int get elementSizeInBytes { |
| 1121 return Float64List.BYTES_PER_ELEMENT; | 1162 return Float64List.BYTES_PER_ELEMENT; |
| 1122 } | 1163 } |
| 1123 | 1164 |
| 1124 | 1165 |
| 1125 // Internal utility methods. | 1166 // Internal utility methods. |
| 1126 | 1167 |
| 1168 _Float64Array _createList(int length) { |
| 1169 return _new(length); |
| 1170 } |
| 1171 |
| 1127 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; | 1172 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; |
| 1128 } | 1173 } |
| 1129 | 1174 |
| 1130 | 1175 |
| 1131 class _ExternalInt8Array extends _TypedList implements Int8List { | 1176 class _ExternalInt8Array extends _TypedList implements Int8List { |
| 1132 // Factory constructors. | 1177 // Factory constructors. |
| 1133 | 1178 |
| 1134 factory _ExternalInt8Array(int length) { | 1179 factory _ExternalInt8Array(int length) { |
| 1135 if (length < 0) { | 1180 if (length < 0) { |
| 1136 String message = "$length must be greater than 0"; | 1181 String message = "$length must be greater than 0"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1164 | 1209 |
| 1165 // Method(s) implementing the TypedData interface. | 1210 // Method(s) implementing the TypedData interface. |
| 1166 | 1211 |
| 1167 int get elementSizeInBytes { | 1212 int get elementSizeInBytes { |
| 1168 return Int8List.BYTES_PER_ELEMENT; | 1213 return Int8List.BYTES_PER_ELEMENT; |
| 1169 } | 1214 } |
| 1170 | 1215 |
| 1171 | 1216 |
| 1172 // Internal utility methods. | 1217 // Internal utility methods. |
| 1173 | 1218 |
| 1219 Int8List _createList(int length) { |
| 1220 return new Int8List(length); |
| 1221 } |
| 1222 |
| 1174 static _ExternalInt8Array _new(int length) native | 1223 static _ExternalInt8Array _new(int length) native |
| 1175 "ExternalTypedData_Int8Array_new"; | 1224 "ExternalTypedData_Int8Array_new"; |
| 1176 } | 1225 } |
| 1177 | 1226 |
| 1178 | 1227 |
| 1179 class _ExternalUint8Array extends _TypedList implements Uint8List { | 1228 class _ExternalUint8Array extends _TypedList implements Uint8List { |
| 1180 // Factory constructors. | 1229 // Factory constructors. |
| 1181 | 1230 |
| 1182 factory _ExternalUint8Array(int length) { | 1231 factory _ExternalUint8Array(int length) { |
| 1183 if (length < 0) { | 1232 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1213 | 1262 |
| 1214 // Method(s) implementing the TypedData interface. | 1263 // Method(s) implementing the TypedData interface. |
| 1215 | 1264 |
| 1216 int get elementSizeInBytes { | 1265 int get elementSizeInBytes { |
| 1217 return Uint8List.BYTES_PER_ELEMENT; | 1266 return Uint8List.BYTES_PER_ELEMENT; |
| 1218 } | 1267 } |
| 1219 | 1268 |
| 1220 | 1269 |
| 1221 // Internal utility methods. | 1270 // Internal utility methods. |
| 1222 | 1271 |
| 1272 Uint8List _createList(int length) { |
| 1273 return new Uint8List(length); |
| 1274 } |
| 1275 |
| 1223 static _ExternalUint8Array _new(int length) native | 1276 static _ExternalUint8Array _new(int length) native |
| 1224 "ExternalTypedData_Uint8Array_new"; | 1277 "ExternalTypedData_Uint8Array_new"; |
| 1225 } | 1278 } |
| 1226 | 1279 |
| 1227 | 1280 |
| 1228 class _ExternalUint8ClampedArray extends _TypedList implements Uint8ClampedList
{ | 1281 class _ExternalUint8ClampedArray extends _TypedList implements Uint8ClampedList
{ |
| 1229 // Factory constructors. | 1282 // Factory constructors. |
| 1230 | 1283 |
| 1231 factory _ExternalUint8ClampedArray(int length) { | 1284 factory _ExternalUint8ClampedArray(int length) { |
| 1232 if (length < 0) { | 1285 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1262 | 1315 |
| 1263 // Method(s) implementing the TypedData interface. | 1316 // Method(s) implementing the TypedData interface. |
| 1264 | 1317 |
| 1265 int get elementSizeInBytes { | 1318 int get elementSizeInBytes { |
| 1266 return Uint8List.BYTES_PER_ELEMENT; | 1319 return Uint8List.BYTES_PER_ELEMENT; |
| 1267 } | 1320 } |
| 1268 | 1321 |
| 1269 | 1322 |
| 1270 // Internal utility methods. | 1323 // Internal utility methods. |
| 1271 | 1324 |
| 1325 Uint8ClampedList _createList(int length) { |
| 1326 return new Uint8ClampedList(length); |
| 1327 } |
| 1328 |
| 1272 static _ExternalUint8ClampedArray _new(int length) native | 1329 static _ExternalUint8ClampedArray _new(int length) native |
| 1273 "ExternalTypedData_Uint8ClampedArray_new"; | 1330 "ExternalTypedData_Uint8ClampedArray_new"; |
| 1274 } | 1331 } |
| 1275 | 1332 |
| 1276 | 1333 |
| 1277 class _ExternalInt16Array extends _TypedList implements Int16List { | 1334 class _ExternalInt16Array extends _TypedList implements Int16List { |
| 1278 // Factory constructors. | 1335 // Factory constructors. |
| 1279 | 1336 |
| 1280 factory _ExternalInt16Array(int length) { | 1337 factory _ExternalInt16Array(int length) { |
| 1281 if (length < 0) { | 1338 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1311 | 1368 |
| 1312 // Method(s) implementing the TypedData interface. | 1369 // Method(s) implementing the TypedData interface. |
| 1313 | 1370 |
| 1314 int get elementSizeInBytes { | 1371 int get elementSizeInBytes { |
| 1315 return Int16List.BYTES_PER_ELEMENT; | 1372 return Int16List.BYTES_PER_ELEMENT; |
| 1316 } | 1373 } |
| 1317 | 1374 |
| 1318 | 1375 |
| 1319 // Internal utility methods. | 1376 // Internal utility methods. |
| 1320 | 1377 |
| 1378 Int16List _createList(int length) { |
| 1379 return new Int16List(length); |
| 1380 } |
| 1381 |
| 1321 static _ExternalInt16Array _new(int length) native | 1382 static _ExternalInt16Array _new(int length) native |
| 1322 "ExternalTypedData_Int16Array_new"; | 1383 "ExternalTypedData_Int16Array_new"; |
| 1323 } | 1384 } |
| 1324 | 1385 |
| 1325 | 1386 |
| 1326 class _ExternalUint16Array extends _TypedList implements Uint16List { | 1387 class _ExternalUint16Array extends _TypedList implements Uint16List { |
| 1327 // Factory constructors. | 1388 // Factory constructors. |
| 1328 | 1389 |
| 1329 factory _ExternalUint16Array(int length) { | 1390 factory _ExternalUint16Array(int length) { |
| 1330 if (length < 0) { | 1391 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1360 | 1421 |
| 1361 // Method(s) implementing the TypedData interface. | 1422 // Method(s) implementing the TypedData interface. |
| 1362 | 1423 |
| 1363 int get elementSizeInBytes { | 1424 int get elementSizeInBytes { |
| 1364 return Uint16List.BYTES_PER_ELEMENT; | 1425 return Uint16List.BYTES_PER_ELEMENT; |
| 1365 } | 1426 } |
| 1366 | 1427 |
| 1367 | 1428 |
| 1368 // Internal utility methods. | 1429 // Internal utility methods. |
| 1369 | 1430 |
| 1431 Uint16List _createList(int length) { |
| 1432 return new Uint16List(length); |
| 1433 } |
| 1434 |
| 1370 static _ExternalUint16Array _new(int length) native | 1435 static _ExternalUint16Array _new(int length) native |
| 1371 "ExternalTypedData_Uint16Array_new"; | 1436 "ExternalTypedData_Uint16Array_new"; |
| 1372 } | 1437 } |
| 1373 | 1438 |
| 1374 | 1439 |
| 1375 class _ExternalInt32Array extends _TypedList implements Int32List { | 1440 class _ExternalInt32Array extends _TypedList implements Int32List { |
| 1376 // Factory constructors. | 1441 // Factory constructors. |
| 1377 | 1442 |
| 1378 factory _ExternalInt32Array(int length) { | 1443 factory _ExternalInt32Array(int length) { |
| 1379 if (length < 0) { | 1444 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1409 | 1474 |
| 1410 // Method(s) implementing the TypedData interface. | 1475 // Method(s) implementing the TypedData interface. |
| 1411 | 1476 |
| 1412 int get elementSizeInBytes { | 1477 int get elementSizeInBytes { |
| 1413 return Int32List.BYTES_PER_ELEMENT; | 1478 return Int32List.BYTES_PER_ELEMENT; |
| 1414 } | 1479 } |
| 1415 | 1480 |
| 1416 | 1481 |
| 1417 // Internal utility methods. | 1482 // Internal utility methods. |
| 1418 | 1483 |
| 1484 Int32List _createList(int length) { |
| 1485 return new Int32List(length); |
| 1486 } |
| 1487 |
| 1419 static _ExternalInt32Array _new(int length) native | 1488 static _ExternalInt32Array _new(int length) native |
| 1420 "ExternalTypedData_Int32Array_new"; | 1489 "ExternalTypedData_Int32Array_new"; |
| 1421 } | 1490 } |
| 1422 | 1491 |
| 1423 | 1492 |
| 1424 class _ExternalUint32Array extends _TypedList implements Uint32List { | 1493 class _ExternalUint32Array extends _TypedList implements Uint32List { |
| 1425 // Factory constructors. | 1494 // Factory constructors. |
| 1426 | 1495 |
| 1427 factory _ExternalUint32Array(int length) { | 1496 factory _ExternalUint32Array(int length) { |
| 1428 if (length < 0) { | 1497 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1458 | 1527 |
| 1459 // Method(s) implementing the TypedData interface. | 1528 // Method(s) implementing the TypedData interface. |
| 1460 | 1529 |
| 1461 int get elementSizeInBytes { | 1530 int get elementSizeInBytes { |
| 1462 return Uint32List.BYTES_PER_ELEMENT; | 1531 return Uint32List.BYTES_PER_ELEMENT; |
| 1463 } | 1532 } |
| 1464 | 1533 |
| 1465 | 1534 |
| 1466 // Internal utility methods. | 1535 // Internal utility methods. |
| 1467 | 1536 |
| 1537 Uint32List _createList(int length) { |
| 1538 return new Uint32List(length); |
| 1539 } |
| 1540 |
| 1468 static _ExternalUint32Array _new(int length) native | 1541 static _ExternalUint32Array _new(int length) native |
| 1469 "ExternalTypedData_Uint32Array_new"; | 1542 "ExternalTypedData_Uint32Array_new"; |
| 1470 } | 1543 } |
| 1471 | 1544 |
| 1472 | 1545 |
| 1473 class _ExternalInt64Array extends _TypedList implements Int64List { | 1546 class _ExternalInt64Array extends _TypedList implements Int64List { |
| 1474 // Factory constructors. | 1547 // Factory constructors. |
| 1475 | 1548 |
| 1476 factory _ExternalInt64Array(int length) { | 1549 factory _ExternalInt64Array(int length) { |
| 1477 if (length < 0) { | 1550 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1507 | 1580 |
| 1508 // Method(s) implementing the TypedData interface. | 1581 // Method(s) implementing the TypedData interface. |
| 1509 | 1582 |
| 1510 int get elementSizeInBytes { | 1583 int get elementSizeInBytes { |
| 1511 return Int64List.BYTES_PER_ELEMENT; | 1584 return Int64List.BYTES_PER_ELEMENT; |
| 1512 } | 1585 } |
| 1513 | 1586 |
| 1514 | 1587 |
| 1515 // Internal utility methods. | 1588 // Internal utility methods. |
| 1516 | 1589 |
| 1590 Int64List _createList(int length) { |
| 1591 return new Int64List(length); |
| 1592 } |
| 1593 |
| 1517 static _ExternalInt64Array _new(int length) native | 1594 static _ExternalInt64Array _new(int length) native |
| 1518 "ExternalTypedData_Int64Array_new"; | 1595 "ExternalTypedData_Int64Array_new"; |
| 1519 } | 1596 } |
| 1520 | 1597 |
| 1521 | 1598 |
| 1522 class _ExternalUint64Array extends _TypedList implements Uint64List { | 1599 class _ExternalUint64Array extends _TypedList implements Uint64List { |
| 1523 // Factory constructors. | 1600 // Factory constructors. |
| 1524 | 1601 |
| 1525 factory _ExternalUint64Array(int length) { | 1602 factory _ExternalUint64Array(int length) { |
| 1526 if (length < 0) { | 1603 if (length < 0) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1549 _setUint64(index, _toUint64(value)); | 1626 _setUint64(index, _toUint64(value)); |
| 1550 } | 1627 } |
| 1551 | 1628 |
| 1552 Iterator<int> get iterator { | 1629 Iterator<int> get iterator { |
| 1553 return new _TypedListIterator<int>(this); | 1630 return new _TypedListIterator<int>(this); |
| 1554 } | 1631 } |
| 1555 | 1632 |
| 1556 | 1633 |
| 1557 // Method(s) implementing the TypedData interface. | 1634 // Method(s) implementing the TypedData interface. |
| 1558 | 1635 |
| 1636 Uint64List _createList(int length) { |
| 1637 return new Uint64List(length); |
| 1638 } |
| 1639 |
| 1559 int get elementSizeInBytes { | 1640 int get elementSizeInBytes { |
| 1560 return Uint64List.BYTES_PER_ELEMENT; | 1641 return Uint64List.BYTES_PER_ELEMENT; |
| 1561 } | 1642 } |
| 1562 | 1643 |
| 1563 | 1644 |
| 1564 // Internal utility methods. | 1645 // Internal utility methods. |
| 1565 | 1646 |
| 1566 static _ExternalUint64Array _new(int length) native | 1647 static _ExternalUint64Array _new(int length) native |
| 1567 "ExternalTypedData_Uint64Array_new"; | 1648 "ExternalTypedData_Uint64Array_new"; |
| 1568 } | 1649 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 | 1686 |
| 1606 // Method(s) implementing the TypedData interface. | 1687 // Method(s) implementing the TypedData interface. |
| 1607 | 1688 |
| 1608 int get elementSizeInBytes { | 1689 int get elementSizeInBytes { |
| 1609 return Float32List.BYTES_PER_ELEMENT; | 1690 return Float32List.BYTES_PER_ELEMENT; |
| 1610 } | 1691 } |
| 1611 | 1692 |
| 1612 | 1693 |
| 1613 // Internal utility methods. | 1694 // Internal utility methods. |
| 1614 | 1695 |
| 1696 Float32List _createList(int length) { |
| 1697 return new Float32List(length); |
| 1698 } |
| 1699 |
| 1615 static _ExternalFloat32Array _new(int length) native | 1700 static _ExternalFloat32Array _new(int length) native |
| 1616 "ExternalTypedData_Float32Array_new"; | 1701 "ExternalTypedData_Float32Array_new"; |
| 1617 } | 1702 } |
| 1618 | 1703 |
| 1619 | 1704 |
| 1620 class _ExternalFloat64Array extends _TypedList implements Float64List { | 1705 class _ExternalFloat64Array extends _TypedList implements Float64List { |
| 1621 // Factory constructors. | 1706 // Factory constructors. |
| 1622 | 1707 |
| 1623 factory _ExternalFloat64Array(int length) { | 1708 factory _ExternalFloat64Array(int length) { |
| 1624 if (length < 0) { | 1709 if (length < 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1654 | 1739 |
| 1655 // Method(s) implementing the TypedData interface. | 1740 // Method(s) implementing the TypedData interface. |
| 1656 | 1741 |
| 1657 int get elementSizeInBytes { | 1742 int get elementSizeInBytes { |
| 1658 return Float64List.BYTES_PER_ELEMENT; | 1743 return Float64List.BYTES_PER_ELEMENT; |
| 1659 } | 1744 } |
| 1660 | 1745 |
| 1661 | 1746 |
| 1662 // Internal utility methods. | 1747 // Internal utility methods. |
| 1663 | 1748 |
| 1749 Float64List _createList(int length) { |
| 1750 return new Float64List(length); |
| 1751 } |
| 1752 |
| 1664 static _ExternalFloat64Array _new(int length) native | 1753 static _ExternalFloat64Array _new(int length) native |
| 1665 "ExternalTypedData_Float64Array_new"; | 1754 "ExternalTypedData_Float64Array_new"; |
| 1666 } | 1755 } |
| 1667 | 1756 |
| 1668 | 1757 |
| 1669 class _TypedListIterator<E> implements Iterator<E> { | 1758 class _TypedListIterator<E> implements Iterator<E> { |
| 1670 final List<E> _array; | 1759 final List<E> _array; |
| 1671 final int _length; | 1760 final int _length; |
| 1672 int _position; | 1761 int _position; |
| 1673 E _current; | 1762 E _current; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 | 1807 |
| 1719 | 1808 |
| 1720 class _Int8ArrayView extends _TypedListView implements Int8List { | 1809 class _Int8ArrayView extends _TypedListView implements Int8List { |
| 1721 // Constructor. | 1810 // Constructor. |
| 1722 _Int8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) | 1811 _Int8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) |
| 1723 : super(buffer, _offsetInBytes, | 1812 : super(buffer, _offsetInBytes, |
| 1724 _defaultIfNull(_length, | 1813 _defaultIfNull(_length, |
| 1725 ((buffer.lengthInBytes - _offsetInBytes) ~/ | 1814 ((buffer.lengthInBytes - _offsetInBytes) ~/ |
| 1726 Int8List.BYTES_PER_ELEMENT))) { | 1815 Int8List.BYTES_PER_ELEMENT))) { |
| 1727 _rangeCheck(buffer.lengthInBytes, | 1816 _rangeCheck(buffer.lengthInBytes, |
| 1728 offsetInBytes, | 1817 _offsetInBytes, |
| 1729 length * Int8List.BYTES_PER_ELEMENT); | 1818 _length * Int8List.BYTES_PER_ELEMENT); |
| 1730 } | 1819 } |
| 1731 | 1820 |
| 1732 | 1821 |
| 1733 // Method(s) implementing List interface. | 1822 // Method(s) implementing List interface. |
| 1734 | 1823 |
| 1735 int operator[](int index) { | 1824 int operator[](int index) { |
| 1736 if (index < 0 || index >= length) { | 1825 if (index < 0 || index >= length) { |
| 1737 String message = "$index must be in the range [0..$length)"; | 1826 String message = "$index must be in the range [0..$length)"; |
| 1738 throw new RangeError(message); | 1827 throw new RangeError(message); |
| 1739 } | 1828 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1764 | 1853 |
| 1765 | 1854 |
| 1766 class _Uint8ArrayView extends _TypedListView implements Uint8List { | 1855 class _Uint8ArrayView extends _TypedListView implements Uint8List { |
| 1767 // Constructor. | 1856 // Constructor. |
| 1768 _Uint8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) | 1857 _Uint8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) |
| 1769 : super(buffer, _offsetInBytes, | 1858 : super(buffer, _offsetInBytes, |
| 1770 _defaultIfNull(_length, | 1859 _defaultIfNull(_length, |
| 1771 ((buffer.lengthInBytes - _offsetInBytes) ~/ | 1860 ((buffer.lengthInBytes - _offsetInBytes) ~/ |
| 1772 Uint8List.BYTES_PER_ELEMENT))) { | 1861 Uint8List.BYTES_PER_ELEMENT))) { |
| 1773 _rangeCheck(buffer.lengthInBytes, | 1862 _rangeCheck(buffer.lengthInBytes, |
| 1774 offsetInBytes, | 1863 _offsetInBytes, |
| 1775 length * Uint8List.BYTES_PER_ELEMENT); | 1864 _length * Uint8List.BYTES_PER_ELEMENT); |
| 1776 } | 1865 } |
| 1777 | 1866 |
| 1778 | 1867 |
| 1779 // Method(s) implementing List interface. | 1868 // Method(s) implementing List interface. |
| 1780 | 1869 |
| 1781 int operator[](int index) { | 1870 int operator[](int index) { |
| 1782 if (index < 0 || index >= length) { | 1871 if (index < 0 || index >= length) { |
| 1783 String message = "$index must be in the range [0..$length)"; | 1872 String message = "$index must be in the range [0..$length)"; |
| 1784 throw new RangeError(message); | 1873 throw new RangeError(message); |
| 1785 } | 1874 } |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2390 if (start + length > listLength) { | 2479 if (start + length > listLength) { |
| 2391 throw new RangeError.value(start + length); | 2480 throw new RangeError.value(start + length); |
| 2392 } | 2481 } |
| 2393 } | 2482 } |
| 2394 | 2483 |
| 2395 | 2484 |
| 2396 int _defaultIfNull(object, value) { | 2485 int _defaultIfNull(object, value) { |
| 2397 if (object == null) { | 2486 if (object == null) { |
| 2398 return value; | 2487 return value; |
| 2399 } | 2488 } |
| 2489 return object; |
| 2400 } | 2490 } |
| OLD | NEW |