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

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: 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 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 Iterator<Length> get iterator { 2961 Iterator<Length> get iterator {
2962 // Note: NodeLists are not fixed size. And most probably length shouldn't 2962 // Note: NodeLists are not fixed size. And most probably length shouldn't
2963 // be cached in both iterator _and_ forEach method. For now caching it 2963 // be cached in both iterator _and_ forEach method. For now caching it
2964 // for consistency. 2964 // for consistency.
2965 return new FixedSizeListIterator<Length>(this); 2965 return new FixedSizeListIterator<Length>(this);
2966 } 2966 }
2967 2967
2968 // SVG Collections expose numberOfItems rather than length. 2968 // SVG Collections expose numberOfItems rather than length.
2969 int get length => numberOfItems; 2969 int get length => numberOfItems;
2970 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) { 2970 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) {
2971 return Collections.reduce(this, initialValue, combine); 2971 return IterableMixinWorkaround.reduce(this, initialValue, combine);
2972 } 2972 }
2973 2973
2974 bool contains(Length element) => Collections.contains(this, element); 2974 bool contains(Length element) => IterableMixinWorkaround.contains(this, elemen t);
2975 2975
2976 void forEach(void f(Length element)) => Collections.forEach(this, f); 2976 void forEach(void f(Length element)) => IterableMixinWorkaround.forEach(this, f);
2977 2977
2978 String join([String separator]) => Collections.joinList(this, separator); 2978 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
2979 2979
2980 List mappedBy(f(Length element)) => new MappedList<Length, dynamic>(this, f); 2980 List mappedBy(f(Length element)) => IterableMixinWorkaround.mappedByList(this, f);
2981 2981
2982 Iterable<Length> where(bool f(Length element)) => new WhereIterable<Length>(th is, f); 2982 Iterable<Length> where(bool f(Length element)) => IterableMixinWorkaround.wher e(this, f);
2983 2983
2984 bool every(bool f(Length element)) => Collections.every(this, f); 2984 bool every(bool f(Length element)) => IterableMixinWorkaround.every(this, f);
2985 2985
2986 bool any(bool f(Length element)) => Collections.any(this, f); 2986 bool any(bool f(Length element)) => IterableMixinWorkaround.any(this, f);
2987 2987
2988 List<Length> toList() => new List<Length>.from(this); 2988 List<Length> toList() => new List<Length>.from(this);
2989 Set<Length> toSet() => new Set<Length>.from(this); 2989 Set<Length> toSet() => new Set<Length>.from(this);
2990 2990
2991 bool get isEmpty => this.length == 0; 2991 bool get isEmpty => this.length == 0;
2992 2992
2993 List<Length> take(int n) => new ListView<Length>(this, 0, n); 2993 List<Length> take(int n) => IterableMixinWorkaround.takeList(this, n);
2994 2994
2995 Iterable<Length> takeWhile(bool test(Length value)) { 2995 Iterable<Length> takeWhile(bool test(Length value)) {
2996 return new TakeWhileIterable<Length>(this, test); 2996 return IterableMixinWorkaround.takeWhile(this, test);
2997 } 2997 }
2998 2998
2999 List<Length> skip(int n) => new ListView<Length>(this, n, null); 2999 List<Length> skip(int n) => IterableMixinWorkaround.skipList(this, n);
3000 3000
3001 Iterable<Length> skipWhile(bool test(Length value)) { 3001 Iterable<Length> skipWhile(bool test(Length value)) {
3002 return new SkipWhileIterable<Length>(this, test); 3002 return IterableMixinWorkaround.skipWhile(this, test);
3003 } 3003 }
3004 3004
3005 Length firstMatching(bool test(Length value), { Length orElse() }) { 3005 Length firstMatching(bool test(Length value), { Length orElse() }) {
3006 return Collections.firstMatching(this, test, orElse); 3006 return IterableMixinWorkaround.firstMatching(this, test, orElse);
3007 } 3007 }
3008 3008
3009 Length lastMatching(bool test(Length value), {Length orElse()}) { 3009 Length lastMatching(bool test(Length value), {Length orElse()}) {
3010 return Collections.lastMatchingInList(this, test, orElse); 3010 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
3011 } 3011 }
3012 3012
3013 Length singleMatching(bool test(Length value)) { 3013 Length singleMatching(bool test(Length value)) {
3014 return Collections.singleMatching(this, test); 3014 return IterableMixinWorkaround.singleMatching(this, test);
3015 } 3015 }
3016 3016
3017 Length elementAt(int index) { 3017 Length elementAt(int index) {
3018 return this[index]; 3018 return this[index];
3019 } 3019 }
3020 3020
3021 // From Collection<Length>: 3021 // From Collection<Length>:
3022 3022
3023 void add(Length value) { 3023 void add(Length value) {
3024 throw new UnsupportedError("Cannot add to immutable List."); 3024 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3060 if (this.length > 0) return this[this.length - 1]; 3060 if (this.length > 0) return this[this.length - 1];
3061 throw new StateError("No elements"); 3061 throw new StateError("No elements");
3062 } 3062 }
3063 3063
3064 Length get single { 3064 Length get single {
3065 if (length == 1) return this[0]; 3065 if (length == 1) return this[0];
3066 if (length == 0) throw new StateError("No elements"); 3066 if (length == 0) throw new StateError("No elements");
3067 throw new StateError("More than one element"); 3067 throw new StateError("More than one element");
3068 } 3068 }
3069 3069
3070 Length min([int compare(Length a, Length b)]) => Collections.min(this, compare ); 3070 Length min([int compare(Length a, Length b)]) => IterableMixinWorkaround.min(t his, compare);
3071 3071
3072 Length max([int compare(Length a, Length b)]) => Collections.max(this, compare ); 3072 Length max([int compare(Length a, Length b)]) => IterableMixinWorkaround.max(t his, compare);
3073 3073
3074 Length removeAt(int pos) { 3074 Length removeAt(int pos) {
3075 throw new UnsupportedError("Cannot removeAt on immutable List."); 3075 throw new UnsupportedError("Cannot removeAt on immutable List.");
3076 } 3076 }
3077 3077
3078 Length removeLast() { 3078 Length removeLast() {
3079 throw new UnsupportedError("Cannot removeLast on immutable List."); 3079 throw new UnsupportedError("Cannot removeLast on immutable List.");
3080 } 3080 }
3081 3081
3082 void setRange(int start, int rangeLength, List<Length> from, [int startFrom]) { 3082 void setRange(int start, int rangeLength, List<Length> from, [int startFrom]) {
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
3535 Iterator<Number> get iterator { 3535 Iterator<Number> get iterator {
3536 // Note: NodeLists are not fixed size. And most probably length shouldn't 3536 // Note: NodeLists are not fixed size. And most probably length shouldn't
3537 // be cached in both iterator _and_ forEach method. For now caching it 3537 // be cached in both iterator _and_ forEach method. For now caching it
3538 // for consistency. 3538 // for consistency.
3539 return new FixedSizeListIterator<Number>(this); 3539 return new FixedSizeListIterator<Number>(this);
3540 } 3540 }
3541 3541
3542 // SVG Collections expose numberOfItems rather than length. 3542 // SVG Collections expose numberOfItems rather than length.
3543 int get length => numberOfItems; 3543 int get length => numberOfItems;
3544 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) { 3544 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) {
3545 return Collections.reduce(this, initialValue, combine); 3545 return IterableMixinWorkaround.reduce(this, initialValue, combine);
3546 } 3546 }
3547 3547
3548 bool contains(Number element) => Collections.contains(this, element); 3548 bool contains(Number element) => IterableMixinWorkaround.contains(this, elemen t);
3549 3549
3550 void forEach(void f(Number element)) => Collections.forEach(this, f); 3550 void forEach(void f(Number element)) => IterableMixinWorkaround.forEach(this, f);
3551 3551
3552 String join([String separator]) => Collections.joinList(this, separator); 3552 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
3553 3553
3554 List mappedBy(f(Number element)) => new MappedList<Number, dynamic>(this, f); 3554 List mappedBy(f(Number element)) => IterableMixinWorkaround.mappedByList(this, f);
3555 3555
3556 Iterable<Number> where(bool f(Number element)) => new WhereIterable<Number>(th is, f); 3556 Iterable<Number> where(bool f(Number element)) => IterableMixinWorkaround.wher e(this, f);
3557 3557
3558 bool every(bool f(Number element)) => Collections.every(this, f); 3558 bool every(bool f(Number element)) => IterableMixinWorkaround.every(this, f);
3559 3559
3560 bool any(bool f(Number element)) => Collections.any(this, f); 3560 bool any(bool f(Number element)) => IterableMixinWorkaround.any(this, f);
3561 3561
3562 List<Number> toList() => new List<Number>.from(this); 3562 List<Number> toList() => new List<Number>.from(this);
3563 Set<Number> toSet() => new Set<Number>.from(this); 3563 Set<Number> toSet() => new Set<Number>.from(this);
3564 3564
3565 bool get isEmpty => this.length == 0; 3565 bool get isEmpty => this.length == 0;
3566 3566
3567 List<Number> take(int n) => new ListView<Number>(this, 0, n); 3567 List<Number> take(int n) => IterableMixinWorkaround.takeList(this, n);
3568 3568
3569 Iterable<Number> takeWhile(bool test(Number value)) { 3569 Iterable<Number> takeWhile(bool test(Number value)) {
3570 return new TakeWhileIterable<Number>(this, test); 3570 return IterableMixinWorkaround.takeWhile(this, test);
3571 } 3571 }
3572 3572
3573 List<Number> skip(int n) => new ListView<Number>(this, n, null); 3573 List<Number> skip(int n) => IterableMixinWorkaround.skipList(this, n);
3574 3574
3575 Iterable<Number> skipWhile(bool test(Number value)) { 3575 Iterable<Number> skipWhile(bool test(Number value)) {
3576 return new SkipWhileIterable<Number>(this, test); 3576 return IterableMixinWorkaround.skipWhile(this, test);
3577 } 3577 }
3578 3578
3579 Number firstMatching(bool test(Number value), { Number orElse() }) { 3579 Number firstMatching(bool test(Number value), { Number orElse() }) {
3580 return Collections.firstMatching(this, test, orElse); 3580 return IterableMixinWorkaround.firstMatching(this, test, orElse);
3581 } 3581 }
3582 3582
3583 Number lastMatching(bool test(Number value), {Number orElse()}) { 3583 Number lastMatching(bool test(Number value), {Number orElse()}) {
3584 return Collections.lastMatchingInList(this, test, orElse); 3584 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
3585 } 3585 }
3586 3586
3587 Number singleMatching(bool test(Number value)) { 3587 Number singleMatching(bool test(Number value)) {
3588 return Collections.singleMatching(this, test); 3588 return IterableMixinWorkaround.singleMatching(this, test);
3589 } 3589 }
3590 3590
3591 Number elementAt(int index) { 3591 Number elementAt(int index) {
3592 return this[index]; 3592 return this[index];
3593 } 3593 }
3594 3594
3595 // From Collection<Number>: 3595 // From Collection<Number>:
3596 3596
3597 void add(Number value) { 3597 void add(Number value) {
3598 throw new UnsupportedError("Cannot add to immutable List."); 3598 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3634 if (this.length > 0) return this[this.length - 1]; 3634 if (this.length > 0) return this[this.length - 1];
3635 throw new StateError("No elements"); 3635 throw new StateError("No elements");
3636 } 3636 }
3637 3637
3638 Number get single { 3638 Number get single {
3639 if (length == 1) return this[0]; 3639 if (length == 1) return this[0];
3640 if (length == 0) throw new StateError("No elements"); 3640 if (length == 0) throw new StateError("No elements");
3641 throw new StateError("More than one element"); 3641 throw new StateError("More than one element");
3642 } 3642 }
3643 3643
3644 Number min([int compare(Number a, Number b)]) => Collections.min(this, compare ); 3644 Number min([int compare(Number a, Number b)]) => IterableMixinWorkaround.min(t his, compare);
3645 3645
3646 Number max([int compare(Number a, Number b)]) => Collections.max(this, compare ); 3646 Number max([int compare(Number a, Number b)]) => IterableMixinWorkaround.max(t his, compare);
3647 3647
3648 Number removeAt(int pos) { 3648 Number removeAt(int pos) {
3649 throw new UnsupportedError("Cannot removeAt on immutable List."); 3649 throw new UnsupportedError("Cannot removeAt on immutable List.");
3650 } 3650 }
3651 3651
3652 Number removeLast() { 3652 Number removeLast() {
3653 throw new UnsupportedError("Cannot removeLast on immutable List."); 3653 throw new UnsupportedError("Cannot removeLast on immutable List.");
3654 } 3654 }
3655 3655
3656 void setRange(int start, int rangeLength, List<Number> from, [int startFrom]) { 3656 void setRange(int start, int rangeLength, List<Number> from, [int startFrom]) {
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
4284 Iterator<PathSeg> get iterator { 4284 Iterator<PathSeg> get iterator {
4285 // Note: NodeLists are not fixed size. And most probably length shouldn't 4285 // Note: NodeLists are not fixed size. And most probably length shouldn't
4286 // be cached in both iterator _and_ forEach method. For now caching it 4286 // be cached in both iterator _and_ forEach method. For now caching it
4287 // for consistency. 4287 // for consistency.
4288 return new FixedSizeListIterator<PathSeg>(this); 4288 return new FixedSizeListIterator<PathSeg>(this);
4289 } 4289 }
4290 4290
4291 // SVG Collections expose numberOfItems rather than length. 4291 // SVG Collections expose numberOfItems rather than length.
4292 int get length => numberOfItems; 4292 int get length => numberOfItems;
4293 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) { 4293 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) {
4294 return Collections.reduce(this, initialValue, combine); 4294 return IterableMixinWorkaround.reduce(this, initialValue, combine);
4295 } 4295 }
4296 4296
4297 bool contains(PathSeg element) => Collections.contains(this, element); 4297 bool contains(PathSeg element) => IterableMixinWorkaround.contains(this, eleme nt);
4298 4298
4299 void forEach(void f(PathSeg element)) => Collections.forEach(this, f); 4299 void forEach(void f(PathSeg element)) => IterableMixinWorkaround.forEach(this, f);
4300 4300
4301 String join([String separator]) => Collections.joinList(this, separator); 4301 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
4302 4302
4303 List mappedBy(f(PathSeg element)) => new MappedList<PathSeg, dynamic>(this, f) ; 4303 List mappedBy(f(PathSeg element)) => IterableMixinWorkaround.mappedByList(this , f);
4304 4304
4305 Iterable<PathSeg> where(bool f(PathSeg element)) => new WhereIterable<PathSeg> (this, f); 4305 Iterable<PathSeg> where(bool f(PathSeg element)) => IterableMixinWorkaround.wh ere(this, f);
4306 4306
4307 bool every(bool f(PathSeg element)) => Collections.every(this, f); 4307 bool every(bool f(PathSeg element)) => IterableMixinWorkaround.every(this, f);
4308 4308
4309 bool any(bool f(PathSeg element)) => Collections.any(this, f); 4309 bool any(bool f(PathSeg element)) => IterableMixinWorkaround.any(this, f);
4310 4310
4311 List<PathSeg> toList() => new List<PathSeg>.from(this); 4311 List<PathSeg> toList() => new List<PathSeg>.from(this);
4312 Set<PathSeg> toSet() => new Set<PathSeg>.from(this); 4312 Set<PathSeg> toSet() => new Set<PathSeg>.from(this);
4313 4313
4314 bool get isEmpty => this.length == 0; 4314 bool get isEmpty => this.length == 0;
4315 4315
4316 List<PathSeg> take(int n) => new ListView<PathSeg>(this, 0, n); 4316 List<PathSeg> take(int n) => IterableMixinWorkaround.takeList(this, n);
4317 4317
4318 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) { 4318 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) {
4319 return new TakeWhileIterable<PathSeg>(this, test); 4319 return IterableMixinWorkaround.takeWhile(this, test);
4320 } 4320 }
4321 4321
4322 List<PathSeg> skip(int n) => new ListView<PathSeg>(this, n, null); 4322 List<PathSeg> skip(int n) => IterableMixinWorkaround.skipList(this, n);
4323 4323
4324 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) { 4324 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) {
4325 return new SkipWhileIterable<PathSeg>(this, test); 4325 return IterableMixinWorkaround.skipWhile(this, test);
4326 } 4326 }
4327 4327
4328 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) { 4328 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) {
4329 return Collections.firstMatching(this, test, orElse); 4329 return IterableMixinWorkaround.firstMatching(this, test, orElse);
4330 } 4330 }
4331 4331
4332 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) { 4332 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) {
4333 return Collections.lastMatchingInList(this, test, orElse); 4333 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
4334 } 4334 }
4335 4335
4336 PathSeg singleMatching(bool test(PathSeg value)) { 4336 PathSeg singleMatching(bool test(PathSeg value)) {
4337 return Collections.singleMatching(this, test); 4337 return IterableMixinWorkaround.singleMatching(this, test);
4338 } 4338 }
4339 4339
4340 PathSeg elementAt(int index) { 4340 PathSeg elementAt(int index) {
4341 return this[index]; 4341 return this[index];
4342 } 4342 }
4343 4343
4344 // From Collection<PathSeg>: 4344 // From Collection<PathSeg>:
4345 4345
4346 void add(PathSeg value) { 4346 void add(PathSeg value) {
4347 throw new UnsupportedError("Cannot add to immutable List."); 4347 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4383 if (this.length > 0) return this[this.length - 1]; 4383 if (this.length > 0) return this[this.length - 1];
4384 throw new StateError("No elements"); 4384 throw new StateError("No elements");
4385 } 4385 }
4386 4386
4387 PathSeg get single { 4387 PathSeg get single {
4388 if (length == 1) return this[0]; 4388 if (length == 1) return this[0];
4389 if (length == 0) throw new StateError("No elements"); 4389 if (length == 0) throw new StateError("No elements");
4390 throw new StateError("More than one element"); 4390 throw new StateError("More than one element");
4391 } 4391 }
4392 4392
4393 PathSeg min([int compare(PathSeg a, PathSeg b)]) => Collections.min(this, comp are); 4393 PathSeg min([int compare(PathSeg a, PathSeg b)]) => IterableMixinWorkaround.mi n(this, compare);
4394 4394
4395 PathSeg max([int compare(PathSeg a, PathSeg b)]) => Collections.max(this, comp are); 4395 PathSeg max([int compare(PathSeg a, PathSeg b)]) => IterableMixinWorkaround.ma x(this, compare);
4396 4396
4397 PathSeg removeAt(int pos) { 4397 PathSeg removeAt(int pos) {
4398 throw new UnsupportedError("Cannot removeAt on immutable List."); 4398 throw new UnsupportedError("Cannot removeAt on immutable List.");
4399 } 4399 }
4400 4400
4401 PathSeg removeLast() { 4401 PathSeg removeLast() {
4402 throw new UnsupportedError("Cannot removeLast on immutable List."); 4402 throw new UnsupportedError("Cannot removeLast on immutable List.");
4403 } 4403 }
4404 4404
4405 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom]) { 4405 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom]) {
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
5058 Iterator<String> get iterator { 5058 Iterator<String> get iterator {
5059 // Note: NodeLists are not fixed size. And most probably length shouldn't 5059 // Note: NodeLists are not fixed size. And most probably length shouldn't
5060 // be cached in both iterator _and_ forEach method. For now caching it 5060 // be cached in both iterator _and_ forEach method. For now caching it
5061 // for consistency. 5061 // for consistency.
5062 return new FixedSizeListIterator<String>(this); 5062 return new FixedSizeListIterator<String>(this);
5063 } 5063 }
5064 5064
5065 // SVG Collections expose numberOfItems rather than length. 5065 // SVG Collections expose numberOfItems rather than length.
5066 int get length => numberOfItems; 5066 int get length => numberOfItems;
5067 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { 5067 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) {
5068 return Collections.reduce(this, initialValue, combine); 5068 return IterableMixinWorkaround.reduce(this, initialValue, combine);
5069 } 5069 }
5070 5070
5071 bool contains(String element) => Collections.contains(this, element); 5071 bool contains(String element) => IterableMixinWorkaround.contains(this, elemen t);
5072 5072
5073 void forEach(void f(String element)) => Collections.forEach(this, f); 5073 void forEach(void f(String element)) => IterableMixinWorkaround.forEach(this, f);
5074 5074
5075 String join([String separator]) => Collections.joinList(this, separator); 5075 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
5076 5076
5077 List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f); 5077 List mappedBy(f(String element)) => IterableMixinWorkaround.mappedByList(this, f);
5078 5078
5079 Iterable<String> where(bool f(String element)) => new WhereIterable<String>(th is, f); 5079 Iterable<String> where(bool f(String element)) => IterableMixinWorkaround.wher e(this, f);
5080 5080
5081 bool every(bool f(String element)) => Collections.every(this, f); 5081 bool every(bool f(String element)) => IterableMixinWorkaround.every(this, f);
5082 5082
5083 bool any(bool f(String element)) => Collections.any(this, f); 5083 bool any(bool f(String element)) => IterableMixinWorkaround.any(this, f);
5084 5084
5085 List<String> toList() => new List<String>.from(this); 5085 List<String> toList() => new List<String>.from(this);
5086 Set<String> toSet() => new Set<String>.from(this); 5086 Set<String> toSet() => new Set<String>.from(this);
5087 5087
5088 bool get isEmpty => this.length == 0; 5088 bool get isEmpty => this.length == 0;
5089 5089
5090 List<String> take(int n) => new ListView<String>(this, 0, n); 5090 List<String> take(int n) => IterableMixinWorkaround.takeList(this, n);
5091 5091
5092 Iterable<String> takeWhile(bool test(String value)) { 5092 Iterable<String> takeWhile(bool test(String value)) {
5093 return new TakeWhileIterable<String>(this, test); 5093 return IterableMixinWorkaround.takeWhile(this, test);
5094 } 5094 }
5095 5095
5096 List<String> skip(int n) => new ListView<String>(this, n, null); 5096 List<String> skip(int n) => IterableMixinWorkaround.skipList(this, n);
5097 5097
5098 Iterable<String> skipWhile(bool test(String value)) { 5098 Iterable<String> skipWhile(bool test(String value)) {
5099 return new SkipWhileIterable<String>(this, test); 5099 return IterableMixinWorkaround.skipWhile(this, test);
5100 } 5100 }
5101 5101
5102 String firstMatching(bool test(String value), { String orElse() }) { 5102 String firstMatching(bool test(String value), { String orElse() }) {
5103 return Collections.firstMatching(this, test, orElse); 5103 return IterableMixinWorkaround.firstMatching(this, test, orElse);
5104 } 5104 }
5105 5105
5106 String lastMatching(bool test(String value), {String orElse()}) { 5106 String lastMatching(bool test(String value), {String orElse()}) {
5107 return Collections.lastMatchingInList(this, test, orElse); 5107 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
5108 } 5108 }
5109 5109
5110 String singleMatching(bool test(String value)) { 5110 String singleMatching(bool test(String value)) {
5111 return Collections.singleMatching(this, test); 5111 return IterableMixinWorkaround.singleMatching(this, test);
5112 } 5112 }
5113 5113
5114 String elementAt(int index) { 5114 String elementAt(int index) {
5115 return this[index]; 5115 return this[index];
5116 } 5116 }
5117 5117
5118 // From Collection<String>: 5118 // From Collection<String>:
5119 5119
5120 void add(String value) { 5120 void add(String value) {
5121 throw new UnsupportedError("Cannot add to immutable List."); 5121 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5157 if (this.length > 0) return this[this.length - 1]; 5157 if (this.length > 0) return this[this.length - 1];
5158 throw new StateError("No elements"); 5158 throw new StateError("No elements");
5159 } 5159 }
5160 5160
5161 String get single { 5161 String get single {
5162 if (length == 1) return this[0]; 5162 if (length == 1) return this[0];
5163 if (length == 0) throw new StateError("No elements"); 5163 if (length == 0) throw new StateError("No elements");
5164 throw new StateError("More than one element"); 5164 throw new StateError("More than one element");
5165 } 5165 }
5166 5166
5167 String min([int compare(String a, String b)]) => Collections.min(this, compare ); 5167 String min([int compare(String a, String b)]) => IterableMixinWorkaround.min(t his, compare);
5168 5168
5169 String max([int compare(String a, String b)]) => Collections.max(this, compare ); 5169 String max([int compare(String a, String b)]) => IterableMixinWorkaround.max(t his, compare);
5170 5170
5171 String removeAt(int pos) { 5171 String removeAt(int pos) {
5172 throw new UnsupportedError("Cannot removeAt on immutable List."); 5172 throw new UnsupportedError("Cannot removeAt on immutable List.");
5173 } 5173 }
5174 5174
5175 String removeLast() { 5175 String removeLast() {
5176 throw new UnsupportedError("Cannot removeLast on immutable List."); 5176 throw new UnsupportedError("Cannot removeLast on immutable List.");
5177 } 5177 }
5178 5178
5179 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) { 5179 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) {
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
6100 Iterator<Transform> get iterator { 6100 Iterator<Transform> get iterator {
6101 // Note: NodeLists are not fixed size. And most probably length shouldn't 6101 // Note: NodeLists are not fixed size. And most probably length shouldn't
6102 // be cached in both iterator _and_ forEach method. For now caching it 6102 // be cached in both iterator _and_ forEach method. For now caching it
6103 // for consistency. 6103 // for consistency.
6104 return new FixedSizeListIterator<Transform>(this); 6104 return new FixedSizeListIterator<Transform>(this);
6105 } 6105 }
6106 6106
6107 // SVG Collections expose numberOfItems rather than length. 6107 // SVG Collections expose numberOfItems rather than length.
6108 int get length => numberOfItems; 6108 int get length => numberOfItems;
6109 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) { 6109 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) {
6110 return Collections.reduce(this, initialValue, combine); 6110 return IterableMixinWorkaround.reduce(this, initialValue, combine);
6111 } 6111 }
6112 6112
6113 bool contains(Transform element) => Collections.contains(this, element); 6113 bool contains(Transform element) => IterableMixinWorkaround.contains(this, ele ment);
6114 6114
6115 void forEach(void f(Transform element)) => Collections.forEach(this, f); 6115 void forEach(void f(Transform element)) => IterableMixinWorkaround.forEach(thi s, f);
6116 6116
6117 String join([String separator]) => Collections.joinList(this, separator); 6117 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
6118 6118
6119 List mappedBy(f(Transform element)) => new MappedList<Transform, dynamic>(this , f); 6119 List mappedBy(f(Transform element)) => IterableMixinWorkaround.mappedByList(th is, f);
6120 6120
6121 Iterable<Transform> where(bool f(Transform element)) => new WhereIterable<Tran sform>(this, f); 6121 Iterable<Transform> where(bool f(Transform element)) => IterableMixinWorkaroun d.where(this, f);
6122 6122
6123 bool every(bool f(Transform element)) => Collections.every(this, f); 6123 bool every(bool f(Transform element)) => IterableMixinWorkaround.every(this, f );
6124 6124
6125 bool any(bool f(Transform element)) => Collections.any(this, f); 6125 bool any(bool f(Transform element)) => IterableMixinWorkaround.any(this, f);
6126 6126
6127 List<Transform> toList() => new List<Transform>.from(this); 6127 List<Transform> toList() => new List<Transform>.from(this);
6128 Set<Transform> toSet() => new Set<Transform>.from(this); 6128 Set<Transform> toSet() => new Set<Transform>.from(this);
6129 6129
6130 bool get isEmpty => this.length == 0; 6130 bool get isEmpty => this.length == 0;
6131 6131
6132 List<Transform> take(int n) => new ListView<Transform>(this, 0, n); 6132 List<Transform> take(int n) => IterableMixinWorkaround.takeList(this, n);
6133 6133
6134 Iterable<Transform> takeWhile(bool test(Transform value)) { 6134 Iterable<Transform> takeWhile(bool test(Transform value)) {
6135 return new TakeWhileIterable<Transform>(this, test); 6135 return IterableMixinWorkaround.takeWhile(this, test);
6136 } 6136 }
6137 6137
6138 List<Transform> skip(int n) => new ListView<Transform>(this, n, null); 6138 List<Transform> skip(int n) => IterableMixinWorkaround.skipList(this, n);
6139 6139
6140 Iterable<Transform> skipWhile(bool test(Transform value)) { 6140 Iterable<Transform> skipWhile(bool test(Transform value)) {
6141 return new SkipWhileIterable<Transform>(this, test); 6141 return IterableMixinWorkaround.skipWhile(this, test);
6142 } 6142 }
6143 6143
6144 Transform firstMatching(bool test(Transform value), { Transform orElse() }) { 6144 Transform firstMatching(bool test(Transform value), { Transform orElse() }) {
6145 return Collections.firstMatching(this, test, orElse); 6145 return IterableMixinWorkaround.firstMatching(this, test, orElse);
6146 } 6146 }
6147 6147
6148 Transform lastMatching(bool test(Transform value), {Transform orElse()}) { 6148 Transform lastMatching(bool test(Transform value), {Transform orElse()}) {
6149 return Collections.lastMatchingInList(this, test, orElse); 6149 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
6150 } 6150 }
6151 6151
6152 Transform singleMatching(bool test(Transform value)) { 6152 Transform singleMatching(bool test(Transform value)) {
6153 return Collections.singleMatching(this, test); 6153 return IterableMixinWorkaround.singleMatching(this, test);
6154 } 6154 }
6155 6155
6156 Transform elementAt(int index) { 6156 Transform elementAt(int index) {
6157 return this[index]; 6157 return this[index];
6158 } 6158 }
6159 6159
6160 // From Collection<Transform>: 6160 // From Collection<Transform>:
6161 6161
6162 void add(Transform value) { 6162 void add(Transform value) {
6163 throw new UnsupportedError("Cannot add to immutable List."); 6163 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6199 if (this.length > 0) return this[this.length - 1]; 6199 if (this.length > 0) return this[this.length - 1];
6200 throw new StateError("No elements"); 6200 throw new StateError("No elements");
6201 } 6201 }
6202 6202
6203 Transform get single { 6203 Transform get single {
6204 if (length == 1) return this[0]; 6204 if (length == 1) return this[0];
6205 if (length == 0) throw new StateError("No elements"); 6205 if (length == 0) throw new StateError("No elements");
6206 throw new StateError("More than one element"); 6206 throw new StateError("More than one element");
6207 } 6207 }
6208 6208
6209 Transform min([int compare(Transform a, Transform b)]) => Collections.min(this , compare); 6209 Transform min([int compare(Transform a, Transform b)]) => IterableMixinWorkaro und.min(this, compare);
6210 6210
6211 Transform max([int compare(Transform a, Transform b)]) => Collections.max(this , compare); 6211 Transform max([int compare(Transform a, Transform b)]) => IterableMixinWorkaro und.max(this, compare);
6212 6212
6213 Transform removeAt(int pos) { 6213 Transform removeAt(int pos) {
6214 throw new UnsupportedError("Cannot removeAt on immutable List."); 6214 throw new UnsupportedError("Cannot removeAt on immutable List.");
6215 } 6215 }
6216 6216
6217 Transform removeLast() { 6217 Transform removeLast() {
6218 throw new UnsupportedError("Cannot removeLast on immutable List."); 6218 throw new UnsupportedError("Cannot removeLast on immutable List.");
6219 } 6219 }
6220 6220
6221 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom ]) { 6221 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom ]) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
6554 // From Iterable<ElementInstance>: 6554 // From Iterable<ElementInstance>:
6555 6555
6556 Iterator<ElementInstance> get iterator { 6556 Iterator<ElementInstance> get iterator {
6557 // Note: NodeLists are not fixed size. And most probably length shouldn't 6557 // Note: NodeLists are not fixed size. And most probably length shouldn't
6558 // be cached in both iterator _and_ forEach method. For now caching it 6558 // be cached in both iterator _and_ forEach method. For now caching it
6559 // for consistency. 6559 // for consistency.
6560 return new FixedSizeListIterator<ElementInstance>(this); 6560 return new FixedSizeListIterator<ElementInstance>(this);
6561 } 6561 }
6562 6562
6563 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance) ) { 6563 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance) ) {
6564 return Collections.reduce(this, initialValue, combine); 6564 return IterableMixinWorkaround.reduce(this, initialValue, combine);
6565 } 6565 }
6566 6566
6567 bool contains(ElementInstance element) => Collections.contains(this, element); 6567 bool contains(ElementInstance element) => IterableMixinWorkaround.contains(thi s, element);
6568 6568
6569 void forEach(void f(ElementInstance element)) => Collections.forEach(this, f); 6569 void forEach(void f(ElementInstance element)) => IterableMixinWorkaround.forEa ch(this, f);
6570 6570
6571 String join([String separator]) => Collections.joinList(this, separator); 6571 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
6572 6572
6573 List mappedBy(f(ElementInstance element)) => new MappedList<ElementInstance, d ynamic>(this, f); 6573 List mappedBy(f(ElementInstance element)) => IterableMixinWorkaround.mappedByL ist(this, f);
6574 6574
6575 Iterable<ElementInstance> where(bool f(ElementInstance element)) => new WhereI terable<ElementInstance>(this, f); 6575 Iterable<ElementInstance> where(bool f(ElementInstance element)) => IterableMi xinWorkaround.where(this, f);
6576 6576
6577 bool every(bool f(ElementInstance element)) => Collections.every(this, f); 6577 bool every(bool f(ElementInstance element)) => IterableMixinWorkaround.every(t his, f);
6578 6578
6579 bool any(bool f(ElementInstance element)) => Collections.any(this, f); 6579 bool any(bool f(ElementInstance element)) => IterableMixinWorkaround.any(this, f);
6580 6580
6581 List<ElementInstance> toList() => new List<ElementInstance>.from(this); 6581 List<ElementInstance> toList() => new List<ElementInstance>.from(this);
6582 Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this); 6582 Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this);
6583 6583
6584 bool get isEmpty => this.length == 0; 6584 bool get isEmpty => this.length == 0;
6585 6585
6586 List<ElementInstance> take(int n) => new ListView<ElementInstance>(this, 0, n) ; 6586 List<ElementInstance> take(int n) => IterableMixinWorkaround.takeList(this, n) ;
6587 6587
6588 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) { 6588 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) {
6589 return new TakeWhileIterable<ElementInstance>(this, test); 6589 return IterableMixinWorkaround.takeWhile(this, test);
6590 } 6590 }
6591 6591
6592 List<ElementInstance> skip(int n) => new ListView<ElementInstance>(this, n, nu ll); 6592 List<ElementInstance> skip(int n) => IterableMixinWorkaround.skipList(this, n) ;
6593 6593
6594 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) { 6594 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) {
6595 return new SkipWhileIterable<ElementInstance>(this, test); 6595 return IterableMixinWorkaround.skipWhile(this, test);
6596 } 6596 }
6597 6597
6598 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta nce orElse() }) { 6598 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta nce orElse() }) {
6599 return Collections.firstMatching(this, test, orElse); 6599 return IterableMixinWorkaround.firstMatching(this, test, orElse);
6600 } 6600 }
6601 6601
6602 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc e orElse()}) { 6602 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc e orElse()}) {
6603 return Collections.lastMatchingInList(this, test, orElse); 6603 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
6604 } 6604 }
6605 6605
6606 ElementInstance singleMatching(bool test(ElementInstance value)) { 6606 ElementInstance singleMatching(bool test(ElementInstance value)) {
6607 return Collections.singleMatching(this, test); 6607 return IterableMixinWorkaround.singleMatching(this, test);
6608 } 6608 }
6609 6609
6610 ElementInstance elementAt(int index) { 6610 ElementInstance elementAt(int index) {
6611 return this[index]; 6611 return this[index];
6612 } 6612 }
6613 6613
6614 // From Collection<ElementInstance>: 6614 // From Collection<ElementInstance>:
6615 6615
6616 void add(ElementInstance value) { 6616 void add(ElementInstance value) {
6617 throw new UnsupportedError("Cannot add to immutable List."); 6617 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
6655 if (this.length > 0) return this[this.length - 1]; 6655 if (this.length > 0) return this[this.length - 1];
6656 throw new StateError("No elements"); 6656 throw new StateError("No elements");
6657 } 6657 }
6658 6658
6659 ElementInstance get single { 6659 ElementInstance get single {
6660 if (length == 1) return this[0]; 6660 if (length == 1) return this[0];
6661 if (length == 0) throw new StateError("No elements"); 6661 if (length == 0) throw new StateError("No elements");
6662 throw new StateError("More than one element"); 6662 throw new StateError("More than one element");
6663 } 6663 }
6664 6664
6665 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => Co llections.min(this, compare); 6665 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => It erableMixinWorkaround.min(this, compare);
6666 6666
6667 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => Co llections.max(this, compare); 6667 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => It erableMixinWorkaround.max(this, compare);
6668 6668
6669 ElementInstance removeAt(int pos) { 6669 ElementInstance removeAt(int pos) {
6670 throw new UnsupportedError("Cannot removeAt on immutable List."); 6670 throw new UnsupportedError("Cannot removeAt on immutable List.");
6671 } 6671 }
6672 6672
6673 ElementInstance removeLast() { 6673 ElementInstance removeLast() {
6674 throw new UnsupportedError("Cannot removeLast on immutable List."); 6674 throw new UnsupportedError("Cannot removeLast on immutable List.");
6675 } 6675 }
6676 6676
6677 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta rtFrom]) { 6677 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta rtFrom]) {
6678 throw new UnsupportedError("Cannot setRange on immutable List."); 6678 throw new UnsupportedError("Cannot setRange on immutable List.");
6679 } 6679 }
6680 6680
6681 void removeRange(int start, int rangeLength) { 6681 void removeRange(int start, int rangeLength) {
6682 throw new UnsupportedError("Cannot removeRange on immutable List."); 6682 throw new UnsupportedError("Cannot removeRange on immutable List.");
6683 } 6683 }
6684 6684
6685 void insertRange(int start, int rangeLength, [ElementInstance initialValue]) { 6685 void insertRange(int start, int rangeLength, [ElementInstance initialValue]) {
6686 throw new UnsupportedError("Cannot insertRange on immutable List."); 6686 throw new UnsupportedError("Cannot insertRange on immutable List.");
6687 } 6687 }
6688 6688
6689 List<ElementInstance> getRange(int start, int rangeLength) => 6689 List<ElementInstance> getRange(int start, int rangeLength) =>
6690 Lists.getRange(this, start, rangeLength, <ElementInstance>[]); 6690 Lists.getRange(this, start, rangeLength, <ElementInstance>[]);
6691 6691
6692 // -- end List<ElementInstance> mixins. 6692 // -- end List<ElementInstance> mixins.
6693 6693
6694 /// @domName SVGElementInstanceList.item; @docsEditable true 6694 /// @domName SVGElementInstanceList.item; @docsEditable true
6695 ElementInstance item(int index) native; 6695 ElementInstance item(int index) native;
6696 } 6696 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698