Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: sdk/lib/svg/dart2js/svg_dart2js.dart

Issue 11971016: Create IterableMixinWorkaround and move most of the Collections methods there. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo (mappedByList instead of mappedBy). Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library svg; 1 library svg;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:html_common'; 6 import 'dart:html_common';
7 // DO NOT EDIT 7 // DO NOT EDIT
8 // Auto-generated dart:svg library. 8 // Auto-generated dart:svg library.
9 9
10 10
(...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 Iterator<Length> get iterator { 3077 Iterator<Length> get iterator {
3078 // Note: NodeLists are not fixed size. And most probably length shouldn't 3078 // Note: NodeLists are not fixed size. And most probably length shouldn't
3079 // be cached in both iterator _and_ forEach method. For now caching it 3079 // be cached in both iterator _and_ forEach method. For now caching it
3080 // for consistency. 3080 // for consistency.
3081 return new FixedSizeListIterator<Length>(this); 3081 return new FixedSizeListIterator<Length>(this);
3082 } 3082 }
3083 3083
3084 // SVG Collections expose numberOfItems rather than length. 3084 // SVG Collections expose numberOfItems rather than length.
3085 int get length => numberOfItems; 3085 int get length => numberOfItems;
3086 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) { 3086 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) {
3087 return Collections.reduce(this, initialValue, combine); 3087 return IterableMixinWorkaround.reduce(this, initialValue, combine);
3088 } 3088 }
3089 3089
3090 bool contains(Length element) => Collections.contains(this, element); 3090 bool contains(Length element) => IterableMixinWorkaround.contains(this, elemen t);
3091 3091
3092 void forEach(void f(Length element)) => Collections.forEach(this, f); 3092 void forEach(void f(Length element)) => IterableMixinWorkaround.forEach(this, f);
3093 3093
3094 String join([String separator]) => Collections.joinList(this, separator); 3094 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
3095 3095
3096 List mappedBy(f(Length element)) => new MappedList<Length, dynamic>(this, f); 3096 List mappedBy(f(Length element)) => IterableMixinWorkaround.mappedByList(this, f);
3097 3097
3098 Iterable<Length> where(bool f(Length element)) => new WhereIterable<Length>(th is, f); 3098 Iterable<Length> where(bool f(Length element)) => IterableMixinWorkaround.wher e(this, f);
3099 3099
3100 bool every(bool f(Length element)) => Collections.every(this, f); 3100 bool every(bool f(Length element)) => IterableMixinWorkaround.every(this, f);
3101 3101
3102 bool any(bool f(Length element)) => Collections.any(this, f); 3102 bool any(bool f(Length element)) => IterableMixinWorkaround.any(this, f);
3103 3103
3104 List<Length> toList() => new List<Length>.from(this); 3104 List<Length> toList() => new List<Length>.from(this);
3105 Set<Length> toSet() => new Set<Length>.from(this); 3105 Set<Length> toSet() => new Set<Length>.from(this);
3106 3106
3107 bool get isEmpty => this.length == 0; 3107 bool get isEmpty => this.length == 0;
3108 3108
3109 List<Length> take(int n) => new ListView<Length>(this, 0, n); 3109 List<Length> take(int n) => IterableMixinWorkaround.takeList(this, n);
3110 3110
3111 Iterable<Length> takeWhile(bool test(Length value)) { 3111 Iterable<Length> takeWhile(bool test(Length value)) {
3112 return new TakeWhileIterable<Length>(this, test); 3112 return IterableMixinWorkaround.takeWhile(this, test);
3113 } 3113 }
3114 3114
3115 List<Length> skip(int n) => new ListView<Length>(this, n, null); 3115 List<Length> skip(int n) => IterableMixinWorkaround.skipList(this, n);
3116 3116
3117 Iterable<Length> skipWhile(bool test(Length value)) { 3117 Iterable<Length> skipWhile(bool test(Length value)) {
3118 return new SkipWhileIterable<Length>(this, test); 3118 return IterableMixinWorkaround.skipWhile(this, test);
3119 } 3119 }
3120 3120
3121 Length firstMatching(bool test(Length value), { Length orElse() }) { 3121 Length firstMatching(bool test(Length value), { Length orElse() }) {
3122 return Collections.firstMatching(this, test, orElse); 3122 return IterableMixinWorkaround.firstMatching(this, test, orElse);
3123 } 3123 }
3124 3124
3125 Length lastMatching(bool test(Length value), {Length orElse()}) { 3125 Length lastMatching(bool test(Length value), {Length orElse()}) {
3126 return Collections.lastMatchingInList(this, test, orElse); 3126 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
3127 } 3127 }
3128 3128
3129 Length singleMatching(bool test(Length value)) { 3129 Length singleMatching(bool test(Length value)) {
3130 return Collections.singleMatching(this, test); 3130 return IterableMixinWorkaround.singleMatching(this, test);
3131 } 3131 }
3132 3132
3133 Length elementAt(int index) { 3133 Length elementAt(int index) {
3134 return this[index]; 3134 return this[index];
3135 } 3135 }
3136 3136
3137 // From Collection<Length>: 3137 // From Collection<Length>:
3138 3138
3139 void add(Length value) { 3139 void add(Length value) {
3140 throw new UnsupportedError("Cannot add to immutable List."); 3140 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 if (this.length > 0) return this[this.length - 1]; 3176 if (this.length > 0) return this[this.length - 1];
3177 throw new StateError("No elements"); 3177 throw new StateError("No elements");
3178 } 3178 }
3179 3179
3180 Length get single { 3180 Length get single {
3181 if (length == 1) return this[0]; 3181 if (length == 1) return this[0];
3182 if (length == 0) throw new StateError("No elements"); 3182 if (length == 0) throw new StateError("No elements");
3183 throw new StateError("More than one element"); 3183 throw new StateError("More than one element");
3184 } 3184 }
3185 3185
3186 Length min([int compare(Length a, Length b)]) => Collections.min(this, compare ); 3186 Length min([int compare(Length a, Length b)]) => IterableMixinWorkaround.min(t his, compare);
3187 3187
3188 Length max([int compare(Length a, Length b)]) => Collections.max(this, compare ); 3188 Length max([int compare(Length a, Length b)]) => IterableMixinWorkaround.max(t his, compare);
3189 3189
3190 Length removeAt(int pos) { 3190 Length removeAt(int pos) {
3191 throw new UnsupportedError("Cannot removeAt on immutable List."); 3191 throw new UnsupportedError("Cannot removeAt on immutable List.");
3192 } 3192 }
3193 3193
3194 Length removeLast() { 3194 Length removeLast() {
3195 throw new UnsupportedError("Cannot removeLast on immutable List."); 3195 throw new UnsupportedError("Cannot removeLast on immutable List.");
3196 } 3196 }
3197 3197
3198 void setRange(int start, int rangeLength, List<Length> from, [int startFrom]) { 3198 void setRange(int start, int rangeLength, List<Length> from, [int startFrom]) {
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
3665 Iterator<Number> get iterator { 3665 Iterator<Number> get iterator {
3666 // Note: NodeLists are not fixed size. And most probably length shouldn't 3666 // Note: NodeLists are not fixed size. And most probably length shouldn't
3667 // be cached in both iterator _and_ forEach method. For now caching it 3667 // be cached in both iterator _and_ forEach method. For now caching it
3668 // for consistency. 3668 // for consistency.
3669 return new FixedSizeListIterator<Number>(this); 3669 return new FixedSizeListIterator<Number>(this);
3670 } 3670 }
3671 3671
3672 // SVG Collections expose numberOfItems rather than length. 3672 // SVG Collections expose numberOfItems rather than length.
3673 int get length => numberOfItems; 3673 int get length => numberOfItems;
3674 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) { 3674 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) {
3675 return Collections.reduce(this, initialValue, combine); 3675 return IterableMixinWorkaround.reduce(this, initialValue, combine);
3676 } 3676 }
3677 3677
3678 bool contains(Number element) => Collections.contains(this, element); 3678 bool contains(Number element) => IterableMixinWorkaround.contains(this, elemen t);
3679 3679
3680 void forEach(void f(Number element)) => Collections.forEach(this, f); 3680 void forEach(void f(Number element)) => IterableMixinWorkaround.forEach(this, f);
3681 3681
3682 String join([String separator]) => Collections.joinList(this, separator); 3682 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
3683 3683
3684 List mappedBy(f(Number element)) => new MappedList<Number, dynamic>(this, f); 3684 List mappedBy(f(Number element)) => IterableMixinWorkaround.mappedByList(this, f);
3685 3685
3686 Iterable<Number> where(bool f(Number element)) => new WhereIterable<Number>(th is, f); 3686 Iterable<Number> where(bool f(Number element)) => IterableMixinWorkaround.wher e(this, f);
3687 3687
3688 bool every(bool f(Number element)) => Collections.every(this, f); 3688 bool every(bool f(Number element)) => IterableMixinWorkaround.every(this, f);
3689 3689
3690 bool any(bool f(Number element)) => Collections.any(this, f); 3690 bool any(bool f(Number element)) => IterableMixinWorkaround.any(this, f);
3691 3691
3692 List<Number> toList() => new List<Number>.from(this); 3692 List<Number> toList() => new List<Number>.from(this);
3693 Set<Number> toSet() => new Set<Number>.from(this); 3693 Set<Number> toSet() => new Set<Number>.from(this);
3694 3694
3695 bool get isEmpty => this.length == 0; 3695 bool get isEmpty => this.length == 0;
3696 3696
3697 List<Number> take(int n) => new ListView<Number>(this, 0, n); 3697 List<Number> take(int n) => IterableMixinWorkaround.takeList(this, n);
3698 3698
3699 Iterable<Number> takeWhile(bool test(Number value)) { 3699 Iterable<Number> takeWhile(bool test(Number value)) {
3700 return new TakeWhileIterable<Number>(this, test); 3700 return IterableMixinWorkaround.takeWhile(this, test);
3701 } 3701 }
3702 3702
3703 List<Number> skip(int n) => new ListView<Number>(this, n, null); 3703 List<Number> skip(int n) => IterableMixinWorkaround.skipList(this, n);
3704 3704
3705 Iterable<Number> skipWhile(bool test(Number value)) { 3705 Iterable<Number> skipWhile(bool test(Number value)) {
3706 return new SkipWhileIterable<Number>(this, test); 3706 return IterableMixinWorkaround.skipWhile(this, test);
3707 } 3707 }
3708 3708
3709 Number firstMatching(bool test(Number value), { Number orElse() }) { 3709 Number firstMatching(bool test(Number value), { Number orElse() }) {
3710 return Collections.firstMatching(this, test, orElse); 3710 return IterableMixinWorkaround.firstMatching(this, test, orElse);
3711 } 3711 }
3712 3712
3713 Number lastMatching(bool test(Number value), {Number orElse()}) { 3713 Number lastMatching(bool test(Number value), {Number orElse()}) {
3714 return Collections.lastMatchingInList(this, test, orElse); 3714 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
3715 } 3715 }
3716 3716
3717 Number singleMatching(bool test(Number value)) { 3717 Number singleMatching(bool test(Number value)) {
3718 return Collections.singleMatching(this, test); 3718 return IterableMixinWorkaround.singleMatching(this, test);
3719 } 3719 }
3720 3720
3721 Number elementAt(int index) { 3721 Number elementAt(int index) {
3722 return this[index]; 3722 return this[index];
3723 } 3723 }
3724 3724
3725 // From Collection<Number>: 3725 // From Collection<Number>:
3726 3726
3727 void add(Number value) { 3727 void add(Number value) {
3728 throw new UnsupportedError("Cannot add to immutable List."); 3728 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3764 if (this.length > 0) return this[this.length - 1]; 3764 if (this.length > 0) return this[this.length - 1];
3765 throw new StateError("No elements"); 3765 throw new StateError("No elements");
3766 } 3766 }
3767 3767
3768 Number get single { 3768 Number get single {
3769 if (length == 1) return this[0]; 3769 if (length == 1) return this[0];
3770 if (length == 0) throw new StateError("No elements"); 3770 if (length == 0) throw new StateError("No elements");
3771 throw new StateError("More than one element"); 3771 throw new StateError("More than one element");
3772 } 3772 }
3773 3773
3774 Number min([int compare(Number a, Number b)]) => Collections.min(this, compare ); 3774 Number min([int compare(Number a, Number b)]) => IterableMixinWorkaround.min(t his, compare);
3775 3775
3776 Number max([int compare(Number a, Number b)]) => Collections.max(this, compare ); 3776 Number max([int compare(Number a, Number b)]) => IterableMixinWorkaround.max(t his, compare);
3777 3777
3778 Number removeAt(int pos) { 3778 Number removeAt(int pos) {
3779 throw new UnsupportedError("Cannot removeAt on immutable List."); 3779 throw new UnsupportedError("Cannot removeAt on immutable List.");
3780 } 3780 }
3781 3781
3782 Number removeLast() { 3782 Number removeLast() {
3783 throw new UnsupportedError("Cannot removeLast on immutable List."); 3783 throw new UnsupportedError("Cannot removeLast on immutable List.");
3784 } 3784 }
3785 3785
3786 void setRange(int start, int rangeLength, List<Number> from, [int startFrom]) { 3786 void setRange(int start, int rangeLength, List<Number> from, [int startFrom]) {
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 Iterator<PathSeg> get iterator { 4455 Iterator<PathSeg> get iterator {
4456 // Note: NodeLists are not fixed size. And most probably length shouldn't 4456 // Note: NodeLists are not fixed size. And most probably length shouldn't
4457 // be cached in both iterator _and_ forEach method. For now caching it 4457 // be cached in both iterator _and_ forEach method. For now caching it
4458 // for consistency. 4458 // for consistency.
4459 return new FixedSizeListIterator<PathSeg>(this); 4459 return new FixedSizeListIterator<PathSeg>(this);
4460 } 4460 }
4461 4461
4462 // SVG Collections expose numberOfItems rather than length. 4462 // SVG Collections expose numberOfItems rather than length.
4463 int get length => numberOfItems; 4463 int get length => numberOfItems;
4464 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) { 4464 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) {
4465 return Collections.reduce(this, initialValue, combine); 4465 return IterableMixinWorkaround.reduce(this, initialValue, combine);
4466 } 4466 }
4467 4467
4468 bool contains(PathSeg element) => Collections.contains(this, element); 4468 bool contains(PathSeg element) => IterableMixinWorkaround.contains(this, eleme nt);
4469 4469
4470 void forEach(void f(PathSeg element)) => Collections.forEach(this, f); 4470 void forEach(void f(PathSeg element)) => IterableMixinWorkaround.forEach(this, f);
4471 4471
4472 String join([String separator]) => Collections.joinList(this, separator); 4472 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
4473 4473
4474 List mappedBy(f(PathSeg element)) => new MappedList<PathSeg, dynamic>(this, f) ; 4474 List mappedBy(f(PathSeg element)) => IterableMixinWorkaround.mappedByList(this , f);
4475 4475
4476 Iterable<PathSeg> where(bool f(PathSeg element)) => new WhereIterable<PathSeg> (this, f); 4476 Iterable<PathSeg> where(bool f(PathSeg element)) => IterableMixinWorkaround.wh ere(this, f);
4477 4477
4478 bool every(bool f(PathSeg element)) => Collections.every(this, f); 4478 bool every(bool f(PathSeg element)) => IterableMixinWorkaround.every(this, f);
4479 4479
4480 bool any(bool f(PathSeg element)) => Collections.any(this, f); 4480 bool any(bool f(PathSeg element)) => IterableMixinWorkaround.any(this, f);
4481 4481
4482 List<PathSeg> toList() => new List<PathSeg>.from(this); 4482 List<PathSeg> toList() => new List<PathSeg>.from(this);
4483 Set<PathSeg> toSet() => new Set<PathSeg>.from(this); 4483 Set<PathSeg> toSet() => new Set<PathSeg>.from(this);
4484 4484
4485 bool get isEmpty => this.length == 0; 4485 bool get isEmpty => this.length == 0;
4486 4486
4487 List<PathSeg> take(int n) => new ListView<PathSeg>(this, 0, n); 4487 List<PathSeg> take(int n) => IterableMixinWorkaround.takeList(this, n);
4488 4488
4489 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) { 4489 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) {
4490 return new TakeWhileIterable<PathSeg>(this, test); 4490 return IterableMixinWorkaround.takeWhile(this, test);
4491 } 4491 }
4492 4492
4493 List<PathSeg> skip(int n) => new ListView<PathSeg>(this, n, null); 4493 List<PathSeg> skip(int n) => IterableMixinWorkaround.skipList(this, n);
4494 4494
4495 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) { 4495 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) {
4496 return new SkipWhileIterable<PathSeg>(this, test); 4496 return IterableMixinWorkaround.skipWhile(this, test);
4497 } 4497 }
4498 4498
4499 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) { 4499 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) {
4500 return Collections.firstMatching(this, test, orElse); 4500 return IterableMixinWorkaround.firstMatching(this, test, orElse);
4501 } 4501 }
4502 4502
4503 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) { 4503 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) {
4504 return Collections.lastMatchingInList(this, test, orElse); 4504 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
4505 } 4505 }
4506 4506
4507 PathSeg singleMatching(bool test(PathSeg value)) { 4507 PathSeg singleMatching(bool test(PathSeg value)) {
4508 return Collections.singleMatching(this, test); 4508 return IterableMixinWorkaround.singleMatching(this, test);
4509 } 4509 }
4510 4510
4511 PathSeg elementAt(int index) { 4511 PathSeg elementAt(int index) {
4512 return this[index]; 4512 return this[index];
4513 } 4513 }
4514 4514
4515 // From Collection<PathSeg>: 4515 // From Collection<PathSeg>:
4516 4516
4517 void add(PathSeg value) { 4517 void add(PathSeg value) {
4518 throw new UnsupportedError("Cannot add to immutable List."); 4518 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4554 if (this.length > 0) return this[this.length - 1]; 4554 if (this.length > 0) return this[this.length - 1];
4555 throw new StateError("No elements"); 4555 throw new StateError("No elements");
4556 } 4556 }
4557 4557
4558 PathSeg get single { 4558 PathSeg get single {
4559 if (length == 1) return this[0]; 4559 if (length == 1) return this[0];
4560 if (length == 0) throw new StateError("No elements"); 4560 if (length == 0) throw new StateError("No elements");
4561 throw new StateError("More than one element"); 4561 throw new StateError("More than one element");
4562 } 4562 }
4563 4563
4564 PathSeg min([int compare(PathSeg a, PathSeg b)]) => Collections.min(this, comp are); 4564 PathSeg min([int compare(PathSeg a, PathSeg b)]) => IterableMixinWorkaround.mi n(this, compare);
4565 4565
4566 PathSeg max([int compare(PathSeg a, PathSeg b)]) => Collections.max(this, comp are); 4566 PathSeg max([int compare(PathSeg a, PathSeg b)]) => IterableMixinWorkaround.ma x(this, compare);
4567 4567
4568 PathSeg removeAt(int pos) { 4568 PathSeg removeAt(int pos) {
4569 throw new UnsupportedError("Cannot removeAt on immutable List."); 4569 throw new UnsupportedError("Cannot removeAt on immutable List.");
4570 } 4570 }
4571 4571
4572 PathSeg removeLast() { 4572 PathSeg removeLast() {
4573 throw new UnsupportedError("Cannot removeLast on immutable List."); 4573 throw new UnsupportedError("Cannot removeLast on immutable List.");
4574 } 4574 }
4575 4575
4576 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom]) { 4576 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom]) {
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
5256 Iterator<String> get iterator { 5256 Iterator<String> get iterator {
5257 // Note: NodeLists are not fixed size. And most probably length shouldn't 5257 // Note: NodeLists are not fixed size. And most probably length shouldn't
5258 // be cached in both iterator _and_ forEach method. For now caching it 5258 // be cached in both iterator _and_ forEach method. For now caching it
5259 // for consistency. 5259 // for consistency.
5260 return new FixedSizeListIterator<String>(this); 5260 return new FixedSizeListIterator<String>(this);
5261 } 5261 }
5262 5262
5263 // SVG Collections expose numberOfItems rather than length. 5263 // SVG Collections expose numberOfItems rather than length.
5264 int get length => numberOfItems; 5264 int get length => numberOfItems;
5265 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { 5265 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) {
5266 return Collections.reduce(this, initialValue, combine); 5266 return IterableMixinWorkaround.reduce(this, initialValue, combine);
5267 } 5267 }
5268 5268
5269 bool contains(String element) => Collections.contains(this, element); 5269 bool contains(String element) => IterableMixinWorkaround.contains(this, elemen t);
5270 5270
5271 void forEach(void f(String element)) => Collections.forEach(this, f); 5271 void forEach(void f(String element)) => IterableMixinWorkaround.forEach(this, f);
5272 5272
5273 String join([String separator]) => Collections.joinList(this, separator); 5273 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
5274 5274
5275 List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f); 5275 List mappedBy(f(String element)) => IterableMixinWorkaround.mappedByList(this, f);
5276 5276
5277 Iterable<String> where(bool f(String element)) => new WhereIterable<String>(th is, f); 5277 Iterable<String> where(bool f(String element)) => IterableMixinWorkaround.wher e(this, f);
5278 5278
5279 bool every(bool f(String element)) => Collections.every(this, f); 5279 bool every(bool f(String element)) => IterableMixinWorkaround.every(this, f);
5280 5280
5281 bool any(bool f(String element)) => Collections.any(this, f); 5281 bool any(bool f(String element)) => IterableMixinWorkaround.any(this, f);
5282 5282
5283 List<String> toList() => new List<String>.from(this); 5283 List<String> toList() => new List<String>.from(this);
5284 Set<String> toSet() => new Set<String>.from(this); 5284 Set<String> toSet() => new Set<String>.from(this);
5285 5285
5286 bool get isEmpty => this.length == 0; 5286 bool get isEmpty => this.length == 0;
5287 5287
5288 List<String> take(int n) => new ListView<String>(this, 0, n); 5288 List<String> take(int n) => IterableMixinWorkaround.takeList(this, n);
5289 5289
5290 Iterable<String> takeWhile(bool test(String value)) { 5290 Iterable<String> takeWhile(bool test(String value)) {
5291 return new TakeWhileIterable<String>(this, test); 5291 return IterableMixinWorkaround.takeWhile(this, test);
5292 } 5292 }
5293 5293
5294 List<String> skip(int n) => new ListView<String>(this, n, null); 5294 List<String> skip(int n) => IterableMixinWorkaround.skipList(this, n);
5295 5295
5296 Iterable<String> skipWhile(bool test(String value)) { 5296 Iterable<String> skipWhile(bool test(String value)) {
5297 return new SkipWhileIterable<String>(this, test); 5297 return IterableMixinWorkaround.skipWhile(this, test);
5298 } 5298 }
5299 5299
5300 String firstMatching(bool test(String value), { String orElse() }) { 5300 String firstMatching(bool test(String value), { String orElse() }) {
5301 return Collections.firstMatching(this, test, orElse); 5301 return IterableMixinWorkaround.firstMatching(this, test, orElse);
5302 } 5302 }
5303 5303
5304 String lastMatching(bool test(String value), {String orElse()}) { 5304 String lastMatching(bool test(String value), {String orElse()}) {
5305 return Collections.lastMatchingInList(this, test, orElse); 5305 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
5306 } 5306 }
5307 5307
5308 String singleMatching(bool test(String value)) { 5308 String singleMatching(bool test(String value)) {
5309 return Collections.singleMatching(this, test); 5309 return IterableMixinWorkaround.singleMatching(this, test);
5310 } 5310 }
5311 5311
5312 String elementAt(int index) { 5312 String elementAt(int index) {
5313 return this[index]; 5313 return this[index];
5314 } 5314 }
5315 5315
5316 // From Collection<String>: 5316 // From Collection<String>:
5317 5317
5318 void add(String value) { 5318 void add(String value) {
5319 throw new UnsupportedError("Cannot add to immutable List."); 5319 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5355 if (this.length > 0) return this[this.length - 1]; 5355 if (this.length > 0) return this[this.length - 1];
5356 throw new StateError("No elements"); 5356 throw new StateError("No elements");
5357 } 5357 }
5358 5358
5359 String get single { 5359 String get single {
5360 if (length == 1) return this[0]; 5360 if (length == 1) return this[0];
5361 if (length == 0) throw new StateError("No elements"); 5361 if (length == 0) throw new StateError("No elements");
5362 throw new StateError("More than one element"); 5362 throw new StateError("More than one element");
5363 } 5363 }
5364 5364
5365 String min([int compare(String a, String b)]) => Collections.min(this, compare ); 5365 String min([int compare(String a, String b)]) => IterableMixinWorkaround.min(t his, compare);
5366 5366
5367 String max([int compare(String a, String b)]) => Collections.max(this, compare ); 5367 String max([int compare(String a, String b)]) => IterableMixinWorkaround.max(t his, compare);
5368 5368
5369 String removeAt(int pos) { 5369 String removeAt(int pos) {
5370 throw new UnsupportedError("Cannot removeAt on immutable List."); 5370 throw new UnsupportedError("Cannot removeAt on immutable List.");
5371 } 5371 }
5372 5372
5373 String removeLast() { 5373 String removeLast() {
5374 throw new UnsupportedError("Cannot removeLast on immutable List."); 5374 throw new UnsupportedError("Cannot removeLast on immutable List.");
5375 } 5375 }
5376 5376
5377 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) { 5377 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) {
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
6319 Iterator<Transform> get iterator { 6319 Iterator<Transform> get iterator {
6320 // Note: NodeLists are not fixed size. And most probably length shouldn't 6320 // Note: NodeLists are not fixed size. And most probably length shouldn't
6321 // be cached in both iterator _and_ forEach method. For now caching it 6321 // be cached in both iterator _and_ forEach method. For now caching it
6322 // for consistency. 6322 // for consistency.
6323 return new FixedSizeListIterator<Transform>(this); 6323 return new FixedSizeListIterator<Transform>(this);
6324 } 6324 }
6325 6325
6326 // SVG Collections expose numberOfItems rather than length. 6326 // SVG Collections expose numberOfItems rather than length.
6327 int get length => numberOfItems; 6327 int get length => numberOfItems;
6328 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) { 6328 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) {
6329 return Collections.reduce(this, initialValue, combine); 6329 return IterableMixinWorkaround.reduce(this, initialValue, combine);
6330 } 6330 }
6331 6331
6332 bool contains(Transform element) => Collections.contains(this, element); 6332 bool contains(Transform element) => IterableMixinWorkaround.contains(this, ele ment);
6333 6333
6334 void forEach(void f(Transform element)) => Collections.forEach(this, f); 6334 void forEach(void f(Transform element)) => IterableMixinWorkaround.forEach(thi s, f);
6335 6335
6336 String join([String separator]) => Collections.joinList(this, separator); 6336 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
6337 6337
6338 List mappedBy(f(Transform element)) => new MappedList<Transform, dynamic>(this , f); 6338 List mappedBy(f(Transform element)) => IterableMixinWorkaround.mappedByList(th is, f);
6339 6339
6340 Iterable<Transform> where(bool f(Transform element)) => new WhereIterable<Tran sform>(this, f); 6340 Iterable<Transform> where(bool f(Transform element)) => IterableMixinWorkaroun d.where(this, f);
6341 6341
6342 bool every(bool f(Transform element)) => Collections.every(this, f); 6342 bool every(bool f(Transform element)) => IterableMixinWorkaround.every(this, f );
6343 6343
6344 bool any(bool f(Transform element)) => Collections.any(this, f); 6344 bool any(bool f(Transform element)) => IterableMixinWorkaround.any(this, f);
6345 6345
6346 List<Transform> toList() => new List<Transform>.from(this); 6346 List<Transform> toList() => new List<Transform>.from(this);
6347 Set<Transform> toSet() => new Set<Transform>.from(this); 6347 Set<Transform> toSet() => new Set<Transform>.from(this);
6348 6348
6349 bool get isEmpty => this.length == 0; 6349 bool get isEmpty => this.length == 0;
6350 6350
6351 List<Transform> take(int n) => new ListView<Transform>(this, 0, n); 6351 List<Transform> take(int n) => IterableMixinWorkaround.takeList(this, n);
6352 6352
6353 Iterable<Transform> takeWhile(bool test(Transform value)) { 6353 Iterable<Transform> takeWhile(bool test(Transform value)) {
6354 return new TakeWhileIterable<Transform>(this, test); 6354 return IterableMixinWorkaround.takeWhile(this, test);
6355 } 6355 }
6356 6356
6357 List<Transform> skip(int n) => new ListView<Transform>(this, n, null); 6357 List<Transform> skip(int n) => IterableMixinWorkaround.skipList(this, n);
6358 6358
6359 Iterable<Transform> skipWhile(bool test(Transform value)) { 6359 Iterable<Transform> skipWhile(bool test(Transform value)) {
6360 return new SkipWhileIterable<Transform>(this, test); 6360 return IterableMixinWorkaround.skipWhile(this, test);
6361 } 6361 }
6362 6362
6363 Transform firstMatching(bool test(Transform value), { Transform orElse() }) { 6363 Transform firstMatching(bool test(Transform value), { Transform orElse() }) {
6364 return Collections.firstMatching(this, test, orElse); 6364 return IterableMixinWorkaround.firstMatching(this, test, orElse);
6365 } 6365 }
6366 6366
6367 Transform lastMatching(bool test(Transform value), {Transform orElse()}) { 6367 Transform lastMatching(bool test(Transform value), {Transform orElse()}) {
6368 return Collections.lastMatchingInList(this, test, orElse); 6368 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
6369 } 6369 }
6370 6370
6371 Transform singleMatching(bool test(Transform value)) { 6371 Transform singleMatching(bool test(Transform value)) {
6372 return Collections.singleMatching(this, test); 6372 return IterableMixinWorkaround.singleMatching(this, test);
6373 } 6373 }
6374 6374
6375 Transform elementAt(int index) { 6375 Transform elementAt(int index) {
6376 return this[index]; 6376 return this[index];
6377 } 6377 }
6378 6378
6379 // From Collection<Transform>: 6379 // From Collection<Transform>:
6380 6380
6381 void add(Transform value) { 6381 void add(Transform value) {
6382 throw new UnsupportedError("Cannot add to immutable List."); 6382 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6418 if (this.length > 0) return this[this.length - 1]; 6418 if (this.length > 0) return this[this.length - 1];
6419 throw new StateError("No elements"); 6419 throw new StateError("No elements");
6420 } 6420 }
6421 6421
6422 Transform get single { 6422 Transform get single {
6423 if (length == 1) return this[0]; 6423 if (length == 1) return this[0];
6424 if (length == 0) throw new StateError("No elements"); 6424 if (length == 0) throw new StateError("No elements");
6425 throw new StateError("More than one element"); 6425 throw new StateError("More than one element");
6426 } 6426 }
6427 6427
6428 Transform min([int compare(Transform a, Transform b)]) => Collections.min(this , compare); 6428 Transform min([int compare(Transform a, Transform b)]) => IterableMixinWorkaro und.min(this, compare);
6429 6429
6430 Transform max([int compare(Transform a, Transform b)]) => Collections.max(this , compare); 6430 Transform max([int compare(Transform a, Transform b)]) => IterableMixinWorkaro und.max(this, compare);
6431 6431
6432 Transform removeAt(int pos) { 6432 Transform removeAt(int pos) {
6433 throw new UnsupportedError("Cannot removeAt on immutable List."); 6433 throw new UnsupportedError("Cannot removeAt on immutable List.");
6434 } 6434 }
6435 6435
6436 Transform removeLast() { 6436 Transform removeLast() {
6437 throw new UnsupportedError("Cannot removeLast on immutable List."); 6437 throw new UnsupportedError("Cannot removeLast on immutable List.");
6438 } 6438 }
6439 6439
6440 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom ]) { 6440 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom ]) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
6785 // From Iterable<ElementInstance>: 6785 // From Iterable<ElementInstance>:
6786 6786
6787 Iterator<ElementInstance> get iterator { 6787 Iterator<ElementInstance> get iterator {
6788 // Note: NodeLists are not fixed size. And most probably length shouldn't 6788 // Note: NodeLists are not fixed size. And most probably length shouldn't
6789 // be cached in both iterator _and_ forEach method. For now caching it 6789 // be cached in both iterator _and_ forEach method. For now caching it
6790 // for consistency. 6790 // for consistency.
6791 return new FixedSizeListIterator<ElementInstance>(this); 6791 return new FixedSizeListIterator<ElementInstance>(this);
6792 } 6792 }
6793 6793
6794 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance) ) { 6794 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance) ) {
6795 return Collections.reduce(this, initialValue, combine); 6795 return IterableMixinWorkaround.reduce(this, initialValue, combine);
6796 } 6796 }
6797 6797
6798 bool contains(ElementInstance element) => Collections.contains(this, element); 6798 bool contains(ElementInstance element) => IterableMixinWorkaround.contains(thi s, element);
6799 6799
6800 void forEach(void f(ElementInstance element)) => Collections.forEach(this, f); 6800 void forEach(void f(ElementInstance element)) => IterableMixinWorkaround.forEa ch(this, f);
6801 6801
6802 String join([String separator]) => Collections.joinList(this, separator); 6802 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
6803 6803
6804 List mappedBy(f(ElementInstance element)) => new MappedList<ElementInstance, d ynamic>(this, f); 6804 List mappedBy(f(ElementInstance element)) => IterableMixinWorkaround.mappedByL ist(this, f);
6805 6805
6806 Iterable<ElementInstance> where(bool f(ElementInstance element)) => new WhereI terable<ElementInstance>(this, f); 6806 Iterable<ElementInstance> where(bool f(ElementInstance element)) => IterableMi xinWorkaround.where(this, f);
6807 6807
6808 bool every(bool f(ElementInstance element)) => Collections.every(this, f); 6808 bool every(bool f(ElementInstance element)) => IterableMixinWorkaround.every(t his, f);
6809 6809
6810 bool any(bool f(ElementInstance element)) => Collections.any(this, f); 6810 bool any(bool f(ElementInstance element)) => IterableMixinWorkaround.any(this, f);
6811 6811
6812 List<ElementInstance> toList() => new List<ElementInstance>.from(this); 6812 List<ElementInstance> toList() => new List<ElementInstance>.from(this);
6813 Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this); 6813 Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this);
6814 6814
6815 bool get isEmpty => this.length == 0; 6815 bool get isEmpty => this.length == 0;
6816 6816
6817 List<ElementInstance> take(int n) => new ListView<ElementInstance>(this, 0, n) ; 6817 List<ElementInstance> take(int n) => IterableMixinWorkaround.takeList(this, n) ;
6818 6818
6819 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) { 6819 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) {
6820 return new TakeWhileIterable<ElementInstance>(this, test); 6820 return IterableMixinWorkaround.takeWhile(this, test);
6821 } 6821 }
6822 6822
6823 List<ElementInstance> skip(int n) => new ListView<ElementInstance>(this, n, nu ll); 6823 List<ElementInstance> skip(int n) => IterableMixinWorkaround.skipList(this, n) ;
6824 6824
6825 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) { 6825 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) {
6826 return new SkipWhileIterable<ElementInstance>(this, test); 6826 return IterableMixinWorkaround.skipWhile(this, test);
6827 } 6827 }
6828 6828
6829 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta nce orElse() }) { 6829 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta nce orElse() }) {
6830 return Collections.firstMatching(this, test, orElse); 6830 return IterableMixinWorkaround.firstMatching(this, test, orElse);
6831 } 6831 }
6832 6832
6833 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc e orElse()}) { 6833 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc e orElse()}) {
6834 return Collections.lastMatchingInList(this, test, orElse); 6834 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
6835 } 6835 }
6836 6836
6837 ElementInstance singleMatching(bool test(ElementInstance value)) { 6837 ElementInstance singleMatching(bool test(ElementInstance value)) {
6838 return Collections.singleMatching(this, test); 6838 return IterableMixinWorkaround.singleMatching(this, test);
6839 } 6839 }
6840 6840
6841 ElementInstance elementAt(int index) { 6841 ElementInstance elementAt(int index) {
6842 return this[index]; 6842 return this[index];
6843 } 6843 }
6844 6844
6845 // From Collection<ElementInstance>: 6845 // From Collection<ElementInstance>:
6846 6846
6847 void add(ElementInstance value) { 6847 void add(ElementInstance value) {
6848 throw new UnsupportedError("Cannot add to immutable List."); 6848 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
6886 if (this.length > 0) return this[this.length - 1]; 6886 if (this.length > 0) return this[this.length - 1];
6887 throw new StateError("No elements"); 6887 throw new StateError("No elements");
6888 } 6888 }
6889 6889
6890 ElementInstance get single { 6890 ElementInstance get single {
6891 if (length == 1) return this[0]; 6891 if (length == 1) return this[0];
6892 if (length == 0) throw new StateError("No elements"); 6892 if (length == 0) throw new StateError("No elements");
6893 throw new StateError("More than one element"); 6893 throw new StateError("More than one element");
6894 } 6894 }
6895 6895
6896 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => Co llections.min(this, compare); 6896 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => It erableMixinWorkaround.min(this, compare);
6897 6897
6898 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => Co llections.max(this, compare); 6898 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => It erableMixinWorkaround.max(this, compare);
6899 6899
6900 ElementInstance removeAt(int pos) { 6900 ElementInstance removeAt(int pos) {
6901 throw new UnsupportedError("Cannot removeAt on immutable List."); 6901 throw new UnsupportedError("Cannot removeAt on immutable List.");
6902 } 6902 }
6903 6903
6904 ElementInstance removeLast() { 6904 ElementInstance removeLast() {
6905 throw new UnsupportedError("Cannot removeLast on immutable List."); 6905 throw new UnsupportedError("Cannot removeLast on immutable List.");
6906 } 6906 }
6907 6907
6908 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta rtFrom]) { 6908 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta rtFrom]) {
6909 throw new UnsupportedError("Cannot setRange on immutable List."); 6909 throw new UnsupportedError("Cannot setRange on immutable List.");
6910 } 6910 }
6911 6911
6912 void removeRange(int start, int rangeLength) { 6912 void removeRange(int start, int rangeLength) {
6913 throw new UnsupportedError("Cannot removeRange on immutable List."); 6913 throw new UnsupportedError("Cannot removeRange on immutable List.");
6914 } 6914 }
6915 6915
6916 void insertRange(int start, int rangeLength, [ElementInstance initialValue]) { 6916 void insertRange(int start, int rangeLength, [ElementInstance initialValue]) {
6917 throw new UnsupportedError("Cannot insertRange on immutable List."); 6917 throw new UnsupportedError("Cannot insertRange on immutable List.");
6918 } 6918 }
6919 6919
6920 List<ElementInstance> getRange(int start, int rangeLength) => 6920 List<ElementInstance> getRange(int start, int rangeLength) =>
6921 Lists.getRange(this, start, rangeLength, <ElementInstance>[]); 6921 Lists.getRange(this, start, rangeLength, <ElementInstance>[]);
6922 6922
6923 // -- end List<ElementInstance> mixins. 6923 // -- end List<ElementInstance> mixins.
6924 6924
6925 @DocsEditable @DomName('SVGElementInstanceList.item') 6925 @DocsEditable @DomName('SVGElementInstanceList.item')
6926 ElementInstance item(int index) native; 6926 ElementInstance item(int index) native;
6927 } 6927 }
OLDNEW
« no previous file with comments | « sdk/lib/html/html_common/filtered_element_list.dart ('k') | sdk/lib/svg/dartium/svg_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698