| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 } | 468 } |
| 469 | 469 |
| 470 | 470 |
| 471 // Methods implementing the collection interface. | 471 // Methods implementing the collection interface. |
| 472 | 472 |
| 473 int get length native "TypedData_length"; | 473 int get length native "TypedData_length"; |
| 474 | 474 |
| 475 | 475 |
| 476 // Internal utility methods. | 476 // Internal utility methods. |
| 477 | 477 |
| 478 int _getInt8(int index) native "TypedData_GetInt8"; | 478 int _getInt8(int offsetInBytes) native "TypedData_GetInt8"; |
| 479 void _setInt8(int index, int value) native "TypedData_SetInt8"; | 479 void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8"; |
| 480 | 480 |
| 481 int _getUint8(int index) native "TypedData_GetUint8"; | 481 int _getUint8(int offsetInBytes) native "TypedData_GetUint8"; |
| 482 void _setUint8(int index, int value) native "TypedData_SetUint8"; | 482 void _setUint8(int offsetInBytes, int value) native "TypedData_SetUint8"; |
| 483 | 483 |
| 484 int _getInt16(int index) native "TypedData_GetInt16"; | 484 int _getInt16(int offsetInBytes) native "TypedData_GetInt16"; |
| 485 void _setInt16(int index, int value) native "TypedData_SetInt16"; | 485 void _setInt16(int offsetInBytes, int value) native "TypedData_SetInt16"; |
| 486 | 486 |
| 487 int _getUint16(int index) native "TypedData_GetUint16"; | 487 int _getUint16(int offsetInBytes) native "TypedData_GetUint16"; |
| 488 void _setUint16(int index, int value) native "TypedData_SetUint16"; | 488 void _setUint16(int offsetInBytes, int value) native "TypedData_SetUint16"; |
| 489 | 489 |
| 490 int _getInt32(int index) native "TypedData_GetInt32"; | 490 int _getInt32(int offsetInBytes) native "TypedData_GetInt32"; |
| 491 void _setInt32(int index, int value) native "TypedData_SetInt32"; | 491 void _setInt32(int offsetInBytes, int value) native "TypedData_SetInt32"; |
| 492 | 492 |
| 493 int _getUint32(int index) native "TypedData_GetUint32"; | 493 int _getUint32(int offsetInBytes) native "TypedData_GetUint32"; |
| 494 void _setUint32(int index, int value) native "TypedData_SetUint32"; | 494 void _setUint32(int offsetInBytes, int value) native "TypedData_SetUint32"; |
| 495 | 495 |
| 496 int _getInt64(int index) native "TypedData_GetInt64"; | 496 int _getInt64(int offsetInBytes) native "TypedData_GetInt64"; |
| 497 void _setInt64(int index, int value) native "TypedData_SetInt64"; | 497 void _setInt64(int offsetInBytes, int value) native "TypedData_SetInt64"; |
| 498 | 498 |
| 499 int _getUint64(int index) native "TypedData_GetUint64"; | 499 int _getUint64(int offsetInBytes) native "TypedData_GetUint64"; |
| 500 void _setUint64(int index, int value) native "TypedData_SetUint64"; | 500 void _setUint64(int offsetInBytes, int value) native "TypedData_SetUint64"; |
| 501 | 501 |
| 502 double _getFloat32(int index) native "TypedData_GetFloat32"; | 502 double _getFloat32(int offsetInBytes) native "TypedData_GetFloat32"; |
| 503 void _setFloat32(int index, double value) native "TypedData_SetFloat32"; | 503 void _setFloat32(int offsetInBytes, double value) |
| 504 native "TypedData_SetFloat32"; |
| 504 | 505 |
| 505 double _getFloat64(int index) native "TypedData_GetFloat64"; | 506 double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64"; |
| 506 void _setFloat64(int index, double value) native "TypedData_SetFloat64"; | 507 void _setFloat64(int offsetInBytes, double value) |
| 508 native "TypedData_SetFloat64"; |
| 507 } | 509 } |
| 508 | 510 |
| 509 | 511 |
| 510 class _Int8Array extends _TypedList implements Int8List { | 512 class _Int8Array extends _TypedList implements Int8List { |
| 511 // Factory constructors. | 513 // Factory constructors. |
| 512 | 514 |
| 513 factory _Int8Array(int length) { | 515 factory _Int8Array(int length) { |
| 514 if (length < 0) { | 516 if (length < 0) { |
| 515 String message = "$length must be greater than 0"; | 517 String message = "$length must be greater than 0"; |
| 516 throw new ArgumentError(message); | 518 throw new ArgumentError(message); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 } | 708 } |
| 707 | 709 |
| 708 | 710 |
| 709 // Method(s) implementing List interface. | 711 // Method(s) implementing List interface. |
| 710 | 712 |
| 711 int operator[](int index) { | 713 int operator[](int index) { |
| 712 if (index < 0 || index >= length) { | 714 if (index < 0 || index >= length) { |
| 713 String message = "$index must be in the range [0..$length)"; | 715 String message = "$index must be in the range [0..$length)"; |
| 714 throw new RangeError(message); | 716 throw new RangeError(message); |
| 715 } | 717 } |
| 716 return _getInt16(index); | 718 return _getIndexedInt16(index); |
| 717 } | 719 } |
| 718 | 720 |
| 719 void operator[]=(int index, int value) { | 721 void operator[]=(int index, int value) { |
| 720 if (index < 0 || index >= length) { | 722 if (index < 0 || index >= length) { |
| 721 String message = "$index must be in the range [0..$length)"; | 723 String message = "$index must be in the range [0..$length)"; |
| 722 throw new RangeError(message); | 724 throw new RangeError(message); |
| 723 } | 725 } |
| 724 _setInt16(index, _toInt16(value)); | 726 _setIndexedInt16(index, _toInt16(value)); |
| 725 } | 727 } |
| 726 | 728 |
| 727 Iterator<int> get iterator { | 729 Iterator<int> get iterator { |
| 728 return new _TypedListIterator<int>(this); | 730 return new _TypedListIterator<int>(this); |
| 729 } | 731 } |
| 730 | 732 |
| 731 | 733 |
| 732 // Method(s) implementing TypedData interface. | 734 // Method(s) implementing TypedData interface. |
| 733 | 735 |
| 734 int get elementSizeInBytes { | 736 int get elementSizeInBytes { |
| 735 return Int16List.BYTES_PER_ELEMENT; | 737 return Int16List.BYTES_PER_ELEMENT; |
| 736 } | 738 } |
| 737 | 739 |
| 738 | 740 |
| 739 // Internal utility methods. | 741 // Internal utility methods. |
| 740 | 742 |
| 741 _Int16Array _createList(int length) { | 743 _Int16Array _createList(int length) { |
| 742 return _new(length); | 744 return _new(length); |
| 743 } | 745 } |
| 744 | 746 |
| 747 int _getIndexedInt16(int index) { |
| 748 return _getInt16(index * Int16List.BYTES_PER_ELEMENT); |
| 749 } |
| 750 |
| 751 void _setIndexedInt16(int index, int value) { |
| 752 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value); |
| 753 } |
| 754 |
| 745 static _Int16Array _new(int length) native "TypedData_Int16Array_new"; | 755 static _Int16Array _new(int length) native "TypedData_Int16Array_new"; |
| 746 } | 756 } |
| 747 | 757 |
| 748 | 758 |
| 749 class _Uint16Array extends _TypedList implements Uint16List { | 759 class _Uint16Array extends _TypedList implements Uint16List { |
| 750 // Factory constructors. | 760 // Factory constructors. |
| 751 | 761 |
| 752 factory _Uint16Array(int length) { | 762 factory _Uint16Array(int length) { |
| 753 if (length < 0) { | 763 if (length < 0) { |
| 754 String message = "$length must be greater than 0"; | 764 String message = "$length must be greater than 0"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 767 } | 777 } |
| 768 | 778 |
| 769 | 779 |
| 770 // Method(s) implementing the List interface. | 780 // Method(s) implementing the List interface. |
| 771 | 781 |
| 772 int operator[](int index) { | 782 int operator[](int index) { |
| 773 if (index < 0 || index >= length) { | 783 if (index < 0 || index >= length) { |
| 774 String message = "$index must be in the range [0..$length)"; | 784 String message = "$index must be in the range [0..$length)"; |
| 775 throw new RangeError(message); | 785 throw new RangeError(message); |
| 776 } | 786 } |
| 777 return _getUint16(index); | 787 return _getIndexedUint16(index); |
| 778 } | 788 } |
| 779 | 789 |
| 780 void operator[]=(int index, int value) { | 790 void operator[]=(int index, int value) { |
| 781 if (index < 0 || index >= length) { | 791 if (index < 0 || index >= length) { |
| 782 String message = "$index must be in the range [0..$length)"; | 792 String message = "$index must be in the range [0..$length)"; |
| 783 throw new RangeError(message); | 793 throw new RangeError(message); |
| 784 } | 794 } |
| 785 _setUint16(index, _toUint16(value)); | 795 _setIndexedUint16(index, _toUint16(value)); |
| 786 } | 796 } |
| 787 | 797 |
| 788 Iterator<int> get iterator { | 798 Iterator<int> get iterator { |
| 789 return new _TypedListIterator<int>(this); | 799 return new _TypedListIterator<int>(this); |
| 790 } | 800 } |
| 791 | 801 |
| 792 | 802 |
| 793 // Method(s) implementing the TypedData interface. | 803 // Method(s) implementing the TypedData interface. |
| 794 | 804 |
| 795 int get elementSizeInBytes { | 805 int get elementSizeInBytes { |
| 796 return Uint16List.BYTES_PER_ELEMENT; | 806 return Uint16List.BYTES_PER_ELEMENT; |
| 797 } | 807 } |
| 798 | 808 |
| 799 | 809 |
| 800 // Internal utility methods. | 810 // Internal utility methods. |
| 801 | 811 |
| 802 _Uint16Array _createList(int length) { | 812 _Uint16Array _createList(int length) { |
| 803 return _new(length); | 813 return _new(length); |
| 804 } | 814 } |
| 805 | 815 |
| 816 int _getIndexedUint16(int index) { |
| 817 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT); |
| 818 } |
| 819 |
| 820 void _setIndexedUint16(int index, int value) { |
| 821 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); |
| 822 } |
| 823 |
| 806 static _Uint16Array _new(int length) native "TypedData_Uint16Array_new"; | 824 static _Uint16Array _new(int length) native "TypedData_Uint16Array_new"; |
| 807 } | 825 } |
| 808 | 826 |
| 809 | 827 |
| 810 class _Int32Array extends _TypedList implements Int32List { | 828 class _Int32Array extends _TypedList implements Int32List { |
| 811 // Factory constructors. | 829 // Factory constructors. |
| 812 | 830 |
| 813 factory _Int32Array(int length) { | 831 factory _Int32Array(int length) { |
| 814 if (length < 0) { | 832 if (length < 0) { |
| 815 String message = "$length must be greater than 0"; | 833 String message = "$length must be greater than 0"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 828 } | 846 } |
| 829 | 847 |
| 830 | 848 |
| 831 // Method(s) implementing the List interface. | 849 // Method(s) implementing the List interface. |
| 832 | 850 |
| 833 int operator[](int index) { | 851 int operator[](int index) { |
| 834 if (index < 0 || index >= length) { | 852 if (index < 0 || index >= length) { |
| 835 String message = "$index must be in the range [0..$length)"; | 853 String message = "$index must be in the range [0..$length)"; |
| 836 throw new RangeError(message); | 854 throw new RangeError(message); |
| 837 } | 855 } |
| 838 return _getInt32(index); | 856 return _getIndexedInt32(index); |
| 839 } | 857 } |
| 840 | 858 |
| 841 void operator[]=(int index, int value) { | 859 void operator[]=(int index, int value) { |
| 842 if (index < 0 || index >= length) { | 860 if (index < 0 || index >= length) { |
| 843 String message = "$index must be in the range [0..$length)"; | 861 String message = "$index must be in the range [0..$length)"; |
| 844 throw new RangeError(message); | 862 throw new RangeError(message); |
| 845 } | 863 } |
| 846 _setInt32(index, _toInt32(value)); | 864 _setIndexedInt32(index, _toInt32(value)); |
| 847 } | 865 } |
| 848 | 866 |
| 849 Iterator<int> get iterator { | 867 Iterator<int> get iterator { |
| 850 return new _TypedListIterator<int>(this); | 868 return new _TypedListIterator<int>(this); |
| 851 } | 869 } |
| 852 | 870 |
| 853 | 871 |
| 854 // Method(s) implementing TypedData interface. | 872 // Method(s) implementing TypedData interface. |
| 855 | 873 |
| 856 int get elementSizeInBytes { | 874 int get elementSizeInBytes { |
| 857 return Int32List.BYTES_PER_ELEMENT; | 875 return Int32List.BYTES_PER_ELEMENT; |
| 858 } | 876 } |
| 859 | 877 |
| 860 | 878 |
| 861 // Internal utility methods. | 879 // Internal utility methods. |
| 862 | 880 |
| 863 _Int32Array _createList(int length) { | 881 _Int32Array _createList(int length) { |
| 864 return _new(length); | 882 return _new(length); |
| 865 } | 883 } |
| 866 | 884 |
| 885 int _getIndexedInt32(int index) { |
| 886 return _getInt32(index * Int32List.BYTES_PER_ELEMENT); |
| 887 } |
| 888 |
| 889 void _setIndexedInt32(int index, int value) { |
| 890 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value); |
| 891 } |
| 892 |
| 867 static _Int32Array _new(int length) native "TypedData_Int32Array_new"; | 893 static _Int32Array _new(int length) native "TypedData_Int32Array_new"; |
| 868 } | 894 } |
| 869 | 895 |
| 870 | 896 |
| 871 class _Uint32Array extends _TypedList implements Uint32List { | 897 class _Uint32Array extends _TypedList implements Uint32List { |
| 872 // Factory constructors. | 898 // Factory constructors. |
| 873 | 899 |
| 874 factory _Uint32Array(int length) { | 900 factory _Uint32Array(int length) { |
| 875 if (length < 0) { | 901 if (length < 0) { |
| 876 String message = "$length must be greater than 0"; | 902 String message = "$length must be greater than 0"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 889 } | 915 } |
| 890 | 916 |
| 891 | 917 |
| 892 // Method(s) implementing the List interface. | 918 // Method(s) implementing the List interface. |
| 893 | 919 |
| 894 int operator[](int index) { | 920 int operator[](int index) { |
| 895 if (index < 0 || index >= length) { | 921 if (index < 0 || index >= length) { |
| 896 String message = "$index must be in the range [0..$length)"; | 922 String message = "$index must be in the range [0..$length)"; |
| 897 throw new RangeError(message); | 923 throw new RangeError(message); |
| 898 } | 924 } |
| 899 return _getUint32(index); | 925 return _getIndexedUint32(index); |
| 900 } | 926 } |
| 901 | 927 |
| 902 void operator[]=(int index, int value) { | 928 void operator[]=(int index, int value) { |
| 903 if (index < 0 || index >= length) { | 929 if (index < 0 || index >= length) { |
| 904 String message = "$index must be in the range [0..$length)"; | 930 String message = "$index must be in the range [0..$length)"; |
| 905 throw new RangeError(message); | 931 throw new RangeError(message); |
| 906 } | 932 } |
| 907 _setUint32(index, _toUint32(value)); | 933 _setIndexedUint32(index, _toUint32(value)); |
| 908 } | 934 } |
| 909 | 935 |
| 910 Iterator<int> get iterator { | 936 Iterator<int> get iterator { |
| 911 return new _TypedListIterator<int>(this); | 937 return new _TypedListIterator<int>(this); |
| 912 } | 938 } |
| 913 | 939 |
| 914 | 940 |
| 915 // Method(s) implementing the TypedData interface. | 941 // Method(s) implementing the TypedData interface. |
| 916 | 942 |
| 917 int get elementSizeInBytes { | 943 int get elementSizeInBytes { |
| 918 return Uint32List.BYTES_PER_ELEMENT; | 944 return Uint32List.BYTES_PER_ELEMENT; |
| 919 } | 945 } |
| 920 | 946 |
| 921 | 947 |
| 922 // Internal utility methods. | 948 // Internal utility methods. |
| 923 | 949 |
| 924 _Uint32Array _createList(int length) { | 950 _Uint32Array _createList(int length) { |
| 925 return _new(length); | 951 return _new(length); |
| 926 } | 952 } |
| 927 | 953 |
| 954 int _getIndexedUint32(int index) { |
| 955 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT); |
| 956 } |
| 957 |
| 958 void _setIndexedUint32(int index, int value) { |
| 959 _setInt32(index * Uint32List.BYTES_PER_ELEMENT, value); |
| 960 } |
| 961 |
| 928 static _Uint32Array _new(int length) native "TypedData_Uint32Array_new"; | 962 static _Uint32Array _new(int length) native "TypedData_Uint32Array_new"; |
| 929 } | 963 } |
| 930 | 964 |
| 931 | 965 |
| 932 class _Int64Array extends _TypedList implements Int64List { | 966 class _Int64Array extends _TypedList implements Int64List { |
| 933 // Factory constructors. | 967 // Factory constructors. |
| 934 | 968 |
| 935 factory _Int64Array(int length) { | 969 factory _Int64Array(int length) { |
| 936 if (length < 0) { | 970 if (length < 0) { |
| 937 String message = "$length must be greater than 0"; | 971 String message = "$length must be greater than 0"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 950 } | 984 } |
| 951 | 985 |
| 952 | 986 |
| 953 // Method(s) implementing the List interface. | 987 // Method(s) implementing the List interface. |
| 954 | 988 |
| 955 int operator[](int index) { | 989 int operator[](int index) { |
| 956 if (index < 0 || index >= length) { | 990 if (index < 0 || index >= length) { |
| 957 String message = "$index must be in the range [0..$length)"; | 991 String message = "$index must be in the range [0..$length)"; |
| 958 throw new RangeError(message); | 992 throw new RangeError(message); |
| 959 } | 993 } |
| 960 return _getInt64(index); | 994 return _getIndexedInt64(index); |
| 961 } | 995 } |
| 962 | 996 |
| 963 void operator[]=(int index, int value) { | 997 void operator[]=(int index, int value) { |
| 964 if (index < 0 || index >= length) { | 998 if (index < 0 || index >= length) { |
| 965 String message = "$index must be in the range [0..$length)"; | 999 String message = "$index must be in the range [0..$length)"; |
| 966 throw new RangeError(message); | 1000 throw new RangeError(message); |
| 967 } | 1001 } |
| 968 _setInt64(index, _toInt64(value)); | 1002 _setIndexedInt64(index, _toInt64(value)); |
| 969 } | 1003 } |
| 970 | 1004 |
| 971 Iterator<int> get iterator { | 1005 Iterator<int> get iterator { |
| 972 return new _TypedListIterator<int>(this); | 1006 return new _TypedListIterator<int>(this); |
| 973 } | 1007 } |
| 974 | 1008 |
| 975 | 1009 |
| 976 // Method(s) implementing the TypedData interface. | 1010 // Method(s) implementing the TypedData interface. |
| 977 | 1011 |
| 978 int get elementSizeInBytes { | 1012 int get elementSizeInBytes { |
| 979 return Int64List.BYTES_PER_ELEMENT; | 1013 return Int64List.BYTES_PER_ELEMENT; |
| 980 } | 1014 } |
| 981 | 1015 |
| 982 | 1016 |
| 983 // Internal utility methods. | 1017 // Internal utility methods. |
| 984 | 1018 |
| 985 _Int64Array _createList(int length) { | 1019 _Int64Array _createList(int length) { |
| 986 return _new(length); | 1020 return _new(length); |
| 987 } | 1021 } |
| 988 | 1022 |
| 1023 int _getIndexedInt64(int index) { |
| 1024 return _getInt64(index * Int64List.BYTES_PER_ELEMENT); |
| 1025 } |
| 1026 |
| 1027 void _setIndexedInt64(int index, int value) { |
| 1028 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value); |
| 1029 } |
| 1030 |
| 989 static _Int64Array _new(int length) native "TypedData_Int64Array_new"; | 1031 static _Int64Array _new(int length) native "TypedData_Int64Array_new"; |
| 990 } | 1032 } |
| 991 | 1033 |
| 992 | 1034 |
| 993 class _Uint64Array extends _TypedList implements Uint64List { | 1035 class _Uint64Array extends _TypedList implements Uint64List { |
| 994 // Factory constructors. | 1036 // Factory constructors. |
| 995 | 1037 |
| 996 factory _Uint64Array(int length) { | 1038 factory _Uint64Array(int length) { |
| 997 if (length < 0) { | 1039 if (length < 0) { |
| 998 String message = "$length must be greater than 0"; | 1040 String message = "$length must be greater than 0"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1011 } | 1053 } |
| 1012 | 1054 |
| 1013 | 1055 |
| 1014 // Method(s) implementing the List interface. | 1056 // Method(s) implementing the List interface. |
| 1015 | 1057 |
| 1016 int operator[](int index) { | 1058 int operator[](int index) { |
| 1017 if (index < 0 || index >= length) { | 1059 if (index < 0 || index >= length) { |
| 1018 String message = "$index must be in the range [0..$length)"; | 1060 String message = "$index must be in the range [0..$length)"; |
| 1019 throw new RangeError(message); | 1061 throw new RangeError(message); |
| 1020 } | 1062 } |
| 1021 return _getUint64(index); | 1063 return _getIndexedUint64(index); |
| 1022 } | 1064 } |
| 1023 | 1065 |
| 1024 void operator[]=(int index, int value) { | 1066 void operator[]=(int index, int value) { |
| 1025 if (index < 0 || index >= length) { | 1067 if (index < 0 || index >= length) { |
| 1026 String message = "$index must be in the range [0..$length)"; | 1068 String message = "$index must be in the range [0..$length)"; |
| 1027 throw new RangeError(message); | 1069 throw new RangeError(message); |
| 1028 } | 1070 } |
| 1029 _setUint64(index, _toUint64(value)); | 1071 _setIndexedUint64(index, _toUint64(value)); |
| 1030 } | 1072 } |
| 1031 | 1073 |
| 1032 Iterator<int> get iterator { | 1074 Iterator<int> get iterator { |
| 1033 return new _TypedListIterator<int>(this); | 1075 return new _TypedListIterator<int>(this); |
| 1034 } | 1076 } |
| 1035 | 1077 |
| 1036 | 1078 |
| 1037 // Method(s) implementing the TypedData interface. | 1079 // Method(s) implementing the TypedData interface. |
| 1038 | 1080 |
| 1039 int get elementSizeInBytes { | 1081 int get elementSizeInBytes { |
| 1040 return Uint64List.BYTES_PER_ELEMENT; | 1082 return Uint64List.BYTES_PER_ELEMENT; |
| 1041 } | 1083 } |
| 1042 | 1084 |
| 1043 | 1085 |
| 1044 // Internal utility methods. | 1086 // Internal utility methods. |
| 1045 | 1087 |
| 1046 _Uint64Array _createList(int length) { | 1088 _Uint64Array _createList(int length) { |
| 1047 return _new(length); | 1089 return _new(length); |
| 1048 } | 1090 } |
| 1049 | 1091 |
| 1092 int _getIndexedUint64(int index) { |
| 1093 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT); |
| 1094 } |
| 1095 |
| 1096 void _setIndexedUint64(int index, int value) { |
| 1097 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value); |
| 1098 } |
| 1099 |
| 1050 static _Uint64Array _new(int length) native "TypedData_Uint64Array_new"; | 1100 static _Uint64Array _new(int length) native "TypedData_Uint64Array_new"; |
| 1051 } | 1101 } |
| 1052 | 1102 |
| 1053 | 1103 |
| 1054 class _Float32Array extends _TypedList implements Float32List { | 1104 class _Float32Array extends _TypedList implements Float32List { |
| 1055 // Factory constructors. | 1105 // Factory constructors. |
| 1056 | 1106 |
| 1057 factory _Float32Array(int length) { | 1107 factory _Float32Array(int length) { |
| 1058 if (length < 0) { | 1108 if (length < 0) { |
| 1059 String message = "$length must be greater than 0"; | 1109 String message = "$length must be greater than 0"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1072 } | 1122 } |
| 1073 | 1123 |
| 1074 | 1124 |
| 1075 // Method(s) implementing the List interface. | 1125 // Method(s) implementing the List interface. |
| 1076 | 1126 |
| 1077 double operator[](int index) { | 1127 double operator[](int index) { |
| 1078 if (index < 0 || index >= length) { | 1128 if (index < 0 || index >= length) { |
| 1079 String message = "$index must be in the range [0..$length)"; | 1129 String message = "$index must be in the range [0..$length)"; |
| 1080 throw new RangeError(message); | 1130 throw new RangeError(message); |
| 1081 } | 1131 } |
| 1082 return _getFloat32(index); | 1132 return _getIndexedFloat32(index); |
| 1083 } | 1133 } |
| 1084 | 1134 |
| 1085 void operator[]=(int index, double value) { | 1135 void operator[]=(int index, double value) { |
| 1086 if (index < 0 || index >= length) { | 1136 if (index < 0 || index >= length) { |
| 1087 String message = "$index must be in the range [0..$length)"; | 1137 String message = "$index must be in the range [0..$length)"; |
| 1088 throw new RangeError(message); | 1138 throw new RangeError(message); |
| 1089 } | 1139 } |
| 1090 _setFloat32(index, value); | 1140 _setIndexedFloat32(index, value); |
| 1091 } | 1141 } |
| 1092 | 1142 |
| 1093 Iterator<double> get iterator { | 1143 Iterator<double> get iterator { |
| 1094 return new _TypedListIterator<double>(this); | 1144 return new _TypedListIterator<double>(this); |
| 1095 } | 1145 } |
| 1096 | 1146 |
| 1097 | 1147 |
| 1098 // Method(s) implementing the TypedData interface. | 1148 // Method(s) implementing the TypedData interface. |
| 1099 | 1149 |
| 1100 int get elementSizeInBytes { | 1150 int get elementSizeInBytes { |
| 1101 return Float32List.BYTES_PER_ELEMENT; | 1151 return Float32List.BYTES_PER_ELEMENT; |
| 1102 } | 1152 } |
| 1103 | 1153 |
| 1104 | 1154 |
| 1105 // Internal utility methods. | 1155 // Internal utility methods. |
| 1106 | 1156 |
| 1107 _Float32Array _createList(int length) { | 1157 _Float32Array _createList(int length) { |
| 1108 return _new(length); | 1158 return _new(length); |
| 1109 } | 1159 } |
| 1110 | 1160 |
| 1161 double _getIndexedFloat32(int index) { |
| 1162 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT); |
| 1163 } |
| 1164 |
| 1165 void _setIndexedFloat32(int index, double value) { |
| 1166 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value); |
| 1167 } |
| 1168 |
| 1111 static _Float32Array _new(int length) native "TypedData_Float32Array_new"; | 1169 static _Float32Array _new(int length) native "TypedData_Float32Array_new"; |
| 1112 } | 1170 } |
| 1113 | 1171 |
| 1114 | 1172 |
| 1115 class _Float64Array extends _TypedList implements Float64List { | 1173 class _Float64Array extends _TypedList implements Float64List { |
| 1116 // Factory constructors. | 1174 // Factory constructors. |
| 1117 | 1175 |
| 1118 factory _Float64Array(int length) { | 1176 factory _Float64Array(int length) { |
| 1119 if (length < 0) { | 1177 if (length < 0) { |
| 1120 String message = "$length must be greater than 0"; | 1178 String message = "$length must be greater than 0"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1133 } | 1191 } |
| 1134 | 1192 |
| 1135 | 1193 |
| 1136 // Method(s) implementing the List interface. | 1194 // Method(s) implementing the List interface. |
| 1137 | 1195 |
| 1138 double operator[](int index) { | 1196 double operator[](int index) { |
| 1139 if (index < 0 || index >= length) { | 1197 if (index < 0 || index >= length) { |
| 1140 String message = "$index must be in the range [0..$length)"; | 1198 String message = "$index must be in the range [0..$length)"; |
| 1141 throw new RangeError(message); | 1199 throw new RangeError(message); |
| 1142 } | 1200 } |
| 1143 return _getFloat64(index); | 1201 return _getIndexedFloat64(index); |
| 1144 } | 1202 } |
| 1145 | 1203 |
| 1146 void operator[]=(int index, double value) { | 1204 void operator[]=(int index, double value) { |
| 1147 if (index < 0 || index >= length) { | 1205 if (index < 0 || index >= length) { |
| 1148 String message = "$index must be in the range [0..$length)"; | 1206 String message = "$index must be in the range [0..$length)"; |
| 1149 throw new RangeError(message); | 1207 throw new RangeError(message); |
| 1150 } | 1208 } |
| 1151 _setFloat64(index, value); | 1209 _setIndexedFloat64(index, value); |
| 1152 } | 1210 } |
| 1153 | 1211 |
| 1154 Iterator<double> get iterator { | 1212 Iterator<double> get iterator { |
| 1155 return new _TypedListIterator<double>(this); | 1213 return new _TypedListIterator<double>(this); |
| 1156 } | 1214 } |
| 1157 | 1215 |
| 1158 | 1216 |
| 1159 // Method(s) implementing the TypedData interface. | 1217 // Method(s) implementing the TypedData interface. |
| 1160 | 1218 |
| 1161 int get elementSizeInBytes { | 1219 int get elementSizeInBytes { |
| 1162 return Float64List.BYTES_PER_ELEMENT; | 1220 return Float64List.BYTES_PER_ELEMENT; |
| 1163 } | 1221 } |
| 1164 | 1222 |
| 1165 | 1223 |
| 1166 // Internal utility methods. | 1224 // Internal utility methods. |
| 1167 | 1225 |
| 1168 _Float64Array _createList(int length) { | 1226 _Float64Array _createList(int length) { |
| 1169 return _new(length); | 1227 return _new(length); |
| 1170 } | 1228 } |
| 1171 | 1229 |
| 1230 double _getIndexedFloat64(int index) { |
| 1231 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); |
| 1232 } |
| 1233 |
| 1234 void _setIndexedFloat64(int index, double value) { |
| 1235 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); |
| 1236 } |
| 1237 |
| 1172 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; | 1238 static _Float64Array _new(int length) native "TypedData_Float64Array_new"; |
| 1173 } | 1239 } |
| 1174 | 1240 |
| 1175 | 1241 |
| 1176 class _ExternalInt8Array extends _TypedList implements Int8List { | 1242 class _ExternalInt8Array extends _TypedList implements Int8List { |
| 1177 // Factory constructors. | 1243 // Factory constructors. |
| 1178 | 1244 |
| 1179 factory _ExternalInt8Array(int length) { | 1245 factory _ExternalInt8Array(int length) { |
| 1180 if (length < 0) { | 1246 if (length < 0) { |
| 1181 String message = "$length must be greater than 0"; | 1247 String message = "$length must be greater than 0"; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 } | 1409 } |
| 1344 | 1410 |
| 1345 | 1411 |
| 1346 // Method(s) implementing the List interface. | 1412 // Method(s) implementing the List interface. |
| 1347 | 1413 |
| 1348 int operator[](int index) { | 1414 int operator[](int index) { |
| 1349 if (index < 0 || index >= length) { | 1415 if (index < 0 || index >= length) { |
| 1350 String message = "$index must be in the range [0..$length)"; | 1416 String message = "$index must be in the range [0..$length)"; |
| 1351 throw new RangeError(message); | 1417 throw new RangeError(message); |
| 1352 } | 1418 } |
| 1353 return _getInt16(index); | 1419 return _getIndexedInt16(index); |
| 1354 } | 1420 } |
| 1355 | 1421 |
| 1356 void operator[]=(int index, int value) { | 1422 void operator[]=(int index, int value) { |
| 1357 if (index < 0 || index >= length) { | 1423 if (index < 0 || index >= length) { |
| 1358 String message = "$index must be in the range [0..$length)"; | 1424 String message = "$index must be in the range [0..$length)"; |
| 1359 throw new RangeError(message); | 1425 throw new RangeError(message); |
| 1360 } | 1426 } |
| 1361 _setInt16(index, _toInt16(value)); | 1427 _setIndexedInt16(index, _toInt16(value)); |
| 1362 } | 1428 } |
| 1363 | 1429 |
| 1364 Iterator<int> get iterator { | 1430 Iterator<int> get iterator { |
| 1365 return new _TypedListIterator<int>(this); | 1431 return new _TypedListIterator<int>(this); |
| 1366 } | 1432 } |
| 1367 | 1433 |
| 1368 | 1434 |
| 1369 // Method(s) implementing the TypedData interface. | 1435 // Method(s) implementing the TypedData interface. |
| 1370 | 1436 |
| 1371 int get elementSizeInBytes { | 1437 int get elementSizeInBytes { |
| 1372 return Int16List.BYTES_PER_ELEMENT; | 1438 return Int16List.BYTES_PER_ELEMENT; |
| 1373 } | 1439 } |
| 1374 | 1440 |
| 1375 | 1441 |
| 1376 // Internal utility methods. | 1442 // Internal utility methods. |
| 1377 | 1443 |
| 1378 Int16List _createList(int length) { | 1444 Int16List _createList(int length) { |
| 1379 return new Int16List(length); | 1445 return new Int16List(length); |
| 1380 } | 1446 } |
| 1381 | 1447 |
| 1448 int _getIndexedInt16(int index) { |
| 1449 return _getInt16(index * Int16List.BYTES_PER_ELEMENT); |
| 1450 } |
| 1451 |
| 1452 void _setIndexedInt16(int index, int value) { |
| 1453 _setInt16(index * Int16List.BYTES_PER_ELEMENT, value); |
| 1454 } |
| 1455 |
| 1382 static _ExternalInt16Array _new(int length) native | 1456 static _ExternalInt16Array _new(int length) native |
| 1383 "ExternalTypedData_Int16Array_new"; | 1457 "ExternalTypedData_Int16Array_new"; |
| 1384 } | 1458 } |
| 1385 | 1459 |
| 1386 | 1460 |
| 1387 class _ExternalUint16Array extends _TypedList implements Uint16List { | 1461 class _ExternalUint16Array extends _TypedList implements Uint16List { |
| 1388 // Factory constructors. | 1462 // Factory constructors. |
| 1389 | 1463 |
| 1390 factory _ExternalUint16Array(int length) { | 1464 factory _ExternalUint16Array(int length) { |
| 1391 if (length < 0) { | 1465 if (length < 0) { |
| 1392 String message = "$length must be greater than 0"; | 1466 String message = "$length must be greater than 0"; |
| 1393 throw new ArgumentError(message); | 1467 throw new ArgumentError(message); |
| 1394 } | 1468 } |
| 1395 return _new(length); | 1469 return _new(length); |
| 1396 } | 1470 } |
| 1397 | 1471 |
| 1398 | 1472 |
| 1399 // Method(s) implementing the List interface. | 1473 // Method(s) implementing the List interface. |
| 1400 | 1474 |
| 1401 int operator[](int index) { | 1475 int operator[](int index) { |
| 1402 if (index < 0 || index >= length) { | 1476 if (index < 0 || index >= length) { |
| 1403 String message = "$index must be in the range [0..$length)"; | 1477 String message = "$index must be in the range [0..$length)"; |
| 1404 throw new RangeError(message); | 1478 throw new RangeError(message); |
| 1405 } | 1479 } |
| 1406 return _getUint16(index); | 1480 return _getIndexedUint16(index); |
| 1407 } | 1481 } |
| 1408 | 1482 |
| 1409 void operator[]=(int index, int value) { | 1483 void operator[]=(int index, int value) { |
| 1410 if (index < 0 || index >= length) { | 1484 if (index < 0 || index >= length) { |
| 1411 String message = "$index must be in the range [0..$length)"; | 1485 String message = "$index must be in the range [0..$length)"; |
| 1412 throw new RangeError(message); | 1486 throw new RangeError(message); |
| 1413 } | 1487 } |
| 1414 _setUint16(index, _toUint16(value)); | 1488 _setIndexedUint16(index, _toUint16(value)); |
| 1415 } | 1489 } |
| 1416 | 1490 |
| 1417 Iterator<int> get iterator { | 1491 Iterator<int> get iterator { |
| 1418 return new _TypedListIterator<int>(this); | 1492 return new _TypedListIterator<int>(this); |
| 1419 } | 1493 } |
| 1420 | 1494 |
| 1421 | 1495 |
| 1422 // Method(s) implementing the TypedData interface. | 1496 // Method(s) implementing the TypedData interface. |
| 1423 | 1497 |
| 1424 int get elementSizeInBytes { | 1498 int get elementSizeInBytes { |
| 1425 return Uint16List.BYTES_PER_ELEMENT; | 1499 return Uint16List.BYTES_PER_ELEMENT; |
| 1426 } | 1500 } |
| 1427 | 1501 |
| 1428 | 1502 |
| 1429 // Internal utility methods. | 1503 // Internal utility methods. |
| 1430 | 1504 |
| 1431 Uint16List _createList(int length) { | 1505 Uint16List _createList(int length) { |
| 1432 return new Uint16List(length); | 1506 return new Uint16List(length); |
| 1433 } | 1507 } |
| 1434 | 1508 |
| 1509 int _getIndexedUint16(int index) { |
| 1510 return _getUint16(index * Uint16List.BYTES_PER_ELEMENT); |
| 1511 } |
| 1512 |
| 1513 void _setIndexedUint16(int index, int value) { |
| 1514 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); |
| 1515 } |
| 1516 |
| 1435 static _ExternalUint16Array _new(int length) native | 1517 static _ExternalUint16Array _new(int length) native |
| 1436 "ExternalTypedData_Uint16Array_new"; | 1518 "ExternalTypedData_Uint16Array_new"; |
| 1437 } | 1519 } |
| 1438 | 1520 |
| 1439 | 1521 |
| 1440 class _ExternalInt32Array extends _TypedList implements Int32List { | 1522 class _ExternalInt32Array extends _TypedList implements Int32List { |
| 1441 // Factory constructors. | 1523 // Factory constructors. |
| 1442 | 1524 |
| 1443 factory _ExternalInt32Array(int length) { | 1525 factory _ExternalInt32Array(int length) { |
| 1444 if (length < 0) { | 1526 if (length < 0) { |
| 1445 String message = "$length must be greater than 0"; | 1527 String message = "$length must be greater than 0"; |
| 1446 throw new ArgumentError(message); | 1528 throw new ArgumentError(message); |
| 1447 } | 1529 } |
| 1448 return _new(length); | 1530 return _new(length); |
| 1449 } | 1531 } |
| 1450 | 1532 |
| 1451 | 1533 |
| 1452 // Method(s) implementing the List interface. | 1534 // Method(s) implementing the List interface. |
| 1453 | 1535 |
| 1454 int operator[](int index) { | 1536 int operator[](int index) { |
| 1455 if (index < 0 || index >= length) { | 1537 if (index < 0 || index >= length) { |
| 1456 String message = "$index must be in the range [0..$length)"; | 1538 String message = "$index must be in the range [0..$length)"; |
| 1457 throw new RangeError(message); | 1539 throw new RangeError(message); |
| 1458 } | 1540 } |
| 1459 return _getInt32(index); | 1541 return _getIndexedInt32(index); |
| 1460 } | 1542 } |
| 1461 | 1543 |
| 1462 void operator[]=(int index, int value) { | 1544 void operator[]=(int index, int value) { |
| 1463 if (index < 0 || index >= length) { | 1545 if (index < 0 || index >= length) { |
| 1464 String message = "$index must be in the range [0..$length)"; | 1546 String message = "$index must be in the range [0..$length)"; |
| 1465 throw new RangeError(message); | 1547 throw new RangeError(message); |
| 1466 } | 1548 } |
| 1467 _setInt32(index, _toInt32(value)); | 1549 _setIndexedInt32(index, _toInt32(value)); |
| 1468 } | 1550 } |
| 1469 | 1551 |
| 1470 Iterator<int> get iterator { | 1552 Iterator<int> get iterator { |
| 1471 return new _TypedListIterator<int>(this); | 1553 return new _TypedListIterator<int>(this); |
| 1472 } | 1554 } |
| 1473 | 1555 |
| 1474 | 1556 |
| 1475 // Method(s) implementing the TypedData interface. | 1557 // Method(s) implementing the TypedData interface. |
| 1476 | 1558 |
| 1477 int get elementSizeInBytes { | 1559 int get elementSizeInBytes { |
| 1478 return Int32List.BYTES_PER_ELEMENT; | 1560 return Int32List.BYTES_PER_ELEMENT; |
| 1479 } | 1561 } |
| 1480 | 1562 |
| 1481 | 1563 |
| 1482 // Internal utility methods. | 1564 // Internal utility methods. |
| 1483 | 1565 |
| 1484 Int32List _createList(int length) { | 1566 Int32List _createList(int length) { |
| 1485 return new Int32List(length); | 1567 return new Int32List(length); |
| 1486 } | 1568 } |
| 1487 | 1569 |
| 1570 int _getIndexedInt32(int index) { |
| 1571 return _getInt32(index * Int32List.BYTES_PER_ELEMENT); |
| 1572 } |
| 1573 |
| 1574 void _setIndexedInt32(int index, int value) { |
| 1575 _setInt32(index * Int32List.BYTES_PER_ELEMENT, value); |
| 1576 } |
| 1577 |
| 1488 static _ExternalInt32Array _new(int length) native | 1578 static _ExternalInt32Array _new(int length) native |
| 1489 "ExternalTypedData_Int32Array_new"; | 1579 "ExternalTypedData_Int32Array_new"; |
| 1490 } | 1580 } |
| 1491 | 1581 |
| 1492 | 1582 |
| 1493 class _ExternalUint32Array extends _TypedList implements Uint32List { | 1583 class _ExternalUint32Array extends _TypedList implements Uint32List { |
| 1494 // Factory constructors. | 1584 // Factory constructors. |
| 1495 | 1585 |
| 1496 factory _ExternalUint32Array(int length) { | 1586 factory _ExternalUint32Array(int length) { |
| 1497 if (length < 0) { | 1587 if (length < 0) { |
| 1498 String message = "$length must be greater than 0"; | 1588 String message = "$length must be greater than 0"; |
| 1499 throw new ArgumentError(message); | 1589 throw new ArgumentError(message); |
| 1500 } | 1590 } |
| 1501 return _new(length); | 1591 return _new(length); |
| 1502 } | 1592 } |
| 1503 | 1593 |
| 1504 | 1594 |
| 1505 // Method(s) implementing the List interface. | 1595 // Method(s) implementing the List interface. |
| 1506 | 1596 |
| 1507 int operator[](int index) { | 1597 int operator[](int index) { |
| 1508 if (index < 0 || index >= length) { | 1598 if (index < 0 || index >= length) { |
| 1509 String message = "$index must be in the range [0..$length)"; | 1599 String message = "$index must be in the range [0..$length)"; |
| 1510 throw new RangeError(message); | 1600 throw new RangeError(message); |
| 1511 } | 1601 } |
| 1512 return _getUint32(index); | 1602 return _getIndexedUint32(index); |
| 1513 } | 1603 } |
| 1514 | 1604 |
| 1515 void operator[]=(int index, int value) { | 1605 void operator[]=(int index, int value) { |
| 1516 if (index < 0 || index >= length) { | 1606 if (index < 0 || index >= length) { |
| 1517 String message = "$index must be in the range [0..$length)"; | 1607 String message = "$index must be in the range [0..$length)"; |
| 1518 throw new RangeError(message); | 1608 throw new RangeError(message); |
| 1519 } | 1609 } |
| 1520 _setUint32(index, _toUint32(value)); | 1610 _setIndexedUint32(index, _toUint32(value)); |
| 1521 } | 1611 } |
| 1522 | 1612 |
| 1523 Iterator<int> get iterator { | 1613 Iterator<int> get iterator { |
| 1524 return new _TypedListIterator<int>(this); | 1614 return new _TypedListIterator<int>(this); |
| 1525 } | 1615 } |
| 1526 | 1616 |
| 1527 | 1617 |
| 1528 // Method(s) implementing the TypedData interface. | 1618 // Method(s) implementing the TypedData interface. |
| 1529 | 1619 |
| 1530 int get elementSizeInBytes { | 1620 int get elementSizeInBytes { |
| 1531 return Uint32List.BYTES_PER_ELEMENT; | 1621 return Uint32List.BYTES_PER_ELEMENT; |
| 1532 } | 1622 } |
| 1533 | 1623 |
| 1534 | 1624 |
| 1535 // Internal utility methods. | 1625 // Internal utility methods. |
| 1536 | 1626 |
| 1537 Uint32List _createList(int length) { | 1627 Uint32List _createList(int length) { |
| 1538 return new Uint32List(length); | 1628 return new Uint32List(length); |
| 1539 } | 1629 } |
| 1540 | 1630 |
| 1631 int _getIndexedUint32(int index) { |
| 1632 return _getUint32(index * Uint32List.BYTES_PER_ELEMENT); |
| 1633 } |
| 1634 |
| 1635 void _setIndexedUint32(int index, int value) { |
| 1636 _setInt32(index * Uint32List.BYTES_PER_ELEMENT, value); |
| 1637 } |
| 1638 |
| 1541 static _ExternalUint32Array _new(int length) native | 1639 static _ExternalUint32Array _new(int length) native |
| 1542 "ExternalTypedData_Uint32Array_new"; | 1640 "ExternalTypedData_Uint32Array_new"; |
| 1543 } | 1641 } |
| 1544 | 1642 |
| 1545 | 1643 |
| 1546 class _ExternalInt64Array extends _TypedList implements Int64List { | 1644 class _ExternalInt64Array extends _TypedList implements Int64List { |
| 1547 // Factory constructors. | 1645 // Factory constructors. |
| 1548 | 1646 |
| 1549 factory _ExternalInt64Array(int length) { | 1647 factory _ExternalInt64Array(int length) { |
| 1550 if (length < 0) { | 1648 if (length < 0) { |
| 1551 String message = "$length must be greater than 0"; | 1649 String message = "$length must be greater than 0"; |
| 1552 throw new ArgumentError(message); | 1650 throw new ArgumentError(message); |
| 1553 } | 1651 } |
| 1554 return _new(length); | 1652 return _new(length); |
| 1555 } | 1653 } |
| 1556 | 1654 |
| 1557 | 1655 |
| 1558 // Method(s) implementing the List interface. | 1656 // Method(s) implementing the List interface. |
| 1559 | 1657 |
| 1560 int operator[](int index) { | 1658 int operator[](int index) { |
| 1561 if (index < 0 || index >= length) { | 1659 if (index < 0 || index >= length) { |
| 1562 String message = "$index must be in the range [0..$length)"; | 1660 String message = "$index must be in the range [0..$length)"; |
| 1563 throw new RangeError(message); | 1661 throw new RangeError(message); |
| 1564 } | 1662 } |
| 1565 return _getInt64(index); | 1663 return _getIndexedInt64(index); |
| 1566 } | 1664 } |
| 1567 | 1665 |
| 1568 void operator[]=(int index, int value) { | 1666 void operator[]=(int index, int value) { |
| 1569 if (index < 0 || index >= length) { | 1667 if (index < 0 || index >= length) { |
| 1570 String message = "$index must be in the range [0..$length)"; | 1668 String message = "$index must be in the range [0..$length)"; |
| 1571 throw new RangeError(message); | 1669 throw new RangeError(message); |
| 1572 } | 1670 } |
| 1573 _setInt64(index, _toInt64(value)); | 1671 _setIndexedInt64(index, _toInt64(value)); |
| 1574 } | 1672 } |
| 1575 | 1673 |
| 1576 Iterator<int> get iterator { | 1674 Iterator<int> get iterator { |
| 1577 return new _TypedListIterator<int>(this); | 1675 return new _TypedListIterator<int>(this); |
| 1578 } | 1676 } |
| 1579 | 1677 |
| 1580 | 1678 |
| 1581 // Method(s) implementing the TypedData interface. | 1679 // Method(s) implementing the TypedData interface. |
| 1582 | 1680 |
| 1583 int get elementSizeInBytes { | 1681 int get elementSizeInBytes { |
| 1584 return Int64List.BYTES_PER_ELEMENT; | 1682 return Int64List.BYTES_PER_ELEMENT; |
| 1585 } | 1683 } |
| 1586 | 1684 |
| 1587 | 1685 |
| 1588 // Internal utility methods. | 1686 // Internal utility methods. |
| 1589 | 1687 |
| 1590 Int64List _createList(int length) { | 1688 Int64List _createList(int length) { |
| 1591 return new Int64List(length); | 1689 return new Int64List(length); |
| 1592 } | 1690 } |
| 1593 | 1691 |
| 1692 int _getIndexedInt64(int index) { |
| 1693 return _getInt64(index * Int64List.BYTES_PER_ELEMENT); |
| 1694 } |
| 1695 |
| 1696 void _setIndexedInt64(int index, int value) { |
| 1697 _setInt64(index * Int64List.BYTES_PER_ELEMENT, value); |
| 1698 } |
| 1699 |
| 1594 static _ExternalInt64Array _new(int length) native | 1700 static _ExternalInt64Array _new(int length) native |
| 1595 "ExternalTypedData_Int64Array_new"; | 1701 "ExternalTypedData_Int64Array_new"; |
| 1596 } | 1702 } |
| 1597 | 1703 |
| 1598 | 1704 |
| 1599 class _ExternalUint64Array extends _TypedList implements Uint64List { | 1705 class _ExternalUint64Array extends _TypedList implements Uint64List { |
| 1600 // Factory constructors. | 1706 // Factory constructors. |
| 1601 | 1707 |
| 1602 factory _ExternalUint64Array(int length) { | 1708 factory _ExternalUint64Array(int length) { |
| 1603 if (length < 0) { | 1709 if (length < 0) { |
| 1604 String message = "$length must be greater than 0"; | 1710 String message = "$length must be greater than 0"; |
| 1605 throw new ArgumentError(message); | 1711 throw new ArgumentError(message); |
| 1606 } | 1712 } |
| 1607 return _new(length); | 1713 return _new(length); |
| 1608 } | 1714 } |
| 1609 | 1715 |
| 1610 | 1716 |
| 1611 // Method(s) implementing the List interface. | 1717 // Method(s) implementing the List interface. |
| 1612 | 1718 |
| 1613 int operator[](int index) { | 1719 int operator[](int index) { |
| 1614 if (index < 0 || index >= length) { | 1720 if (index < 0 || index >= length) { |
| 1615 String message = "$index must be in the range [0..$length)"; | 1721 String message = "$index must be in the range [0..$length)"; |
| 1616 throw new RangeError(message); | 1722 throw new RangeError(message); |
| 1617 } | 1723 } |
| 1618 return _getUint64(index); | 1724 return _getIndexedUint64(index); |
| 1619 } | 1725 } |
| 1620 | 1726 |
| 1621 void operator[]=(int index, int value) { | 1727 void operator[]=(int index, int value) { |
| 1622 if (index < 0 || index >= length) { | 1728 if (index < 0 || index >= length) { |
| 1623 String message = "$index must be in the range [0..$length)"; | 1729 String message = "$index must be in the range [0..$length)"; |
| 1624 throw new RangeError(message); | 1730 throw new RangeError(message); |
| 1625 } | 1731 } |
| 1626 _setUint64(index, _toUint64(value)); | 1732 _setIndexedUint64(index, _toUint64(value)); |
| 1627 } | 1733 } |
| 1628 | 1734 |
| 1629 Iterator<int> get iterator { | 1735 Iterator<int> get iterator { |
| 1630 return new _TypedListIterator<int>(this); | 1736 return new _TypedListIterator<int>(this); |
| 1631 } | 1737 } |
| 1632 | 1738 |
| 1633 | 1739 |
| 1634 // Method(s) implementing the TypedData interface. | 1740 // Method(s) implementing the TypedData interface. |
| 1635 | 1741 |
| 1636 Uint64List _createList(int length) { | |
| 1637 return new Uint64List(length); | |
| 1638 } | |
| 1639 | |
| 1640 int get elementSizeInBytes { | 1742 int get elementSizeInBytes { |
| 1641 return Uint64List.BYTES_PER_ELEMENT; | 1743 return Uint64List.BYTES_PER_ELEMENT; |
| 1642 } | 1744 } |
| 1643 | 1745 |
| 1644 | 1746 |
| 1645 // Internal utility methods. | 1747 // Internal utility methods. |
| 1646 | 1748 |
| 1749 Uint64List _createList(int length) { |
| 1750 return new Uint64List(length); |
| 1751 } |
| 1752 |
| 1753 int _getIndexedUint64(int index) { |
| 1754 return _getUint64(index * Uint64List.BYTES_PER_ELEMENT); |
| 1755 } |
| 1756 |
| 1757 void _setIndexedUint64(int index, int value) { |
| 1758 _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value); |
| 1759 } |
| 1760 |
| 1647 static _ExternalUint64Array _new(int length) native | 1761 static _ExternalUint64Array _new(int length) native |
| 1648 "ExternalTypedData_Uint64Array_new"; | 1762 "ExternalTypedData_Uint64Array_new"; |
| 1649 } | 1763 } |
| 1650 | 1764 |
| 1651 | 1765 |
| 1652 class _ExternalFloat32Array extends _TypedList implements Float32List { | 1766 class _ExternalFloat32Array extends _TypedList implements Float32List { |
| 1653 // Factory constructors. | 1767 // Factory constructors. |
| 1654 | 1768 |
| 1655 factory _ExternalFloat32Array(int length) { | 1769 factory _ExternalFloat32Array(int length) { |
| 1656 if (length < 0) { | 1770 if (length < 0) { |
| 1657 String message = "$length must be greater than 0"; | 1771 String message = "$length must be greater than 0"; |
| 1658 throw new ArgumentError(message); | 1772 throw new ArgumentError(message); |
| 1659 } | 1773 } |
| 1660 return _new(length); | 1774 return _new(length); |
| 1661 } | 1775 } |
| 1662 | 1776 |
| 1663 | 1777 |
| 1664 // Method(s) implementing the List interface. | 1778 // Method(s) implementing the List interface. |
| 1665 | 1779 |
| 1666 double operator[](int index) { | 1780 double operator[](int index) { |
| 1667 if (index < 0 || index >= length) { | 1781 if (index < 0 || index >= length) { |
| 1668 String message = "$index must be in the range [0..$length)"; | 1782 String message = "$index must be in the range [0..$length)"; |
| 1669 throw new RangeError(message); | 1783 throw new RangeError(message); |
| 1670 } | 1784 } |
| 1671 return _getFloat32(index); | 1785 return _getIndexedFloat32(index); |
| 1672 } | 1786 } |
| 1673 | 1787 |
| 1674 void operator[]=(int index, double value) { | 1788 void operator[]=(int index, double value) { |
| 1675 if (index < 0 || index >= length) { | 1789 if (index < 0 || index >= length) { |
| 1676 String message = "$index must be in the range [0..$length)"; | 1790 String message = "$index must be in the range [0..$length)"; |
| 1677 throw new RangeError(message); | 1791 throw new RangeError(message); |
| 1678 } | 1792 } |
| 1679 _setFloat32(index, value); | 1793 _setIndexedFloat32(index, value); |
| 1680 } | 1794 } |
| 1681 | 1795 |
| 1682 Iterator<double> get iterator { | 1796 Iterator<double> get iterator { |
| 1683 return new _TypedListIterator<double>(this); | 1797 return new _TypedListIterator<double>(this); |
| 1684 } | 1798 } |
| 1685 | 1799 |
| 1686 | 1800 |
| 1687 // Method(s) implementing the TypedData interface. | 1801 // Method(s) implementing the TypedData interface. |
| 1688 | 1802 |
| 1689 int get elementSizeInBytes { | 1803 int get elementSizeInBytes { |
| 1690 return Float32List.BYTES_PER_ELEMENT; | 1804 return Float32List.BYTES_PER_ELEMENT; |
| 1691 } | 1805 } |
| 1692 | 1806 |
| 1693 | 1807 |
| 1694 // Internal utility methods. | 1808 // Internal utility methods. |
| 1695 | 1809 |
| 1696 Float32List _createList(int length) { | 1810 Float32List _createList(int length) { |
| 1697 return new Float32List(length); | 1811 return new Float32List(length); |
| 1698 } | 1812 } |
| 1699 | 1813 |
| 1814 double _getIndexedFloat32(int index) { |
| 1815 return _getFloat32(index * Float32List.BYTES_PER_ELEMENT); |
| 1816 } |
| 1817 |
| 1818 void _setIndexedFloat32(int index, double value) { |
| 1819 _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value); |
| 1820 } |
| 1821 |
| 1700 static _ExternalFloat32Array _new(int length) native | 1822 static _ExternalFloat32Array _new(int length) native |
| 1701 "ExternalTypedData_Float32Array_new"; | 1823 "ExternalTypedData_Float32Array_new"; |
| 1702 } | 1824 } |
| 1703 | 1825 |
| 1704 | 1826 |
| 1705 class _ExternalFloat64Array extends _TypedList implements Float64List { | 1827 class _ExternalFloat64Array extends _TypedList implements Float64List { |
| 1706 // Factory constructors. | 1828 // Factory constructors. |
| 1707 | 1829 |
| 1708 factory _ExternalFloat64Array(int length) { | 1830 factory _ExternalFloat64Array(int length) { |
| 1709 if (length < 0) { | 1831 if (length < 0) { |
| 1710 String message = "$length must be greater than 0"; | 1832 String message = "$length must be greater than 0"; |
| 1711 throw new ArgumentError(message); | 1833 throw new ArgumentError(message); |
| 1712 } | 1834 } |
| 1713 return _new(length); | 1835 return _new(length); |
| 1714 } | 1836 } |
| 1715 | 1837 |
| 1716 | 1838 |
| 1717 // Method(s) implementing the List interface. | 1839 // Method(s) implementing the List interface. |
| 1718 | 1840 |
| 1719 double operator[](int index) { | 1841 double operator[](int index) { |
| 1720 if (index < 0 || index >= length) { | 1842 if (index < 0 || index >= length) { |
| 1721 String message = "$index must be in the range [0..$length)"; | 1843 String message = "$index must be in the range [0..$length)"; |
| 1722 throw new RangeError(message); | 1844 throw new RangeError(message); |
| 1723 } | 1845 } |
| 1724 return _getFloat64(index); | 1846 return _getIndexedFloat64(index); |
| 1725 } | 1847 } |
| 1726 | 1848 |
| 1727 void operator[]=(int index, double value) { | 1849 void operator[]=(int index, double value) { |
| 1728 if (index < 0 || index >= length) { | 1850 if (index < 0 || index >= length) { |
| 1729 String message = "$index must be in the range [0..$length)"; | 1851 String message = "$index must be in the range [0..$length)"; |
| 1730 throw new RangeError(message); | 1852 throw new RangeError(message); |
| 1731 } | 1853 } |
| 1732 _setFloat64(index, value); | 1854 _setIndexedFloat64(index, value); |
| 1733 } | 1855 } |
| 1734 | 1856 |
| 1735 Iterator<double> get iterator { | 1857 Iterator<double> get iterator { |
| 1736 return new _TypedListIterator<double>(this); | 1858 return new _TypedListIterator<double>(this); |
| 1737 } | 1859 } |
| 1738 | 1860 |
| 1739 | 1861 |
| 1740 // Method(s) implementing the TypedData interface. | 1862 // Method(s) implementing the TypedData interface. |
| 1741 | 1863 |
| 1742 int get elementSizeInBytes { | 1864 int get elementSizeInBytes { |
| 1743 return Float64List.BYTES_PER_ELEMENT; | 1865 return Float64List.BYTES_PER_ELEMENT; |
| 1744 } | 1866 } |
| 1745 | 1867 |
| 1746 | 1868 |
| 1747 // Internal utility methods. | 1869 // Internal utility methods. |
| 1748 | 1870 |
| 1749 Float64List _createList(int length) { | 1871 Float64List _createList(int length) { |
| 1750 return new Float64List(length); | 1872 return new Float64List(length); |
| 1751 } | 1873 } |
| 1752 | 1874 |
| 1875 double _getIndexedFloat64(int index) { |
| 1876 return _getFloat64(index * Float64List.BYTES_PER_ELEMENT); |
| 1877 } |
| 1878 |
| 1879 void _setIndexedFloat64(int index, double value) { |
| 1880 _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value); |
| 1881 } |
| 1882 |
| 1753 static _ExternalFloat64Array _new(int length) native | 1883 static _ExternalFloat64Array _new(int length) native |
| 1754 "ExternalTypedData_Float64Array_new"; | 1884 "ExternalTypedData_Float64Array_new"; |
| 1755 } | 1885 } |
| 1756 | 1886 |
| 1757 | 1887 |
| 1758 class _TypedListIterator<E> implements Iterator<E> { | 1888 class _TypedListIterator<E> implements Iterator<E> { |
| 1759 final List<E> _array; | 1889 final List<E> _array; |
| 1760 final int _length; | 1890 final int _length; |
| 1761 int _position; | 1891 int _position; |
| 1762 E _current; | 1892 E _current; |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 } | 2611 } |
| 2482 } | 2612 } |
| 2483 | 2613 |
| 2484 | 2614 |
| 2485 int _defaultIfNull(object, value) { | 2615 int _defaultIfNull(object, value) { |
| 2486 if (object == null) { | 2616 if (object == null) { |
| 2487 return value; | 2617 return value; |
| 2488 } | 2618 } |
| 2489 return object; | 2619 return object; |
| 2490 } | 2620 } |
| OLD | NEW |