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

Side by Side Diff: sdk/lib/svg/dartium/svg_dartium.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 import 'dart:nativewrappers'; 7 import 'dart:nativewrappers';
8 // DO NOT EDIT 8 // DO NOT EDIT
9 // Auto-generated dart:svg library. 9 // Auto-generated dart:svg library.
10 10
(...skipping 3695 matching lines...) Expand 10 before | Expand all | Expand 10 after
3706 Iterator<Length> get iterator { 3706 Iterator<Length> get iterator {
3707 // Note: NodeLists are not fixed size. And most probably length shouldn't 3707 // Note: NodeLists are not fixed size. And most probably length shouldn't
3708 // be cached in both iterator _and_ forEach method. For now caching it 3708 // be cached in both iterator _and_ forEach method. For now caching it
3709 // for consistency. 3709 // for consistency.
3710 return new FixedSizeListIterator<Length>(this); 3710 return new FixedSizeListIterator<Length>(this);
3711 } 3711 }
3712 3712
3713 // SVG Collections expose numberOfItems rather than length. 3713 // SVG Collections expose numberOfItems rather than length.
3714 int get length => numberOfItems; 3714 int get length => numberOfItems;
3715 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) { 3715 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Length)) {
3716 return Collections.reduce(this, initialValue, combine); 3716 return IterableMixinWorkaround.reduce(this, initialValue, combine);
3717 } 3717 }
3718 3718
3719 bool contains(Length element) => Collections.contains(this, element); 3719 bool contains(Length element) => IterableMixinWorkaround.contains(this, elemen t);
3720 3720
3721 void forEach(void f(Length element)) => Collections.forEach(this, f); 3721 void forEach(void f(Length element)) => IterableMixinWorkaround.forEach(this, f);
3722 3722
3723 String join([String separator]) => Collections.joinList(this, separator); 3723 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
3724 3724
3725 List mappedBy(f(Length element)) => new MappedList<Length, dynamic>(this, f); 3725 List mappedBy(f(Length element)) => IterableMixinWorkaround.mappedByList(this, f);
3726 3726
3727 Iterable<Length> where(bool f(Length element)) => new WhereIterable<Length>(th is, f); 3727 Iterable<Length> where(bool f(Length element)) => IterableMixinWorkaround.wher e(this, f);
3728 3728
3729 bool every(bool f(Length element)) => Collections.every(this, f); 3729 bool every(bool f(Length element)) => IterableMixinWorkaround.every(this, f);
3730 3730
3731 bool any(bool f(Length element)) => Collections.any(this, f); 3731 bool any(bool f(Length element)) => IterableMixinWorkaround.any(this, f);
3732 3732
3733 List<Length> toList() => new List<Length>.from(this); 3733 List<Length> toList() => new List<Length>.from(this);
3734 Set<Length> toSet() => new Set<Length>.from(this); 3734 Set<Length> toSet() => new Set<Length>.from(this);
3735 3735
3736 bool get isEmpty => this.length == 0; 3736 bool get isEmpty => this.length == 0;
3737 3737
3738 List<Length> take(int n) => new ListView<Length>(this, 0, n); 3738 List<Length> take(int n) => IterableMixinWorkaround.takeList(this, n);
3739 3739
3740 Iterable<Length> takeWhile(bool test(Length value)) { 3740 Iterable<Length> takeWhile(bool test(Length value)) {
3741 return new TakeWhileIterable<Length>(this, test); 3741 return IterableMixinWorkaround.takeWhile(this, test);
3742 } 3742 }
3743 3743
3744 List<Length> skip(int n) => new ListView<Length>(this, n, null); 3744 List<Length> skip(int n) => IterableMixinWorkaround.skipList(this, n);
3745 3745
3746 Iterable<Length> skipWhile(bool test(Length value)) { 3746 Iterable<Length> skipWhile(bool test(Length value)) {
3747 return new SkipWhileIterable<Length>(this, test); 3747 return IterableMixinWorkaround.skipWhile(this, test);
3748 } 3748 }
3749 3749
3750 Length firstMatching(bool test(Length value), { Length orElse() }) { 3750 Length firstMatching(bool test(Length value), { Length orElse() }) {
3751 return Collections.firstMatching(this, test, orElse); 3751 return IterableMixinWorkaround.firstMatching(this, test, orElse);
3752 } 3752 }
3753 3753
3754 Length lastMatching(bool test(Length value), {Length orElse()}) { 3754 Length lastMatching(bool test(Length value), {Length orElse()}) {
3755 return Collections.lastMatchingInList(this, test, orElse); 3755 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
3756 } 3756 }
3757 3757
3758 Length singleMatching(bool test(Length value)) { 3758 Length singleMatching(bool test(Length value)) {
3759 return Collections.singleMatching(this, test); 3759 return IterableMixinWorkaround.singleMatching(this, test);
3760 } 3760 }
3761 3761
3762 Length elementAt(int index) { 3762 Length elementAt(int index) {
3763 return this[index]; 3763 return this[index];
3764 } 3764 }
3765 3765
3766 // From Collection<Length>: 3766 // From Collection<Length>:
3767 3767
3768 void add(Length value) { 3768 void add(Length value) {
3769 throw new UnsupportedError("Cannot add to immutable List."); 3769 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3805 if (this.length > 0) return this[this.length - 1]; 3805 if (this.length > 0) return this[this.length - 1];
3806 throw new StateError("No elements"); 3806 throw new StateError("No elements");
3807 } 3807 }
3808 3808
3809 Length get single { 3809 Length get single {
3810 if (length == 1) return this[0]; 3810 if (length == 1) return this[0];
3811 if (length == 0) throw new StateError("No elements"); 3811 if (length == 0) throw new StateError("No elements");
3812 throw new StateError("More than one element"); 3812 throw new StateError("More than one element");
3813 } 3813 }
3814 3814
3815 Length min([int compare(Length a, Length b)]) => Collections.min(this, compare ); 3815 Length min([int compare(Length a, Length b)]) => IterableMixinWorkaround.min(t his, compare);
3816 3816
3817 Length max([int compare(Length a, Length b)]) => Collections.max(this, compare ); 3817 Length max([int compare(Length a, Length b)]) => IterableMixinWorkaround.max(t his, compare);
3818 3818
3819 Length removeAt(int pos) { 3819 Length removeAt(int pos) {
3820 throw new UnsupportedError("Cannot removeAt on immutable List."); 3820 throw new UnsupportedError("Cannot removeAt on immutable List.");
3821 } 3821 }
3822 3822
3823 Length removeLast() { 3823 Length removeLast() {
3824 throw new UnsupportedError("Cannot removeLast on immutable List."); 3824 throw new UnsupportedError("Cannot removeLast on immutable List.");
3825 } 3825 }
3826 3826
3827 void setRange(int start, int rangeLength, List<Length> from, [int startFrom]) { 3827 void setRange(int start, int rangeLength, List<Length> from, [int startFrom]) {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4433 Iterator<Number> get iterator { 4433 Iterator<Number> get iterator {
4434 // Note: NodeLists are not fixed size. And most probably length shouldn't 4434 // Note: NodeLists are not fixed size. And most probably length shouldn't
4435 // be cached in both iterator _and_ forEach method. For now caching it 4435 // be cached in both iterator _and_ forEach method. For now caching it
4436 // for consistency. 4436 // for consistency.
4437 return new FixedSizeListIterator<Number>(this); 4437 return new FixedSizeListIterator<Number>(this);
4438 } 4438 }
4439 4439
4440 // SVG Collections expose numberOfItems rather than length. 4440 // SVG Collections expose numberOfItems rather than length.
4441 int get length => numberOfItems; 4441 int get length => numberOfItems;
4442 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) { 4442 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Number)) {
4443 return Collections.reduce(this, initialValue, combine); 4443 return IterableMixinWorkaround.reduce(this, initialValue, combine);
4444 } 4444 }
4445 4445
4446 bool contains(Number element) => Collections.contains(this, element); 4446 bool contains(Number element) => IterableMixinWorkaround.contains(this, elemen t);
4447 4447
4448 void forEach(void f(Number element)) => Collections.forEach(this, f); 4448 void forEach(void f(Number element)) => IterableMixinWorkaround.forEach(this, f);
4449 4449
4450 String join([String separator]) => Collections.joinList(this, separator); 4450 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
4451 4451
4452 List mappedBy(f(Number element)) => new MappedList<Number, dynamic>(this, f); 4452 List mappedBy(f(Number element)) => IterableMixinWorkaround.mappedByList(this, f);
4453 4453
4454 Iterable<Number> where(bool f(Number element)) => new WhereIterable<Number>(th is, f); 4454 Iterable<Number> where(bool f(Number element)) => IterableMixinWorkaround.wher e(this, f);
4455 4455
4456 bool every(bool f(Number element)) => Collections.every(this, f); 4456 bool every(bool f(Number element)) => IterableMixinWorkaround.every(this, f);
4457 4457
4458 bool any(bool f(Number element)) => Collections.any(this, f); 4458 bool any(bool f(Number element)) => IterableMixinWorkaround.any(this, f);
4459 4459
4460 List<Number> toList() => new List<Number>.from(this); 4460 List<Number> toList() => new List<Number>.from(this);
4461 Set<Number> toSet() => new Set<Number>.from(this); 4461 Set<Number> toSet() => new Set<Number>.from(this);
4462 4462
4463 bool get isEmpty => this.length == 0; 4463 bool get isEmpty => this.length == 0;
4464 4464
4465 List<Number> take(int n) => new ListView<Number>(this, 0, n); 4465 List<Number> take(int n) => IterableMixinWorkaround.takeList(this, n);
4466 4466
4467 Iterable<Number> takeWhile(bool test(Number value)) { 4467 Iterable<Number> takeWhile(bool test(Number value)) {
4468 return new TakeWhileIterable<Number>(this, test); 4468 return IterableMixinWorkaround.takeWhile(this, test);
4469 } 4469 }
4470 4470
4471 List<Number> skip(int n) => new ListView<Number>(this, n, null); 4471 List<Number> skip(int n) => IterableMixinWorkaround.skipList(this, n);
4472 4472
4473 Iterable<Number> skipWhile(bool test(Number value)) { 4473 Iterable<Number> skipWhile(bool test(Number value)) {
4474 return new SkipWhileIterable<Number>(this, test); 4474 return IterableMixinWorkaround.skipWhile(this, test);
4475 } 4475 }
4476 4476
4477 Number firstMatching(bool test(Number value), { Number orElse() }) { 4477 Number firstMatching(bool test(Number value), { Number orElse() }) {
4478 return Collections.firstMatching(this, test, orElse); 4478 return IterableMixinWorkaround.firstMatching(this, test, orElse);
4479 } 4479 }
4480 4480
4481 Number lastMatching(bool test(Number value), {Number orElse()}) { 4481 Number lastMatching(bool test(Number value), {Number orElse()}) {
4482 return Collections.lastMatchingInList(this, test, orElse); 4482 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
4483 } 4483 }
4484 4484
4485 Number singleMatching(bool test(Number value)) { 4485 Number singleMatching(bool test(Number value)) {
4486 return Collections.singleMatching(this, test); 4486 return IterableMixinWorkaround.singleMatching(this, test);
4487 } 4487 }
4488 4488
4489 Number elementAt(int index) { 4489 Number elementAt(int index) {
4490 return this[index]; 4490 return this[index];
4491 } 4491 }
4492 4492
4493 // From Collection<Number>: 4493 // From Collection<Number>:
4494 4494
4495 void add(Number value) { 4495 void add(Number value) {
4496 throw new UnsupportedError("Cannot add to immutable List."); 4496 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4532 if (this.length > 0) return this[this.length - 1]; 4532 if (this.length > 0) return this[this.length - 1];
4533 throw new StateError("No elements"); 4533 throw new StateError("No elements");
4534 } 4534 }
4535 4535
4536 Number get single { 4536 Number get single {
4537 if (length == 1) return this[0]; 4537 if (length == 1) return this[0];
4538 if (length == 0) throw new StateError("No elements"); 4538 if (length == 0) throw new StateError("No elements");
4539 throw new StateError("More than one element"); 4539 throw new StateError("More than one element");
4540 } 4540 }
4541 4541
4542 Number min([int compare(Number a, Number b)]) => Collections.min(this, compare ); 4542 Number min([int compare(Number a, Number b)]) => IterableMixinWorkaround.min(t his, compare);
4543 4543
4544 Number max([int compare(Number a, Number b)]) => Collections.max(this, compare ); 4544 Number max([int compare(Number a, Number b)]) => IterableMixinWorkaround.max(t his, compare);
4545 4545
4546 Number removeAt(int pos) { 4546 Number removeAt(int pos) {
4547 throw new UnsupportedError("Cannot removeAt on immutable List."); 4547 throw new UnsupportedError("Cannot removeAt on immutable List.");
4548 } 4548 }
4549 4549
4550 Number removeLast() { 4550 Number removeLast() {
4551 throw new UnsupportedError("Cannot removeLast on immutable List."); 4551 throw new UnsupportedError("Cannot removeLast on immutable List.");
4552 } 4552 }
4553 4553
4554 void setRange(int start, int rangeLength, List<Number> from, [int startFrom]) { 4554 void setRange(int start, int rangeLength, List<Number> from, [int startFrom]) {
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
5568 Iterator<PathSeg> get iterator { 5568 Iterator<PathSeg> get iterator {
5569 // Note: NodeLists are not fixed size. And most probably length shouldn't 5569 // Note: NodeLists are not fixed size. And most probably length shouldn't
5570 // be cached in both iterator _and_ forEach method. For now caching it 5570 // be cached in both iterator _and_ forEach method. For now caching it
5571 // for consistency. 5571 // for consistency.
5572 return new FixedSizeListIterator<PathSeg>(this); 5572 return new FixedSizeListIterator<PathSeg>(this);
5573 } 5573 }
5574 5574
5575 // SVG Collections expose numberOfItems rather than length. 5575 // SVG Collections expose numberOfItems rather than length.
5576 int get length => numberOfItems; 5576 int get length => numberOfItems;
5577 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) { 5577 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, PathSeg)) {
5578 return Collections.reduce(this, initialValue, combine); 5578 return IterableMixinWorkaround.reduce(this, initialValue, combine);
5579 } 5579 }
5580 5580
5581 bool contains(PathSeg element) => Collections.contains(this, element); 5581 bool contains(PathSeg element) => IterableMixinWorkaround.contains(this, eleme nt);
5582 5582
5583 void forEach(void f(PathSeg element)) => Collections.forEach(this, f); 5583 void forEach(void f(PathSeg element)) => IterableMixinWorkaround.forEach(this, f);
5584 5584
5585 String join([String separator]) => Collections.joinList(this, separator); 5585 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
5586 5586
5587 List mappedBy(f(PathSeg element)) => new MappedList<PathSeg, dynamic>(this, f) ; 5587 List mappedBy(f(PathSeg element)) => IterableMixinWorkaround.mappedByList(this , f);
5588 5588
5589 Iterable<PathSeg> where(bool f(PathSeg element)) => new WhereIterable<PathSeg> (this, f); 5589 Iterable<PathSeg> where(bool f(PathSeg element)) => IterableMixinWorkaround.wh ere(this, f);
5590 5590
5591 bool every(bool f(PathSeg element)) => Collections.every(this, f); 5591 bool every(bool f(PathSeg element)) => IterableMixinWorkaround.every(this, f);
5592 5592
5593 bool any(bool f(PathSeg element)) => Collections.any(this, f); 5593 bool any(bool f(PathSeg element)) => IterableMixinWorkaround.any(this, f);
5594 5594
5595 List<PathSeg> toList() => new List<PathSeg>.from(this); 5595 List<PathSeg> toList() => new List<PathSeg>.from(this);
5596 Set<PathSeg> toSet() => new Set<PathSeg>.from(this); 5596 Set<PathSeg> toSet() => new Set<PathSeg>.from(this);
5597 5597
5598 bool get isEmpty => this.length == 0; 5598 bool get isEmpty => this.length == 0;
5599 5599
5600 List<PathSeg> take(int n) => new ListView<PathSeg>(this, 0, n); 5600 List<PathSeg> take(int n) => IterableMixinWorkaround.takeList(this, n);
5601 5601
5602 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) { 5602 Iterable<PathSeg> takeWhile(bool test(PathSeg value)) {
5603 return new TakeWhileIterable<PathSeg>(this, test); 5603 return IterableMixinWorkaround.takeWhile(this, test);
5604 } 5604 }
5605 5605
5606 List<PathSeg> skip(int n) => new ListView<PathSeg>(this, n, null); 5606 List<PathSeg> skip(int n) => IterableMixinWorkaround.skipList(this, n);
5607 5607
5608 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) { 5608 Iterable<PathSeg> skipWhile(bool test(PathSeg value)) {
5609 return new SkipWhileIterable<PathSeg>(this, test); 5609 return IterableMixinWorkaround.skipWhile(this, test);
5610 } 5610 }
5611 5611
5612 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) { 5612 PathSeg firstMatching(bool test(PathSeg value), { PathSeg orElse() }) {
5613 return Collections.firstMatching(this, test, orElse); 5613 return IterableMixinWorkaround.firstMatching(this, test, orElse);
5614 } 5614 }
5615 5615
5616 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) { 5616 PathSeg lastMatching(bool test(PathSeg value), {PathSeg orElse()}) {
5617 return Collections.lastMatchingInList(this, test, orElse); 5617 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
5618 } 5618 }
5619 5619
5620 PathSeg singleMatching(bool test(PathSeg value)) { 5620 PathSeg singleMatching(bool test(PathSeg value)) {
5621 return Collections.singleMatching(this, test); 5621 return IterableMixinWorkaround.singleMatching(this, test);
5622 } 5622 }
5623 5623
5624 PathSeg elementAt(int index) { 5624 PathSeg elementAt(int index) {
5625 return this[index]; 5625 return this[index];
5626 } 5626 }
5627 5627
5628 // From Collection<PathSeg>: 5628 // From Collection<PathSeg>:
5629 5629
5630 void add(PathSeg value) { 5630 void add(PathSeg value) {
5631 throw new UnsupportedError("Cannot add to immutable List."); 5631 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5667 if (this.length > 0) return this[this.length - 1]; 5667 if (this.length > 0) return this[this.length - 1];
5668 throw new StateError("No elements"); 5668 throw new StateError("No elements");
5669 } 5669 }
5670 5670
5671 PathSeg get single { 5671 PathSeg get single {
5672 if (length == 1) return this[0]; 5672 if (length == 1) return this[0];
5673 if (length == 0) throw new StateError("No elements"); 5673 if (length == 0) throw new StateError("No elements");
5674 throw new StateError("More than one element"); 5674 throw new StateError("More than one element");
5675 } 5675 }
5676 5676
5677 PathSeg min([int compare(PathSeg a, PathSeg b)]) => Collections.min(this, comp are); 5677 PathSeg min([int compare(PathSeg a, PathSeg b)]) => IterableMixinWorkaround.mi n(this, compare);
5678 5678
5679 PathSeg max([int compare(PathSeg a, PathSeg b)]) => Collections.max(this, comp are); 5679 PathSeg max([int compare(PathSeg a, PathSeg b)]) => IterableMixinWorkaround.ma x(this, compare);
5680 5680
5681 PathSeg removeAt(int pos) { 5681 PathSeg removeAt(int pos) {
5682 throw new UnsupportedError("Cannot removeAt on immutable List."); 5682 throw new UnsupportedError("Cannot removeAt on immutable List.");
5683 } 5683 }
5684 5684
5685 PathSeg removeLast() { 5685 PathSeg removeLast() {
5686 throw new UnsupportedError("Cannot removeLast on immutable List."); 5686 throw new UnsupportedError("Cannot removeLast on immutable List.");
5687 } 5687 }
5688 5688
5689 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom]) { 5689 void setRange(int start, int rangeLength, List<PathSeg> from, [int startFrom]) {
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
6548 Iterator<String> get iterator { 6548 Iterator<String> get iterator {
6549 // Note: NodeLists are not fixed size. And most probably length shouldn't 6549 // Note: NodeLists are not fixed size. And most probably length shouldn't
6550 // be cached in both iterator _and_ forEach method. For now caching it 6550 // be cached in both iterator _and_ forEach method. For now caching it
6551 // for consistency. 6551 // for consistency.
6552 return new FixedSizeListIterator<String>(this); 6552 return new FixedSizeListIterator<String>(this);
6553 } 6553 }
6554 6554
6555 // SVG Collections expose numberOfItems rather than length. 6555 // SVG Collections expose numberOfItems rather than length.
6556 int get length => numberOfItems; 6556 int get length => numberOfItems;
6557 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { 6557 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) {
6558 return Collections.reduce(this, initialValue, combine); 6558 return IterableMixinWorkaround.reduce(this, initialValue, combine);
6559 } 6559 }
6560 6560
6561 bool contains(String element) => Collections.contains(this, element); 6561 bool contains(String element) => IterableMixinWorkaround.contains(this, elemen t);
6562 6562
6563 void forEach(void f(String element)) => Collections.forEach(this, f); 6563 void forEach(void f(String element)) => IterableMixinWorkaround.forEach(this, f);
6564 6564
6565 String join([String separator]) => Collections.joinList(this, separator); 6565 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
6566 6566
6567 List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f); 6567 List mappedBy(f(String element)) => IterableMixinWorkaround.mappedByList(this, f);
6568 6568
6569 Iterable<String> where(bool f(String element)) => new WhereIterable<String>(th is, f); 6569 Iterable<String> where(bool f(String element)) => IterableMixinWorkaround.wher e(this, f);
6570 6570
6571 bool every(bool f(String element)) => Collections.every(this, f); 6571 bool every(bool f(String element)) => IterableMixinWorkaround.every(this, f);
6572 6572
6573 bool any(bool f(String element)) => Collections.any(this, f); 6573 bool any(bool f(String element)) => IterableMixinWorkaround.any(this, f);
6574 6574
6575 List<String> toList() => new List<String>.from(this); 6575 List<String> toList() => new List<String>.from(this);
6576 Set<String> toSet() => new Set<String>.from(this); 6576 Set<String> toSet() => new Set<String>.from(this);
6577 6577
6578 bool get isEmpty => this.length == 0; 6578 bool get isEmpty => this.length == 0;
6579 6579
6580 List<String> take(int n) => new ListView<String>(this, 0, n); 6580 List<String> take(int n) => IterableMixinWorkaround.takeList(this, n);
6581 6581
6582 Iterable<String> takeWhile(bool test(String value)) { 6582 Iterable<String> takeWhile(bool test(String value)) {
6583 return new TakeWhileIterable<String>(this, test); 6583 return IterableMixinWorkaround.takeWhile(this, test);
6584 } 6584 }
6585 6585
6586 List<String> skip(int n) => new ListView<String>(this, n, null); 6586 List<String> skip(int n) => IterableMixinWorkaround.skipList(this, n);
6587 6587
6588 Iterable<String> skipWhile(bool test(String value)) { 6588 Iterable<String> skipWhile(bool test(String value)) {
6589 return new SkipWhileIterable<String>(this, test); 6589 return IterableMixinWorkaround.skipWhile(this, test);
6590 } 6590 }
6591 6591
6592 String firstMatching(bool test(String value), { String orElse() }) { 6592 String firstMatching(bool test(String value), { String orElse() }) {
6593 return Collections.firstMatching(this, test, orElse); 6593 return IterableMixinWorkaround.firstMatching(this, test, orElse);
6594 } 6594 }
6595 6595
6596 String lastMatching(bool test(String value), {String orElse()}) { 6596 String lastMatching(bool test(String value), {String orElse()}) {
6597 return Collections.lastMatchingInList(this, test, orElse); 6597 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
6598 } 6598 }
6599 6599
6600 String singleMatching(bool test(String value)) { 6600 String singleMatching(bool test(String value)) {
6601 return Collections.singleMatching(this, test); 6601 return IterableMixinWorkaround.singleMatching(this, test);
6602 } 6602 }
6603 6603
6604 String elementAt(int index) { 6604 String elementAt(int index) {
6605 return this[index]; 6605 return this[index];
6606 } 6606 }
6607 6607
6608 // From Collection<String>: 6608 // From Collection<String>:
6609 6609
6610 void add(String value) { 6610 void add(String value) {
6611 throw new UnsupportedError("Cannot add to immutable List."); 6611 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6647 if (this.length > 0) return this[this.length - 1]; 6647 if (this.length > 0) return this[this.length - 1];
6648 throw new StateError("No elements"); 6648 throw new StateError("No elements");
6649 } 6649 }
6650 6650
6651 String get single { 6651 String get single {
6652 if (length == 1) return this[0]; 6652 if (length == 1) return this[0];
6653 if (length == 0) throw new StateError("No elements"); 6653 if (length == 0) throw new StateError("No elements");
6654 throw new StateError("More than one element"); 6654 throw new StateError("More than one element");
6655 } 6655 }
6656 6656
6657 String min([int compare(String a, String b)]) => Collections.min(this, compare ); 6657 String min([int compare(String a, String b)]) => IterableMixinWorkaround.min(t his, compare);
6658 6658
6659 String max([int compare(String a, String b)]) => Collections.max(this, compare ); 6659 String max([int compare(String a, String b)]) => IterableMixinWorkaround.max(t his, compare);
6660 6660
6661 String removeAt(int pos) { 6661 String removeAt(int pos) {
6662 throw new UnsupportedError("Cannot removeAt on immutable List."); 6662 throw new UnsupportedError("Cannot removeAt on immutable List.");
6663 } 6663 }
6664 6664
6665 String removeLast() { 6665 String removeLast() {
6666 throw new UnsupportedError("Cannot removeLast on immutable List."); 6666 throw new UnsupportedError("Cannot removeLast on immutable List.");
6667 } 6667 }
6668 6668
6669 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) { 6669 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) {
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
7823 Iterator<Transform> get iterator { 7823 Iterator<Transform> get iterator {
7824 // Note: NodeLists are not fixed size. And most probably length shouldn't 7824 // Note: NodeLists are not fixed size. And most probably length shouldn't
7825 // be cached in both iterator _and_ forEach method. For now caching it 7825 // be cached in both iterator _and_ forEach method. For now caching it
7826 // for consistency. 7826 // for consistency.
7827 return new FixedSizeListIterator<Transform>(this); 7827 return new FixedSizeListIterator<Transform>(this);
7828 } 7828 }
7829 7829
7830 // SVG Collections expose numberOfItems rather than length. 7830 // SVG Collections expose numberOfItems rather than length.
7831 int get length => numberOfItems; 7831 int get length => numberOfItems;
7832 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) { 7832 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Transform)) {
7833 return Collections.reduce(this, initialValue, combine); 7833 return IterableMixinWorkaround.reduce(this, initialValue, combine);
7834 } 7834 }
7835 7835
7836 bool contains(Transform element) => Collections.contains(this, element); 7836 bool contains(Transform element) => IterableMixinWorkaround.contains(this, ele ment);
7837 7837
7838 void forEach(void f(Transform element)) => Collections.forEach(this, f); 7838 void forEach(void f(Transform element)) => IterableMixinWorkaround.forEach(thi s, f);
7839 7839
7840 String join([String separator]) => Collections.joinList(this, separator); 7840 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
7841 7841
7842 List mappedBy(f(Transform element)) => new MappedList<Transform, dynamic>(this , f); 7842 List mappedBy(f(Transform element)) => IterableMixinWorkaround.mappedByList(th is, f);
7843 7843
7844 Iterable<Transform> where(bool f(Transform element)) => new WhereIterable<Tran sform>(this, f); 7844 Iterable<Transform> where(bool f(Transform element)) => IterableMixinWorkaroun d.where(this, f);
7845 7845
7846 bool every(bool f(Transform element)) => Collections.every(this, f); 7846 bool every(bool f(Transform element)) => IterableMixinWorkaround.every(this, f );
7847 7847
7848 bool any(bool f(Transform element)) => Collections.any(this, f); 7848 bool any(bool f(Transform element)) => IterableMixinWorkaround.any(this, f);
7849 7849
7850 List<Transform> toList() => new List<Transform>.from(this); 7850 List<Transform> toList() => new List<Transform>.from(this);
7851 Set<Transform> toSet() => new Set<Transform>.from(this); 7851 Set<Transform> toSet() => new Set<Transform>.from(this);
7852 7852
7853 bool get isEmpty => this.length == 0; 7853 bool get isEmpty => this.length == 0;
7854 7854
7855 List<Transform> take(int n) => new ListView<Transform>(this, 0, n); 7855 List<Transform> take(int n) => IterableMixinWorkaround.takeList(this, n);
7856 7856
7857 Iterable<Transform> takeWhile(bool test(Transform value)) { 7857 Iterable<Transform> takeWhile(bool test(Transform value)) {
7858 return new TakeWhileIterable<Transform>(this, test); 7858 return IterableMixinWorkaround.takeWhile(this, test);
7859 } 7859 }
7860 7860
7861 List<Transform> skip(int n) => new ListView<Transform>(this, n, null); 7861 List<Transform> skip(int n) => IterableMixinWorkaround.skipList(this, n);
7862 7862
7863 Iterable<Transform> skipWhile(bool test(Transform value)) { 7863 Iterable<Transform> skipWhile(bool test(Transform value)) {
7864 return new SkipWhileIterable<Transform>(this, test); 7864 return IterableMixinWorkaround.skipWhile(this, test);
7865 } 7865 }
7866 7866
7867 Transform firstMatching(bool test(Transform value), { Transform orElse() }) { 7867 Transform firstMatching(bool test(Transform value), { Transform orElse() }) {
7868 return Collections.firstMatching(this, test, orElse); 7868 return IterableMixinWorkaround.firstMatching(this, test, orElse);
7869 } 7869 }
7870 7870
7871 Transform lastMatching(bool test(Transform value), {Transform orElse()}) { 7871 Transform lastMatching(bool test(Transform value), {Transform orElse()}) {
7872 return Collections.lastMatchingInList(this, test, orElse); 7872 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
7873 } 7873 }
7874 7874
7875 Transform singleMatching(bool test(Transform value)) { 7875 Transform singleMatching(bool test(Transform value)) {
7876 return Collections.singleMatching(this, test); 7876 return IterableMixinWorkaround.singleMatching(this, test);
7877 } 7877 }
7878 7878
7879 Transform elementAt(int index) { 7879 Transform elementAt(int index) {
7880 return this[index]; 7880 return this[index];
7881 } 7881 }
7882 7882
7883 // From Collection<Transform>: 7883 // From Collection<Transform>:
7884 7884
7885 void add(Transform value) { 7885 void add(Transform value) {
7886 throw new UnsupportedError("Cannot add to immutable List."); 7886 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
7922 if (this.length > 0) return this[this.length - 1]; 7922 if (this.length > 0) return this[this.length - 1];
7923 throw new StateError("No elements"); 7923 throw new StateError("No elements");
7924 } 7924 }
7925 7925
7926 Transform get single { 7926 Transform get single {
7927 if (length == 1) return this[0]; 7927 if (length == 1) return this[0];
7928 if (length == 0) throw new StateError("No elements"); 7928 if (length == 0) throw new StateError("No elements");
7929 throw new StateError("More than one element"); 7929 throw new StateError("More than one element");
7930 } 7930 }
7931 7931
7932 Transform min([int compare(Transform a, Transform b)]) => Collections.min(this , compare); 7932 Transform min([int compare(Transform a, Transform b)]) => IterableMixinWorkaro und.min(this, compare);
7933 7933
7934 Transform max([int compare(Transform a, Transform b)]) => Collections.max(this , compare); 7934 Transform max([int compare(Transform a, Transform b)]) => IterableMixinWorkaro und.max(this, compare);
7935 7935
7936 Transform removeAt(int pos) { 7936 Transform removeAt(int pos) {
7937 throw new UnsupportedError("Cannot removeAt on immutable List."); 7937 throw new UnsupportedError("Cannot removeAt on immutable List.");
7938 } 7938 }
7939 7939
7940 Transform removeLast() { 7940 Transform removeLast() {
7941 throw new UnsupportedError("Cannot removeLast on immutable List."); 7941 throw new UnsupportedError("Cannot removeLast on immutable List.");
7942 } 7942 }
7943 7943
7944 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom ]) { 7944 void setRange(int start, int rangeLength, List<Transform> from, [int startFrom ]) {
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
8378 // From Iterable<ElementInstance>: 8378 // From Iterable<ElementInstance>:
8379 8379
8380 Iterator<ElementInstance> get iterator { 8380 Iterator<ElementInstance> get iterator {
8381 // Note: NodeLists are not fixed size. And most probably length shouldn't 8381 // Note: NodeLists are not fixed size. And most probably length shouldn't
8382 // be cached in both iterator _and_ forEach method. For now caching it 8382 // be cached in both iterator _and_ forEach method. For now caching it
8383 // for consistency. 8383 // for consistency.
8384 return new FixedSizeListIterator<ElementInstance>(this); 8384 return new FixedSizeListIterator<ElementInstance>(this);
8385 } 8385 }
8386 8386
8387 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance) ) { 8387 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ElementInstance) ) {
8388 return Collections.reduce(this, initialValue, combine); 8388 return IterableMixinWorkaround.reduce(this, initialValue, combine);
8389 } 8389 }
8390 8390
8391 bool contains(ElementInstance element) => Collections.contains(this, element); 8391 bool contains(ElementInstance element) => IterableMixinWorkaround.contains(thi s, element);
8392 8392
8393 void forEach(void f(ElementInstance element)) => Collections.forEach(this, f); 8393 void forEach(void f(ElementInstance element)) => IterableMixinWorkaround.forEa ch(this, f);
8394 8394
8395 String join([String separator]) => Collections.joinList(this, separator); 8395 String join([String separator]) => IterableMixinWorkaround.joinList(this, sepa rator);
8396 8396
8397 List mappedBy(f(ElementInstance element)) => new MappedList<ElementInstance, d ynamic>(this, f); 8397 List mappedBy(f(ElementInstance element)) => IterableMixinWorkaround.mappedByL ist(this, f);
8398 8398
8399 Iterable<ElementInstance> where(bool f(ElementInstance element)) => new WhereI terable<ElementInstance>(this, f); 8399 Iterable<ElementInstance> where(bool f(ElementInstance element)) => IterableMi xinWorkaround.where(this, f);
8400 8400
8401 bool every(bool f(ElementInstance element)) => Collections.every(this, f); 8401 bool every(bool f(ElementInstance element)) => IterableMixinWorkaround.every(t his, f);
8402 8402
8403 bool any(bool f(ElementInstance element)) => Collections.any(this, f); 8403 bool any(bool f(ElementInstance element)) => IterableMixinWorkaround.any(this, f);
8404 8404
8405 List<ElementInstance> toList() => new List<ElementInstance>.from(this); 8405 List<ElementInstance> toList() => new List<ElementInstance>.from(this);
8406 Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this); 8406 Set<ElementInstance> toSet() => new Set<ElementInstance>.from(this);
8407 8407
8408 bool get isEmpty => this.length == 0; 8408 bool get isEmpty => this.length == 0;
8409 8409
8410 List<ElementInstance> take(int n) => new ListView<ElementInstance>(this, 0, n) ; 8410 List<ElementInstance> take(int n) => IterableMixinWorkaround.takeList(this, n) ;
8411 8411
8412 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) { 8412 Iterable<ElementInstance> takeWhile(bool test(ElementInstance value)) {
8413 return new TakeWhileIterable<ElementInstance>(this, test); 8413 return IterableMixinWorkaround.takeWhile(this, test);
8414 } 8414 }
8415 8415
8416 List<ElementInstance> skip(int n) => new ListView<ElementInstance>(this, n, nu ll); 8416 List<ElementInstance> skip(int n) => IterableMixinWorkaround.skipList(this, n) ;
8417 8417
8418 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) { 8418 Iterable<ElementInstance> skipWhile(bool test(ElementInstance value)) {
8419 return new SkipWhileIterable<ElementInstance>(this, test); 8419 return IterableMixinWorkaround.skipWhile(this, test);
8420 } 8420 }
8421 8421
8422 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta nce orElse() }) { 8422 ElementInstance firstMatching(bool test(ElementInstance value), { ElementInsta nce orElse() }) {
8423 return Collections.firstMatching(this, test, orElse); 8423 return IterableMixinWorkaround.firstMatching(this, test, orElse);
8424 } 8424 }
8425 8425
8426 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc e orElse()}) { 8426 ElementInstance lastMatching(bool test(ElementInstance value), {ElementInstanc e orElse()}) {
8427 return Collections.lastMatchingInList(this, test, orElse); 8427 return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
8428 } 8428 }
8429 8429
8430 ElementInstance singleMatching(bool test(ElementInstance value)) { 8430 ElementInstance singleMatching(bool test(ElementInstance value)) {
8431 return Collections.singleMatching(this, test); 8431 return IterableMixinWorkaround.singleMatching(this, test);
8432 } 8432 }
8433 8433
8434 ElementInstance elementAt(int index) { 8434 ElementInstance elementAt(int index) {
8435 return this[index]; 8435 return this[index];
8436 } 8436 }
8437 8437
8438 // From Collection<ElementInstance>: 8438 // From Collection<ElementInstance>:
8439 8439
8440 void add(ElementInstance value) { 8440 void add(ElementInstance value) {
8441 throw new UnsupportedError("Cannot add to immutable List."); 8441 throw new UnsupportedError("Cannot add to immutable List.");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
8479 if (this.length > 0) return this[this.length - 1]; 8479 if (this.length > 0) return this[this.length - 1];
8480 throw new StateError("No elements"); 8480 throw new StateError("No elements");
8481 } 8481 }
8482 8482
8483 ElementInstance get single { 8483 ElementInstance get single {
8484 if (length == 1) return this[0]; 8484 if (length == 1) return this[0];
8485 if (length == 0) throw new StateError("No elements"); 8485 if (length == 0) throw new StateError("No elements");
8486 throw new StateError("More than one element"); 8486 throw new StateError("More than one element");
8487 } 8487 }
8488 8488
8489 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => Co llections.min(this, compare); 8489 ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => It erableMixinWorkaround.min(this, compare);
8490 8490
8491 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => Co llections.max(this, compare); 8491 ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => It erableMixinWorkaround.max(this, compare);
8492 8492
8493 ElementInstance removeAt(int pos) { 8493 ElementInstance removeAt(int pos) {
8494 throw new UnsupportedError("Cannot removeAt on immutable List."); 8494 throw new UnsupportedError("Cannot removeAt on immutable List.");
8495 } 8495 }
8496 8496
8497 ElementInstance removeLast() { 8497 ElementInstance removeLast() {
8498 throw new UnsupportedError("Cannot removeLast on immutable List."); 8498 throw new UnsupportedError("Cannot removeLast on immutable List.");
8499 } 8499 }
8500 8500
8501 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta rtFrom]) { 8501 void setRange(int start, int rangeLength, List<ElementInstance> from, [int sta rtFrom]) {
(...skipping 11 matching lines...) Expand all
8513 List<ElementInstance> getRange(int start, int rangeLength) => 8513 List<ElementInstance> getRange(int start, int rangeLength) =>
8514 Lists.getRange(this, start, rangeLength, <ElementInstance>[]); 8514 Lists.getRange(this, start, rangeLength, <ElementInstance>[]);
8515 8515
8516 // -- end List<ElementInstance> mixins. 8516 // -- end List<ElementInstance> mixins.
8517 8517
8518 8518
8519 /** @domName SVGElementInstanceList.item */ 8519 /** @domName SVGElementInstanceList.item */
8520 ElementInstance item(int index) native "SVGElementInstanceList_item_Callback"; 8520 ElementInstance item(int index) native "SVGElementInstanceList_item_Callback";
8521 8521
8522 } 8522 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698