OLD | NEW |
1 library svg; | 1 library svg; |
2 | 2 |
3 import 'dart:collection'; | 3 import 'dart:collection'; |
4 import 'dart:html'; | 4 import 'dart:html'; |
5 import 'dart:html_common'; | 5 import 'dart:html_common'; |
6 // DO NOT EDIT | 6 // DO NOT EDIT |
7 // Auto-generated dart:svg library. | 7 // Auto-generated dart:svg library. |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 Length operator[](int index) => JS("Length", "#[#]", this, index); | 2790 Length operator[](int index) => JS("Length", "#[#]", this, index); |
2791 | 2791 |
2792 void operator[]=(int index, Length value) { | 2792 void operator[]=(int index, Length value) { |
2793 throw new UnsupportedError("Cannot assign element of immutable List."); | 2793 throw new UnsupportedError("Cannot assign element of immutable List."); |
2794 } | 2794 } |
2795 // -- start List<Length> mixins. | 2795 // -- start List<Length> mixins. |
2796 // Length is the element type. | 2796 // Length is the element type. |
2797 | 2797 |
2798 // From Iterable<Length>: | 2798 // From Iterable<Length>: |
2799 | 2799 |
2800 Iterator<Length> iterator() { | 2800 Iterator<Length> get iterator { |
2801 // Note: NodeLists are not fixed size. And most probably length shouldn't | 2801 // Note: NodeLists are not fixed size. And most probably length shouldn't |
2802 // be cached in both iterator _and_ forEach method. For now caching it | 2802 // be cached in both iterator _and_ forEach method. For now caching it |
2803 // for consistency. | 2803 // for consistency. |
2804 return new FixedSizeListIterator<Length>(this); | 2804 return new FixedSizeListIterator<Length>(this); |
2805 } | 2805 } |
2806 | 2806 |
2807 // From Collection<Length>: | |
2808 // SVG Collections expose numberOfItems rather than length. | 2807 // SVG Collections expose numberOfItems rather than length. |
2809 int get length => numberOfItems; | 2808 int get length => numberOfItems; |
2810 | |
2811 void add(Length value) { | |
2812 throw new UnsupportedError("Cannot add to immutable List."); | |
2813 } | |
2814 | |
2815 void addLast(Length value) { | |
2816 throw new UnsupportedError("Cannot add to immutable List."); | |
2817 } | |
2818 | |
2819 void addAll(Collection<Length> collection) { | |
2820 throw new UnsupportedError("Cannot add to immutable List."); | |
2821 } | |
2822 | |
2823 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) { | 2809 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) { |
2824 return Collections.reduce(this, initialValue, combine); | 2810 return Collections.reduce(this, initialValue, combine); |
2825 } | 2811 } |
2826 | 2812 |
2827 bool contains(Length element) => Collections.contains(this, element); | 2813 bool contains(Length element) => Collections.contains(this, element); |
2828 | 2814 |
2829 void forEach(void f(Length element)) => Collections.forEach(this, f); | 2815 void forEach(void f(Length element)) => Collections.forEach(this, f); |
2830 | 2816 |
2831 Collection map(f(Length element)) => Collections.map(this, [], f); | 2817 String join([String separator]) => Collections.joinList(this, separator); |
2832 | 2818 |
2833 Collection<Length> filter(bool f(Length element)) => | 2819 List mappedBy(f(Length element)) => new MappedList<Length, dynamic>(this, f); |
2834 Collections.filter(this, <Length>[], f); | 2820 |
| 2821 Iterable<Length> where(bool f(Length element)) => new WhereIterable<Length>(th
is, f); |
2835 | 2822 |
2836 bool every(bool f(Length element)) => Collections.every(this, f); | 2823 bool every(bool f(Length element)) => Collections.every(this, f); |
2837 | 2824 |
2838 bool some(bool f(Length element)) => Collections.some(this, f); | 2825 bool any(bool f(Length element)) => Collections.any(this, f); |
2839 | 2826 |
2840 bool get isEmpty => this.length == 0; | 2827 bool get isEmpty => this.length == 0; |
2841 | 2828 |
| 2829 List<Length> take(int n) => new ListView<Length>(this, 0, n); |
| 2830 |
| 2831 Iterable<Length> takeWhile(bool test(Length value)) { |
| 2832 return new TakeWhileIterable<Length>(this, test); |
| 2833 } |
| 2834 |
| 2835 List<Length> skip(int n) => new ListView<Length>(this, n, null); |
| 2836 |
| 2837 Iterable<Length> skipWhile(bool test(Length value)) { |
| 2838 return new SkipWhileIterable<Length>(this, test); |
| 2839 } |
| 2840 |
| 2841 Length firstMatching(bool test(Length value), { Length orElse() }) { |
| 2842 return Collections.firstMatching(this, test, orElse); |
| 2843 } |
| 2844 |
| 2845 Length lastMatching(bool test(Length value), {Length orElse()}) { |
| 2846 return Collections.lastMatchingInList(this, test, orElse); |
| 2847 } |
| 2848 |
| 2849 Length singleMatching(bool test(Length value)) { |
| 2850 return Collections.singleMatching(this, test); |
| 2851 } |
| 2852 |
| 2853 Length elementAt(int index) { |
| 2854 return this[index]; |
| 2855 } |
| 2856 |
| 2857 // From Collection<Length>: |
| 2858 |
| 2859 void add(Length value) { |
| 2860 throw new UnsupportedError("Cannot add to immutable List."); |
| 2861 } |
| 2862 |
| 2863 void addLast(Length value) { |
| 2864 throw new UnsupportedError("Cannot add to immutable List."); |
| 2865 } |
| 2866 |
| 2867 void addAll(Iterable<Length> iterable) { |
| 2868 throw new UnsupportedError("Cannot add to immutable List."); |
| 2869 } |
| 2870 |
2842 // From List<Length>: | 2871 // From List<Length>: |
2843 void set length(int value) { | 2872 void set length(int value) { |
2844 throw new UnsupportedError("Cannot resize immutable List."); | 2873 throw new UnsupportedError("Cannot resize immutable List."); |
2845 } | 2874 } |
2846 | 2875 |
2847 // contains() defined by IDL. | 2876 // contains() defined by IDL. |
2848 | 2877 |
2849 void sort([int compare(Length a, Length b)]) { | 2878 void sort([int compare(Length a, Length b)]) { |
2850 throw new UnsupportedError("Cannot sort immutable List."); | 2879 throw new UnsupportedError("Cannot sort immutable List."); |
2851 } | 2880 } |
2852 | 2881 |
2853 int indexOf(Length element, [int start = 0]) => | 2882 int indexOf(Length element, [int start = 0]) => |
2854 Lists.indexOf(this, element, start, this.length); | 2883 Lists.indexOf(this, element, start, this.length); |
2855 | 2884 |
2856 int lastIndexOf(Length element, [int start]) { | 2885 int lastIndexOf(Length element, [int start]) { |
2857 if (start == null) start = length - 1; | 2886 if (start == null) start = length - 1; |
2858 return Lists.lastIndexOf(this, element, start); | 2887 return Lists.lastIndexOf(this, element, start); |
2859 } | 2888 } |
2860 | 2889 |
2861 Length get first => this[0]; | 2890 Length get first { |
| 2891 if (this.length > 0) return this[0]; |
| 2892 throw new StateError("No elements"); |
| 2893 } |
2862 | 2894 |
2863 Length get last => this[length - 1]; | 2895 Length get last { |
| 2896 if (this.length > 0) return this[this.length - 1]; |
| 2897 throw new StateError("No elements"); |
| 2898 } |
| 2899 |
| 2900 Length get single { |
| 2901 if (length == 1) return this[0]; |
| 2902 if (length == 0) throw new StateError("No elements"); |
| 2903 throw new StateError("More than one element"); |
| 2904 } |
| 2905 |
| 2906 Length min([int compare(Length a, Length b)]) => _Collections.minInList(this,
compare); |
| 2907 |
| 2908 Length max([int compare(Length a, Length b)]) => _Collections.maxInList(this,
compare); |
2864 | 2909 |
2865 Length removeAt(int pos) { | 2910 Length removeAt(int pos) { |
2866 throw new UnsupportedError("Cannot removeAt on immutable List."); | 2911 throw new UnsupportedError("Cannot removeAt on immutable List."); |
2867 } | 2912 } |
2868 | 2913 |
2869 Length removeLast() { | 2914 Length removeLast() { |
2870 throw new UnsupportedError("Cannot removeLast on immutable List."); | 2915 throw new UnsupportedError("Cannot removeLast on immutable List."); |
2871 } | 2916 } |
2872 | 2917 |
2873 void setRange(int start, int rangeLength, List<Length> from, [int startFrom])
{ | 2918 void setRange(int start, int rangeLength, List<Length> from, [int startFrom])
{ |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3316 Number operator[](int index) => JS("Number", "#[#]", this, index); | 3361 Number operator[](int index) => JS("Number", "#[#]", this, index); |
3317 | 3362 |
3318 void operator[]=(int index, Number value) { | 3363 void operator[]=(int index, Number value) { |
3319 throw new UnsupportedError("Cannot assign element of immutable List."); | 3364 throw new UnsupportedError("Cannot assign element of immutable List."); |
3320 } | 3365 } |
3321 // -- start List<Number> mixins. | 3366 // -- start List<Number> mixins. |
3322 // Number is the element type. | 3367 // Number is the element type. |
3323 | 3368 |
3324 // From Iterable<Number>: | 3369 // From Iterable<Number>: |
3325 | 3370 |
3326 Iterator<Number> iterator() { | 3371 Iterator<Number> get iterator { |
3327 // Note: NodeLists are not fixed size. And most probably length shouldn't | 3372 // Note: NodeLists are not fixed size. And most probably length shouldn't |
3328 // be cached in both iterator _and_ forEach method. For now caching it | 3373 // be cached in both iterator _and_ forEach method. For now caching it |
3329 // for consistency. | 3374 // for consistency. |
3330 return new FixedSizeListIterator<Number>(this); | 3375 return new FixedSizeListIterator<Number>(this); |
3331 } | 3376 } |
3332 | 3377 |
3333 // From Collection<Number>: | |
3334 // SVG Collections expose numberOfItems rather than length. | 3378 // SVG Collections expose numberOfItems rather than length. |
3335 int get length => numberOfItems; | 3379 int get length => numberOfItems; |
3336 | |
3337 void add(Number value) { | |
3338 throw new UnsupportedError("Cannot add to immutable List."); | |
3339 } | |
3340 | |
3341 void addLast(Number value) { | |
3342 throw new UnsupportedError("Cannot add to immutable List."); | |
3343 } | |
3344 | |
3345 void addAll(Collection<Number> collection) { | |
3346 throw new UnsupportedError("Cannot add to immutable List."); | |
3347 } | |
3348 | |
3349 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) { | 3380 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) { |
3350 return Collections.reduce(this, initialValue, combine); | 3381 return Collections.reduce(this, initialValue, combine); |
3351 } | 3382 } |
3352 | 3383 |
3353 bool contains(Number element) => Collections.contains(this, element); | 3384 bool contains(Number element) => Collections.contains(this, element); |
3354 | 3385 |
3355 void forEach(void f(Number element)) => Collections.forEach(this, f); | 3386 void forEach(void f(Number element)) => Collections.forEach(this, f); |
3356 | 3387 |
3357 Collection map(f(Number element)) => Collections.map(this, [], f); | 3388 String join([String separator]) => Collections.joinList(this, separator); |
3358 | 3389 |
3359 Collection<Number> filter(bool f(Number element)) => | 3390 List mappedBy(f(Number element)) => new MappedList<Number, dynamic>(this, f); |
3360 Collections.filter(this, <Number>[], f); | 3391 |
| 3392 Iterable<Number> where(bool f(Number element)) => new WhereIterable<Number>(th
is, f); |
3361 | 3393 |
3362 bool every(bool f(Number element)) => Collections.every(this, f); | 3394 bool every(bool f(Number element)) => Collections.every(this, f); |
3363 | 3395 |
3364 bool some(bool f(Number element)) => Collections.some(this, f); | 3396 bool any(bool f(Number element)) => Collections.any(this, f); |
3365 | 3397 |
3366 bool get isEmpty => this.length == 0; | 3398 bool get isEmpty => this.length == 0; |
3367 | 3399 |
| 3400 List<Number> take(int n) => new ListView<Number>(this, 0, n); |
| 3401 |
| 3402 Iterable<Number> takeWhile(bool test(Number value)) { |
| 3403 return new TakeWhileIterable<Number>(this, test); |
| 3404 } |
| 3405 |
| 3406 List<Number> skip(int n) => new ListView<Number>(this, n, null); |
| 3407 |
| 3408 Iterable<Number> skipWhile(bool test(Number value)) { |
| 3409 return new SkipWhileIterable<Number>(this, test); |
| 3410 } |
| 3411 |
| 3412 Number firstMatching(bool test(Number value), { Number orElse() }) { |
| 3413 return Collections.firstMatching(this, test, orElse); |
| 3414 } |
| 3415 |
| 3416 Number lastMatching(bool test(Number value), {Number orElse()}) { |
| 3417 return Collections.lastMatchingInList(this, test, orElse); |
| 3418 } |
| 3419 |
| 3420 Number singleMatching(bool test(Number value)) { |
| 3421 return Collections.singleMatching(this, test); |
| 3422 } |
| 3423 |
| 3424 Number elementAt(int index) { |
| 3425 return this[index]; |
| 3426 } |
| 3427 |
| 3428 // From Collection<Number>: |
| 3429 |
| 3430 void add(Number value) { |
| 3431 throw new UnsupportedError("Cannot add to immutable List."); |
| 3432 } |
| 3433 |
| 3434 void addLast(Number value) { |
| 3435 throw new UnsupportedError("Cannot add to immutable List."); |
| 3436 } |
| 3437 |
| 3438 void addAll(Iterable<Number> iterable) { |
| 3439 throw new UnsupportedError("Cannot add to immutable List."); |
| 3440 } |
| 3441 |
3368 // From List<Number>: | 3442 // From List<Number>: |
3369 void set length(int value) { | 3443 void set length(int value) { |
3370 throw new UnsupportedError("Cannot resize immutable List."); | 3444 throw new UnsupportedError("Cannot resize immutable List."); |
3371 } | 3445 } |
3372 | 3446 |
3373 // contains() defined by IDL. | 3447 // contains() defined by IDL. |
3374 | 3448 |
3375 void sort([int compare(Number a, Number b)]) { | 3449 void sort([int compare(Number a, Number b)]) { |
3376 throw new UnsupportedError("Cannot sort immutable List."); | 3450 throw new UnsupportedError("Cannot sort immutable List."); |
3377 } | 3451 } |
3378 | 3452 |
3379 int indexOf(Number element, [int start = 0]) => | 3453 int indexOf(Number element, [int start = 0]) => |
3380 Lists.indexOf(this, element, start, this.length); | 3454 Lists.indexOf(this, element, start, this.length); |
3381 | 3455 |
3382 int lastIndexOf(Number element, [int start]) { | 3456 int lastIndexOf(Number element, [int start]) { |
3383 if (start == null) start = length - 1; | 3457 if (start == null) start = length - 1; |
3384 return Lists.lastIndexOf(this, element, start); | 3458 return Lists.lastIndexOf(this, element, start); |
3385 } | 3459 } |
3386 | 3460 |
3387 Number get first => this[0]; | 3461 Number get first { |
| 3462 if (this.length > 0) return this[0]; |
| 3463 throw new StateError("No elements"); |
| 3464 } |
3388 | 3465 |
3389 Number get last => this[length - 1]; | 3466 Number get last { |
| 3467 if (this.length > 0) return this[this.length - 1]; |
| 3468 throw new StateError("No elements"); |
| 3469 } |
| 3470 |
| 3471 Number get single { |
| 3472 if (length == 1) return this[0]; |
| 3473 if (length == 0) throw new StateError("No elements"); |
| 3474 throw new StateError("More than one element"); |
| 3475 } |
| 3476 |
| 3477 Number min([int compare(Number a, Number b)]) => _Collections.minInList(this,
compare); |
| 3478 |
| 3479 Number max([int compare(Number a, Number b)]) => _Collections.maxInList(this,
compare); |
3390 | 3480 |
3391 Number removeAt(int pos) { | 3481 Number removeAt(int pos) { |
3392 throw new UnsupportedError("Cannot removeAt on immutable List."); | 3482 throw new UnsupportedError("Cannot removeAt on immutable List."); |
3393 } | 3483 } |
3394 | 3484 |
3395 Number removeLast() { | 3485 Number removeLast() { |
3396 throw new UnsupportedError("Cannot removeLast on immutable List."); | 3486 throw new UnsupportedError("Cannot removeLast on immutable List."); |
3397 } | 3487 } |
3398 | 3488 |
3399 void setRange(int start, int rangeLength, List<Number> from, [int startFrom])
{ | 3489 void setRange(int start, int rangeLength, List<Number> from, [int startFrom])
{ |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4017 PathSeg operator[](int index) => JS("PathSeg", "#[#]", this, index); | 4107 PathSeg operator[](int index) => JS("PathSeg", "#[#]", this, index); |
4018 | 4108 |
4019 void operator[]=(int index, PathSeg value) { | 4109 void operator[]=(int index, PathSeg value) { |
4020 throw new UnsupportedError("Cannot assign element of immutable List."); | 4110 throw new UnsupportedError("Cannot assign element of immutable List."); |
4021 } | 4111 } |
4022 // -- start List<PathSeg> mixins. | 4112 // -- start List<PathSeg> mixins. |
4023 // PathSeg is the element type. | 4113 // PathSeg is the element type. |
4024 | 4114 |
4025 // From Iterable<PathSeg>: | 4115 // From Iterable<PathSeg>: |
4026 | 4116 |
4027 Iterator<PathSeg> iterator() { | 4117 Iterator<PathSeg> get iterator { |
4028 // Note: NodeLists are not fixed size. And most probably length shouldn't | 4118 // Note: NodeLists are not fixed size. And most probably length shouldn't |
4029 // be cached in both iterator _and_ forEach method. For now caching it | 4119 // be cached in both iterator _and_ forEach method. For now caching it |
4030 // for consistency. | 4120 // for consistency. |
4031 return new FixedSizeListIterator<PathSeg>(this); | 4121 return new FixedSizeListIterator<PathSeg>(this); |
4032 } | 4122 } |
4033 | 4123 |
4034 // From Collection<PathSeg>: | |
4035 // SVG Collections expose numberOfItems rather than length. | 4124 // SVG Collections expose numberOfItems rather than length. |
4036 int get length => numberOfItems; | 4125 int get length => numberOfItems; |
4037 | |
4038 void add(PathSeg value) { | |
4039 throw new UnsupportedError("Cannot add to immutable List."); | |
4040 } | |
4041 | |
4042 void addLast(PathSeg value) { | |
4043 throw new UnsupportedError("Cannot add to immutable List."); | |
4044 } | |
4045 | |
4046 void addAll(Collection<PathSeg> collection) { | |
4047 throw new UnsupportedError("Cannot add to immutable List."); | |
4048 } | |
4049 | |
4050 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) { | 4126 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) { |
4051 return Collections.reduce(this, initialValue, combine); | 4127 return Collections.reduce(this, initialValue, combine); |
4052 } | 4128 } |
4053 | 4129 |
4054 bool contains(PathSeg element) => Collections.contains(this, element); | 4130 bool contains(PathSeg element) => Collections.contains(this, element); |
4055 | 4131 |
4056 void forEach(void f(PathSeg element)) => Collections.forEach(this, f); | 4132 void forEach(void f(PathSeg element)) => Collections.forEach(this, f); |
4057 | 4133 |
4058 Collection map(f(PathSeg element)) => Collections.map(this, [], f); | 4134 String join([String separator]) => Collections.joinList(this, separator); |
4059 | 4135 |
4060 Collection<PathSeg> filter(bool f(PathSeg element)) => | 4136 List mappedBy(f(PathSeg element)) => new MappedList<PathSeg, dynamic>(this, f)
; |
4061 Collections.filter(this, <PathSeg>[], f); | 4137 |
| 4138 Iterable<PathSeg> where(bool f(PathSeg element)) => new WhereIterable<PathSeg>
(this, f); |
4062 | 4139 |
4063 bool every(bool f(PathSeg element)) => Collections.every(this, f); | 4140 bool every(bool f(PathSeg element)) => Collections.every(this, f); |
4064 | 4141 |
4065 bool some(bool f(PathSeg element)) => Collections.some(this, f); | 4142 bool any(bool f(PathSeg element)) => Collections.any(this, f); |
4066 | 4143 |
4067 bool get isEmpty => this.length == 0; | 4144 bool get isEmpty => this.length == 0; |
4068 | 4145 |
| 4146 List<PathSeg> take(int n) => new ListView<PathSeg>(this, 0, n); |
| 4147 |
| 4148 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) { |
| 4149 return new TakeWhileIterable<PathSeg>(this, test); |
| 4150 } |
| 4151 |
| 4152 List<PathSeg> skip(int n) => new ListView<PathSeg>(this, n, null); |
| 4153 |
| 4154 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) { |
| 4155 return new SkipWhileIterable<PathSeg>(this, test); |
| 4156 } |
| 4157 |
| 4158 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) { |
| 4159 return Collections.firstMatching(this, test, orElse); |
| 4160 } |
| 4161 |
| 4162 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) { |
| 4163 return Collections.lastMatchingInList(this, test, orElse); |
| 4164 } |
| 4165 |
| 4166 PathSeg singleMatching(bool test(PathSeg value)) { |
| 4167 return Collections.singleMatching(this, test); |
| 4168 } |
| 4169 |
| 4170 PathSeg elementAt(int index) { |
| 4171 return this[index]; |
| 4172 } |
| 4173 |
| 4174 // From Collection<PathSeg>: |
| 4175 |
| 4176 void add(PathSeg value) { |
| 4177 throw new UnsupportedError("Cannot add to immutable List."); |
| 4178 } |
| 4179 |
| 4180 void addLast(PathSeg value) { |
| 4181 throw new UnsupportedError("Cannot add to immutable List."); |
| 4182 } |
| 4183 |
| 4184 void addAll(Iterable<PathSeg> iterable) { |
| 4185 throw new UnsupportedError("Cannot add to immutable List."); |
| 4186 } |
| 4187 |
4069 // From List<PathSeg>: | 4188 // From List<PathSeg>: |
4070 void set length(int value) { | 4189 void set length(int value) { |
4071 throw new UnsupportedError("Cannot resize immutable List."); | 4190 throw new UnsupportedError("Cannot resize immutable List."); |
4072 } | 4191 } |
4073 | 4192 |
4074 // contains() defined by IDL. | 4193 // contains() defined by IDL. |
4075 | 4194 |
4076 void sort([int compare(PathSeg a, PathSeg b)]) { | 4195 void sort([int compare(PathSeg a, PathSeg b)]) { |
4077 throw new UnsupportedError("Cannot sort immutable List."); | 4196 throw new UnsupportedError("Cannot sort immutable List."); |
4078 } | 4197 } |
4079 | 4198 |
4080 int indexOf(PathSeg element, [int start = 0]) => | 4199 int indexOf(PathSeg element, [int start = 0]) => |
4081 Lists.indexOf(this, element, start, this.length); | 4200 Lists.indexOf(this, element, start, this.length); |
4082 | 4201 |
4083 int lastIndexOf(PathSeg element, [int start]) { | 4202 int lastIndexOf(PathSeg element, [int start]) { |
4084 if (start == null) start = length - 1; | 4203 if (start == null) start = length - 1; |
4085 return Lists.lastIndexOf(this, element, start); | 4204 return Lists.lastIndexOf(this, element, start); |
4086 } | 4205 } |
4087 | 4206 |
4088 PathSeg get first => this[0]; | 4207 PathSeg get first { |
| 4208 if (this.length > 0) return this[0]; |
| 4209 throw new StateError("No elements"); |
| 4210 } |
4089 | 4211 |
4090 PathSeg get last => this[length - 1]; | 4212 PathSeg get last { |
| 4213 if (this.length > 0) return this[this.length - 1]; |
| 4214 throw new StateError("No elements"); |
| 4215 } |
| 4216 |
| 4217 PathSeg get single { |
| 4218 if (length == 1) return this[0]; |
| 4219 if (length == 0) throw new StateError("No elements"); |
| 4220 throw new StateError("More than one element"); |
| 4221 } |
| 4222 |
| 4223 PathSeg min([int compare(PathSeg a, PathSeg b)]) => _Collections.minInList(thi
s, compare); |
| 4224 |
| 4225 PathSeg max([int compare(PathSeg a, PathSeg b)]) => _Collections.maxInList(thi
s, compare); |
4091 | 4226 |
4092 PathSeg removeAt(int pos) { | 4227 PathSeg removeAt(int pos) { |
4093 throw new UnsupportedError("Cannot removeAt on immutable List."); | 4228 throw new UnsupportedError("Cannot removeAt on immutable List."); |
4094 } | 4229 } |
4095 | 4230 |
4096 PathSeg removeLast() { | 4231 PathSeg removeLast() { |
4097 throw new UnsupportedError("Cannot removeLast on immutable List."); | 4232 throw new UnsupportedError("Cannot removeLast on immutable List."); |
4098 } | 4233 } |
4099 | 4234 |
4100 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom])
{ | 4235 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom])
{ |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4743 String operator[](int index) => JS("String", "#[#]", this, index); | 4878 String operator[](int index) => JS("String", "#[#]", this, index); |
4744 | 4879 |
4745 void operator[]=(int index, String value) { | 4880 void operator[]=(int index, String value) { |
4746 throw new UnsupportedError("Cannot assign element of immutable List."); | 4881 throw new UnsupportedError("Cannot assign element of immutable List."); |
4747 } | 4882 } |
4748 // -- start List<String> mixins. | 4883 // -- start List<String> mixins. |
4749 // String is the element type. | 4884 // String is the element type. |
4750 | 4885 |
4751 // From Iterable<String>: | 4886 // From Iterable<String>: |
4752 | 4887 |
4753 Iterator<String> iterator() { | 4888 Iterator<String> get iterator { |
4754 // Note: NodeLists are not fixed size. And most probably length shouldn't | 4889 // Note: NodeLists are not fixed size. And most probably length shouldn't |
4755 // be cached in both iterator _and_ forEach method. For now caching it | 4890 // be cached in both iterator _and_ forEach method. For now caching it |
4756 // for consistency. | 4891 // for consistency. |
4757 return new FixedSizeListIterator<String>(this); | 4892 return new FixedSizeListIterator<String>(this); |
4758 } | 4893 } |
4759 | 4894 |
4760 // From Collection<String>: | |
4761 // SVG Collections expose numberOfItems rather than length. | 4895 // SVG Collections expose numberOfItems rather than length. |
4762 int get length => numberOfItems; | 4896 int get length => numberOfItems; |
4763 | |
4764 void add(String value) { | |
4765 throw new UnsupportedError("Cannot add to immutable List."); | |
4766 } | |
4767 | |
4768 void addLast(String value) { | |
4769 throw new UnsupportedError("Cannot add to immutable List."); | |
4770 } | |
4771 | |
4772 void addAll(Collection<String> collection) { | |
4773 throw new UnsupportedError("Cannot add to immutable List."); | |
4774 } | |
4775 | |
4776 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { | 4897 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { |
4777 return Collections.reduce(this, initialValue, combine); | 4898 return Collections.reduce(this, initialValue, combine); |
4778 } | 4899 } |
4779 | 4900 |
4780 bool contains(String element) => Collections.contains(this, element); | 4901 bool contains(String element) => Collections.contains(this, element); |
4781 | 4902 |
4782 void forEach(void f(String element)) => Collections.forEach(this, f); | 4903 void forEach(void f(String element)) => Collections.forEach(this, f); |
4783 | 4904 |
4784 Collection map(f(String element)) => Collections.map(this, [], f); | 4905 String join([String separator]) => Collections.joinList(this, separator); |
4785 | 4906 |
4786 Collection<String> filter(bool f(String element)) => | 4907 List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f); |
4787 Collections.filter(this, <String>[], f); | 4908 |
| 4909 Iterable<String> where(bool f(String element)) => new WhereIterable<String>(th
is, f); |
4788 | 4910 |
4789 bool every(bool f(String element)) => Collections.every(this, f); | 4911 bool every(bool f(String element)) => Collections.every(this, f); |
4790 | 4912 |
4791 bool some(bool f(String element)) => Collections.some(this, f); | 4913 bool any(bool f(String element)) => Collections.any(this, f); |
4792 | 4914 |
4793 bool get isEmpty => this.length == 0; | 4915 bool get isEmpty => this.length == 0; |
4794 | 4916 |
| 4917 List<String> take(int n) => new ListView<String>(this, 0, n); |
| 4918 |
| 4919 Iterable<String> takeWhile(bool test(String value)) { |
| 4920 return new TakeWhileIterable<String>(this, test); |
| 4921 } |
| 4922 |
| 4923 List<String> skip(int n) => new ListView<String>(this, n, null); |
| 4924 |
| 4925 Iterable<String> skipWhile(bool test(String value)) { |
| 4926 return new SkipWhileIterable<String>(this, test); |
| 4927 } |
| 4928 |
| 4929 String firstMatching(bool test(String value), { String orElse() }) { |
| 4930 return Collections.firstMatching(this, test, orElse); |
| 4931 } |
| 4932 |
| 4933 String lastMatching(bool test(String value), {String orElse()}) { |
| 4934 return Collections.lastMatchingInList(this, test, orElse); |
| 4935 } |
| 4936 |
| 4937 String singleMatching(bool test(String value)) { |
| 4938 return Collections.singleMatching(this, test); |
| 4939 } |
| 4940 |
| 4941 String elementAt(int index) { |
| 4942 return this[index]; |
| 4943 } |
| 4944 |
| 4945 // From Collection<String>: |
| 4946 |
| 4947 void add(String value) { |
| 4948 throw new UnsupportedError("Cannot add to immutable List."); |
| 4949 } |
| 4950 |
| 4951 void addLast(String value) { |
| 4952 throw new UnsupportedError("Cannot add to immutable List."); |
| 4953 } |
| 4954 |
| 4955 void addAll(Iterable<String> iterable) { |
| 4956 throw new UnsupportedError("Cannot add to immutable List."); |
| 4957 } |
| 4958 |
4795 // From List<String>: | 4959 // From List<String>: |
4796 void set length(int value) { | 4960 void set length(int value) { |
4797 throw new UnsupportedError("Cannot resize immutable List."); | 4961 throw new UnsupportedError("Cannot resize immutable List."); |
4798 } | 4962 } |
4799 | 4963 |
4800 // contains() defined by IDL. | 4964 // contains() defined by IDL. |
4801 | 4965 |
4802 void sort([int compare(String a, String b)]) { | 4966 void sort([int compare(String a, String b)]) { |
4803 throw new UnsupportedError("Cannot sort immutable List."); | 4967 throw new UnsupportedError("Cannot sort immutable List."); |
4804 } | 4968 } |
4805 | 4969 |
4806 int indexOf(String element, [int start = 0]) => | 4970 int indexOf(String element, [int start = 0]) => |
4807 Lists.indexOf(this, element, start, this.length); | 4971 Lists.indexOf(this, element, start, this.length); |
4808 | 4972 |
4809 int lastIndexOf(String element, [int start]) { | 4973 int lastIndexOf(String element, [int start]) { |
4810 if (start == null) start = length - 1; | 4974 if (start == null) start = length - 1; |
4811 return Lists.lastIndexOf(this, element, start); | 4975 return Lists.lastIndexOf(this, element, start); |
4812 } | 4976 } |
4813 | 4977 |
4814 String get first => this[0]; | 4978 String get first { |
| 4979 if (this.length > 0) return this[0]; |
| 4980 throw new StateError("No elements"); |
| 4981 } |
4815 | 4982 |
4816 String get last => this[length - 1]; | 4983 String get last { |
| 4984 if (this.length > 0) return this[this.length - 1]; |
| 4985 throw new StateError("No elements"); |
| 4986 } |
| 4987 |
| 4988 String get single { |
| 4989 if (length == 1) return this[0]; |
| 4990 if (length == 0) throw new StateError("No elements"); |
| 4991 throw new StateError("More than one element"); |
| 4992 } |
| 4993 |
| 4994 String min([int compare(String a, String b)]) => _Collections.minInList(this,
compare); |
| 4995 |
| 4996 String max([int compare(String a, String b)]) => _Collections.maxInList(this,
compare); |
4817 | 4997 |
4818 String removeAt(int pos) { | 4998 String removeAt(int pos) { |
4819 throw new UnsupportedError("Cannot removeAt on immutable List."); | 4999 throw new UnsupportedError("Cannot removeAt on immutable List."); |
4820 } | 5000 } |
4821 | 5001 |
4822 String removeLast() { | 5002 String removeLast() { |
4823 throw new UnsupportedError("Cannot removeLast on immutable List."); | 5003 throw new UnsupportedError("Cannot removeLast on immutable List."); |
4824 } | 5004 } |
4825 | 5005 |
4826 void setRange(int start, int rangeLength, List<String> from, [int startFrom])
{ | 5006 void setRange(int start, int rangeLength, List<String> from, [int startFrom])
{ |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5737 Transform operator[](int index) => JS("Transform", "#[#]", this, index); | 5917 Transform operator[](int index) => JS("Transform", "#[#]", this, index); |
5738 | 5918 |
5739 void operator[]=(int index, Transform value) { | 5919 void operator[]=(int index, Transform value) { |
5740 throw new UnsupportedError("Cannot assign element of immutable List."); | 5920 throw new UnsupportedError("Cannot assign element of immutable List."); |
5741 } | 5921 } |
5742 // -- start List<Transform> mixins. | 5922 // -- start List<Transform> mixins. |
5743 // Transform is the element type. | 5923 // Transform is the element type. |
5744 | 5924 |
5745 // From Iterable<Transform>: | 5925 // From Iterable<Transform>: |
5746 | 5926 |
5747 Iterator<Transform> iterator() { | 5927 Iterator<Transform> get iterator { |
5748 // Note: NodeLists are not fixed size. And most probably length shouldn't | 5928 // Note: NodeLists are not fixed size. And most probably length shouldn't |
5749 // be cached in both iterator _and_ forEach method. For now caching it | 5929 // be cached in both iterator _and_ forEach method. For now caching it |
5750 // for consistency. | 5930 // for consistency. |
5751 return new FixedSizeListIterator<Transform>(this); | 5931 return new FixedSizeListIterator<Transform>(this); |
5752 } | 5932 } |
5753 | 5933 |
5754 // From Collection<Transform>: | |
5755 // SVG Collections expose numberOfItems rather than length. | 5934 // SVG Collections expose numberOfItems rather than length. |
5756 int get length => numberOfItems; | 5935 int get length => numberOfItems; |
5757 | |
5758 void add(Transform value) { | |
5759 throw new UnsupportedError("Cannot add to immutable List."); | |
5760 } | |
5761 | |
5762 void addLast(Transform value) { | |
5763 throw new UnsupportedError("Cannot add to immutable List."); | |
5764 } | |
5765 | |
5766 void addAll(Collection<Transform> collection) { | |
5767 throw new UnsupportedError("Cannot add to immutable List."); | |
5768 } | |
5769 | |
5770 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) { | 5936 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) { |
5771 return Collections.reduce(this, initialValue, combine); | 5937 return Collections.reduce(this, initialValue, combine); |
5772 } | 5938 } |
5773 | 5939 |
5774 bool contains(Transform element) => Collections.contains(this, element); | 5940 bool contains(Transform element) => Collections.contains(this, element); |
5775 | 5941 |
5776 void forEach(void f(Transform element)) => Collections.forEach(this, f); | 5942 void forEach(void f(Transform element)) => Collections.forEach(this, f); |
5777 | 5943 |
5778 Collection map(f(Transform element)) => Collections.map(this, [], f); | 5944 String join([String separator]) => Collections.joinList(this, separator); |
5779 | 5945 |
5780 Collection<Transform> filter(bool f(Transform element)) => | 5946 List mappedBy(f(Transform element)) => new MappedList<Transform, dynamic>(this
, f); |
5781 Collections.filter(this, <Transform>[], f); | 5947 |
| 5948 Iterable<Transform> where(bool f(Transform element)) => new WhereIterable<Tran
sform>(this, f); |
5782 | 5949 |
5783 bool every(bool f(Transform element)) => Collections.every(this, f); | 5950 bool every(bool f(Transform element)) => Collections.every(this, f); |
5784 | 5951 |
5785 bool some(bool f(Transform element)) => Collections.some(this, f); | 5952 bool any(bool f(Transform element)) => Collections.any(this, f); |
5786 | 5953 |
5787 bool get isEmpty => this.length == 0; | 5954 bool get isEmpty => this.length == 0; |
5788 | 5955 |
| 5956 List<Transform> take(int n) => new ListView<Transform>(this, 0, n); |
| 5957 |
| 5958 Iterable<Transform> takeWhile(bool test(Transform value)) { |
| 5959 return new TakeWhileIterable<Transform>(this, test); |
| 5960 } |
| 5961 |
| 5962 List<Transform> skip(int n) => new ListView<Transform>(this, n, null); |
| 5963 |
| 5964 Iterable<Transform> skipWhile(bool test(Transform value)) { |
| 5965 return new SkipWhileIterable<Transform>(this, test); |
| 5966 } |
| 5967 |
| 5968 Transform firstMatching(bool test(Transform value), { Transform orElse() }) { |
| 5969 return Collections.firstMatching(this, test, orElse); |
| 5970 } |
| 5971 |
| 5972 Transform lastMatching(bool test(Transform value), {Transform orElse()}) { |
| 5973 return Collections.lastMatchingInList(this, test, orElse); |
| 5974 } |
| 5975 |
| 5976 Transform singleMatching(bool test(Transform value)) { |
| 5977 return Collections.singleMatching(this, test); |
| 5978 } |
| 5979 |
| 5980 Transform elementAt(int index) { |
| 5981 return this[index]; |
| 5982 } |
| 5983 |
| 5984 // From Collection<Transform>: |
| 5985 |
| 5986 void add(Transform value) { |
| 5987 throw new UnsupportedError("Cannot add to immutable List."); |
| 5988 } |
| 5989 |
| 5990 void addLast(Transform value) { |
| 5991 throw new UnsupportedError("Cannot add to immutable List."); |
| 5992 } |
| 5993 |
| 5994 void addAll(Iterable<Transform> iterable) { |
| 5995 throw new UnsupportedError("Cannot add to immutable List."); |
| 5996 } |
| 5997 |
5789 // From List<Transform>: | 5998 // From List<Transform>: |
5790 void set length(int value) { | 5999 void set length(int value) { |
5791 throw new UnsupportedError("Cannot resize immutable List."); | 6000 throw new UnsupportedError("Cannot resize immutable List."); |
5792 } | 6001 } |
5793 | 6002 |
5794 // contains() defined by IDL. | 6003 // contains() defined by IDL. |
5795 | 6004 |
5796 void sort([int compare(Transform a, Transform b)]) { | 6005 void sort([int compare(Transform a, Transform b)]) { |
5797 throw new UnsupportedError("Cannot sort immutable List."); | 6006 throw new UnsupportedError("Cannot sort immutable List."); |
5798 } | 6007 } |
5799 | 6008 |
5800 int indexOf(Transform element, [int start = 0]) => | 6009 int indexOf(Transform element, [int start = 0]) => |
5801 Lists.indexOf(this, element, start, this.length); | 6010 Lists.indexOf(this, element, start, this.length); |
5802 | 6011 |
5803 int lastIndexOf(Transform element, [int start]) { | 6012 int lastIndexOf(Transform element, [int start]) { |
5804 if (start == null) start = length - 1; | 6013 if (start == null) start = length - 1; |
5805 return Lists.lastIndexOf(this, element, start); | 6014 return Lists.lastIndexOf(this, element, start); |
5806 } | 6015 } |
5807 | 6016 |
5808 Transform get first => this[0]; | 6017 Transform get first { |
| 6018 if (this.length > 0) return this[0]; |
| 6019 throw new StateError("No elements"); |
| 6020 } |
5809 | 6021 |
5810 Transform get last => this[length - 1]; | 6022 Transform get last { |
| 6023 if (this.length > 0) return this[this.length - 1]; |
| 6024 throw new StateError("No elements"); |
| 6025 } |
| 6026 |
| 6027 Transform get single { |
| 6028 if (length == 1) return this[0]; |
| 6029 if (length == 0) throw new StateError("No elements"); |
| 6030 throw new StateError("More than one element"); |
| 6031 } |
| 6032 |
| 6033 Transform min([int compare(Transform a, Transform b)]) => _Collections.minInLi
st(this, compare); |
| 6034 |
| 6035 Transform max([int compare(Transform a, Transform b)]) => _Collections.maxInLi
st(this, compare); |
5811 | 6036 |
5812 Transform removeAt(int pos) { | 6037 Transform removeAt(int pos) { |
5813 throw new UnsupportedError("Cannot removeAt on immutable List."); | 6038 throw new UnsupportedError("Cannot removeAt on immutable List."); |
5814 } | 6039 } |
5815 | 6040 |
5816 Transform removeLast() { | 6041 Transform removeLast() { |
5817 throw new UnsupportedError("Cannot removeLast on immutable List."); | 6042 throw new UnsupportedError("Cannot removeLast on immutable List."); |
5818 } | 6043 } |
5819 | 6044 |
5820 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom
]) { | 6045 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom
]) { |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6145 ElementInstance operator[](int index) => JS("ElementInstance", "#[#]", this, i
ndex); | 6370 ElementInstance operator[](int index) => JS("ElementInstance", "#[#]", this, i
ndex); |
6146 | 6371 |
6147 void operator[]=(int index, ElementInstance value) { | 6372 void operator[]=(int index, ElementInstance value) { |
6148 throw new UnsupportedError("Cannot assign element of immutable List."); | 6373 throw new UnsupportedError("Cannot assign element of immutable List."); |
6149 } | 6374 } |
6150 // -- start List<ElementInstance> mixins. | 6375 // -- start List<ElementInstance> mixins. |
6151 // ElementInstance is the element type. | 6376 // ElementInstance is the element type. |
6152 | 6377 |
6153 // From Iterable<ElementInstance>: | 6378 // From Iterable<ElementInstance>: |
6154 | 6379 |
6155 Iterator<ElementInstance> iterator() { | 6380 Iterator<ElementInstance> get iterator { |
6156 // Note: NodeLists are not fixed size. And most probably length shouldn't | 6381 // Note: NodeLists are not fixed size. And most probably length shouldn't |
6157 // be cached in both iterator _and_ forEach method. For now caching it | 6382 // be cached in both iterator _and_ forEach method. For now caching it |
6158 // for consistency. | 6383 // for consistency. |
6159 return new FixedSizeListIterator<ElementInstance>(this); | 6384 return new FixedSizeListIterator<ElementInstance>(this); |
6160 } | 6385 } |
6161 | 6386 |
6162 // From Collection<ElementInstance>: | |
6163 | |
6164 void add(ElementInstance value) { | |
6165 throw new UnsupportedError("Cannot add to immutable List."); | |
6166 } | |
6167 | |
6168 void addLast(ElementInstance value) { | |
6169 throw new UnsupportedError("Cannot add to immutable List."); | |
6170 } | |
6171 | |
6172 void addAll(Collection<ElementInstance> collection) { | |
6173 throw new UnsupportedError("Cannot add to immutable List."); | |
6174 } | |
6175 | |
6176 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance)
) { | 6387 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance)
) { |
6177 return Collections.reduce(this, initialValue, combine); | 6388 return Collections.reduce(this, initialValue, combine); |
6178 } | 6389 } |
6179 | 6390 |
6180 bool contains(ElementInstance element) => Collections.contains(this, element); | 6391 bool contains(ElementInstance element) => Collections.contains(this, element); |
6181 | 6392 |
6182 void forEach(void f(ElementInstance element)) => Collections.forEach(this, f); | 6393 void forEach(void f(ElementInstance element)) => Collections.forEach(this, f); |
6183 | 6394 |
6184 Collection map(f(ElementInstance element)) => Collections.map(this, [], f); | 6395 String join([String separator]) => Collections.joinList(this, separator); |
6185 | 6396 |
6186 Collection<ElementInstance> filter(bool f(ElementInstance element)) => | 6397 List mappedBy(f(ElementInstance element)) => new MappedList<ElementInstance, d
ynamic>(this, f); |
6187 Collections.filter(this, <ElementInstance>[], f); | 6398 |
| 6399 Iterable<ElementInstance> where(bool f(ElementInstance element)) => new WhereI
terable<ElementInstance>(this, f); |
6188 | 6400 |
6189 bool every(bool f(ElementInstance element)) => Collections.every(this, f); | 6401 bool every(bool f(ElementInstance element)) => Collections.every(this, f); |
6190 | 6402 |
6191 bool some(bool f(ElementInstance element)) => Collections.some(this, f); | 6403 bool any(bool f(ElementInstance element)) => Collections.any(this, f); |
6192 | 6404 |
6193 bool get isEmpty => this.length == 0; | 6405 bool get isEmpty => this.length == 0; |
6194 | 6406 |
| 6407 List<ElementInstance> take(int n) => new ListView<ElementInstance>(this, 0, n)
; |
| 6408 |
| 6409 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) { |
| 6410 return new TakeWhileIterable<ElementInstance>(this, test); |
| 6411 } |
| 6412 |
| 6413 List<ElementInstance> skip(int n) => new ListView<ElementInstance>(this, n, nu
ll); |
| 6414 |
| 6415 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) { |
| 6416 return new SkipWhileIterable<ElementInstance>(this, test); |
| 6417 } |
| 6418 |
| 6419 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta
nce orElse() }) { |
| 6420 return Collections.firstMatching(this, test, orElse); |
| 6421 } |
| 6422 |
| 6423 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc
e orElse()}) { |
| 6424 return Collections.lastMatchingInList(this, test, orElse); |
| 6425 } |
| 6426 |
| 6427 ElementInstance singleMatching(bool test(ElementInstance value)) { |
| 6428 return Collections.singleMatching(this, test); |
| 6429 } |
| 6430 |
| 6431 ElementInstance elementAt(int index) { |
| 6432 return this[index]; |
| 6433 } |
| 6434 |
| 6435 // From Collection<ElementInstance>: |
| 6436 |
| 6437 void add(ElementInstance value) { |
| 6438 throw new UnsupportedError("Cannot add to immutable List."); |
| 6439 } |
| 6440 |
| 6441 void addLast(ElementInstance value) { |
| 6442 throw new UnsupportedError("Cannot add to immutable List."); |
| 6443 } |
| 6444 |
| 6445 void addAll(Iterable<ElementInstance> iterable) { |
| 6446 throw new UnsupportedError("Cannot add to immutable List."); |
| 6447 } |
| 6448 |
6195 // From List<ElementInstance>: | 6449 // From List<ElementInstance>: |
6196 void set length(int value) { | 6450 void set length(int value) { |
6197 throw new UnsupportedError("Cannot resize immutable List."); | 6451 throw new UnsupportedError("Cannot resize immutable List."); |
6198 } | 6452 } |
6199 | 6453 |
6200 void clear() { | 6454 void clear() { |
6201 throw new UnsupportedError("Cannot clear immutable List."); | 6455 throw new UnsupportedError("Cannot clear immutable List."); |
6202 } | 6456 } |
6203 | 6457 |
6204 void sort([int compare(ElementInstance a, ElementInstance b)]) { | 6458 void sort([int compare(ElementInstance a, ElementInstance b)]) { |
6205 throw new UnsupportedError("Cannot sort immutable List."); | 6459 throw new UnsupportedError("Cannot sort immutable List."); |
6206 } | 6460 } |
6207 | 6461 |
6208 int indexOf(ElementInstance element, [int start = 0]) => | 6462 int indexOf(ElementInstance element, [int start = 0]) => |
6209 Lists.indexOf(this, element, start, this.length); | 6463 Lists.indexOf(this, element, start, this.length); |
6210 | 6464 |
6211 int lastIndexOf(ElementInstance element, [int start]) { | 6465 int lastIndexOf(ElementInstance element, [int start]) { |
6212 if (start == null) start = length - 1; | 6466 if (start == null) start = length - 1; |
6213 return Lists.lastIndexOf(this, element, start); | 6467 return Lists.lastIndexOf(this, element, start); |
6214 } | 6468 } |
6215 | 6469 |
6216 ElementInstance get first => this[0]; | 6470 ElementInstance get first { |
| 6471 if (this.length > 0) return this[0]; |
| 6472 throw new StateError("No elements"); |
| 6473 } |
6217 | 6474 |
6218 ElementInstance get last => this[length - 1]; | 6475 ElementInstance get last { |
| 6476 if (this.length > 0) return this[this.length - 1]; |
| 6477 throw new StateError("No elements"); |
| 6478 } |
| 6479 |
| 6480 ElementInstance get single { |
| 6481 if (length == 1) return this[0]; |
| 6482 if (length == 0) throw new StateError("No elements"); |
| 6483 throw new StateError("More than one element"); |
| 6484 } |
| 6485 |
| 6486 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => _C
ollections.minInList(this, compare); |
| 6487 |
| 6488 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => _C
ollections.maxInList(this, compare); |
6219 | 6489 |
6220 ElementInstance removeAt(int pos) { | 6490 ElementInstance removeAt(int pos) { |
6221 throw new UnsupportedError("Cannot removeAt on immutable List."); | 6491 throw new UnsupportedError("Cannot removeAt on immutable List."); |
6222 } | 6492 } |
6223 | 6493 |
6224 ElementInstance removeLast() { | 6494 ElementInstance removeLast() { |
6225 throw new UnsupportedError("Cannot removeLast on immutable List."); | 6495 throw new UnsupportedError("Cannot removeLast on immutable List."); |
6226 } | 6496 } |
6227 | 6497 |
6228 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta
rtFrom]) { | 6498 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta
rtFrom]) { |
6229 throw new UnsupportedError("Cannot setRange on immutable List."); | 6499 throw new UnsupportedError("Cannot setRange on immutable List."); |
6230 } | 6500 } |
6231 | 6501 |
6232 void removeRange(int start, int rangeLength) { | 6502 void removeRange(int start, int rangeLength) { |
6233 throw new UnsupportedError("Cannot removeRange on immutable List."); | 6503 throw new UnsupportedError("Cannot removeRange on immutable List."); |
6234 } | 6504 } |
6235 | 6505 |
6236 void insertRange(int start, int rangeLength, [ElementInstance initialValue]) { | 6506 void insertRange(int start, int rangeLength, [ElementInstance initialValue]) { |
6237 throw new UnsupportedError("Cannot insertRange on immutable List."); | 6507 throw new UnsupportedError("Cannot insertRange on immutable List."); |
6238 } | 6508 } |
6239 | 6509 |
6240 List<ElementInstance> getRange(int start, int rangeLength) => | 6510 List<ElementInstance> getRange(int start, int rangeLength) => |
6241 Lists.getRange(this, start, rangeLength, <ElementInstance>[]); | 6511 Lists.getRange(this, start, rangeLength, <ElementInstance>[]); |
6242 | 6512 |
6243 // -- end List<ElementInstance> mixins. | 6513 // -- end List<ElementInstance> mixins. |
6244 | 6514 |
6245 /// @domName SVGElementInstanceList.item; @docsEditable true | 6515 /// @domName SVGElementInstanceList.item; @docsEditable true |
6246 ElementInstance item(int index) native; | 6516 ElementInstance item(int index) native; |
6247 } | 6517 } |
OLD | NEW |