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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11783009: Big merge from experimental to bleeding edge. (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
« no previous file with comments | « sdk/lib/crypto/sha256.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:async';
3 import 'dart:collection'; 4 import 'dart:collection';
4 import 'dart:html_common'; 5 import 'dart:html_common';
5 import 'dart:indexed_db'; 6 import 'dart:indexed_db';
6 import 'dart:isolate'; 7 import 'dart:isolate';
7 import 'dart:json'; 8 import 'dart:json' as json;
8 import 'dart:math'; 9 import 'dart:math';
9 import 'dart:svg' as svg; 10 import 'dart:svg' as svg;
10 import 'dart:web_audio' as web_audio; 11 import 'dart:web_audio' as web_audio;
11 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 12 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
12 // for details. All rights reserved. Use of this source code is governed by a 13 // for details. All rights reserved. Use of this source code is governed by a
13 // BSD-style license that can be found in the LICENSE file. 14 // BSD-style license that can be found in the LICENSE file.
14 15
15 // DO NOT EDIT 16 // DO NOT EDIT
16 // Auto-generated dart:html library. 17 // Auto-generated dart:html library.
17 18
(...skipping 5974 matching lines...) Expand 10 before | Expand all | Expand 10 after
5992 * var items = document.queryAll('.itemClassName'); 5993 * var items = document.queryAll('.itemClassName');
5993 * 5994 *
5994 * For details about CSS selector syntax, see the 5995 * For details about CSS selector syntax, see the
5995 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). 5996 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/).
5996 */ 5997 */
5997 List<Element> queryAll(String selectors) { 5998 List<Element> queryAll(String selectors) {
5998 if (new RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) { 5999 if (new RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
5999 final mutableMatches = $dom_getElementsByName( 6000 final mutableMatches = $dom_getElementsByName(
6000 selectors.substring(7,selectors.length - 2)); 6001 selectors.substring(7,selectors.length - 2));
6001 int len = mutableMatches.length; 6002 int len = mutableMatches.length;
6002 final copyOfMatches = new List<Element>(len); 6003 final copyOfMatches = new List<Element>.fixedLength(len);
6003 for (int i = 0; i < len; ++i) { 6004 for (int i = 0; i < len; ++i) {
6004 copyOfMatches[i] = mutableMatches[i]; 6005 copyOfMatches[i] = mutableMatches[i];
6005 } 6006 }
6006 return new _FrozenElementList._wrap(copyOfMatches); 6007 return new _FrozenElementList._wrap(copyOfMatches);
6007 } else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) { 6008 } else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
6008 final mutableMatches = $dom_getElementsByTagName(selectors); 6009 final mutableMatches = $dom_getElementsByTagName(selectors);
6009 int len = mutableMatches.length; 6010 int len = mutableMatches.length;
6010 final copyOfMatches = new List<Element>(len); 6011 final copyOfMatches = new List<Element>.fixedLength(len);
6011 for (int i = 0; i < len; ++i) { 6012 for (int i = 0; i < len; ++i) {
6012 copyOfMatches[i] = mutableMatches[i]; 6013 copyOfMatches[i] = mutableMatches[i];
6013 } 6014 }
6014 return new _FrozenElementList._wrap(copyOfMatches); 6015 return new _FrozenElementList._wrap(copyOfMatches);
6015 } else { 6016 } else {
6016 return new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); 6017 return new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
6017 } 6018 }
6018 } 6019 }
6019 } 6020 }
6020 6021
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
6487 DomMimeType operator[](int index) => JS("DomMimeType", "#[#]", this, index); 6488 DomMimeType operator[](int index) => JS("DomMimeType", "#[#]", this, index);
6488 6489
6489 void operator[]=(int index, DomMimeType value) { 6490 void operator[]=(int index, DomMimeType value) {
6490 throw new UnsupportedError("Cannot assign element of immutable List."); 6491 throw new UnsupportedError("Cannot assign element of immutable List.");
6491 } 6492 }
6492 // -- start List<DomMimeType> mixins. 6493 // -- start List<DomMimeType> mixins.
6493 // DomMimeType is the element type. 6494 // DomMimeType is the element type.
6494 6495
6495 // From Iterable<DomMimeType>: 6496 // From Iterable<DomMimeType>:
6496 6497
6497 Iterator<DomMimeType> iterator() { 6498 Iterator<DomMimeType> get iterator {
6498 // Note: NodeLists are not fixed size. And most probably length shouldn't 6499 // Note: NodeLists are not fixed size. And most probably length shouldn't
6499 // be cached in both iterator _and_ forEach method. For now caching it 6500 // be cached in both iterator _and_ forEach method. For now caching it
6500 // for consistency. 6501 // for consistency.
6501 return new FixedSizeListIterator<DomMimeType>(this); 6502 return new FixedSizeListIterator<DomMimeType>(this);
6502 } 6503 }
6503 6504
6504 // From Collection<DomMimeType>:
6505
6506 void add(DomMimeType value) {
6507 throw new UnsupportedError("Cannot add to immutable List.");
6508 }
6509
6510 void addLast(DomMimeType value) {
6511 throw new UnsupportedError("Cannot add to immutable List.");
6512 }
6513
6514 void addAll(Collection<DomMimeType> collection) {
6515 throw new UnsupportedError("Cannot add to immutable List.");
6516 }
6517
6518 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomMimeType)) { 6505 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomMimeType)) {
6519 return Collections.reduce(this, initialValue, combine); 6506 return Collections.reduce(this, initialValue, combine);
6520 } 6507 }
6521 6508
6522 bool contains(DomMimeType element) => Collections.contains(this, element); 6509 bool contains(DomMimeType element) => Collections.contains(this, element);
6523 6510
6524 void forEach(void f(DomMimeType element)) => Collections.forEach(this, f); 6511 void forEach(void f(DomMimeType element)) => Collections.forEach(this, f);
6525 6512
6526 Collection map(f(DomMimeType element)) => Collections.map(this, [], f); 6513 String join([String separator]) => Collections.joinList(this, separator);
6527 6514
6528 Collection<DomMimeType> filter(bool f(DomMimeType element)) => 6515 List mappedBy(f(DomMimeType element)) => new MappedList<DomMimeType, dynamic>( this, f);
6529 Collections.filter(this, <DomMimeType>[], f); 6516
6517 Iterable<DomMimeType> where(bool f(DomMimeType element)) => new WhereIterable< DomMimeType>(this, f);
6530 6518
6531 bool every(bool f(DomMimeType element)) => Collections.every(this, f); 6519 bool every(bool f(DomMimeType element)) => Collections.every(this, f);
6532 6520
6533 bool some(bool f(DomMimeType element)) => Collections.some(this, f); 6521 bool any(bool f(DomMimeType element)) => Collections.any(this, f);
6534 6522
6535 bool get isEmpty => this.length == 0; 6523 bool get isEmpty => this.length == 0;
6536 6524
6525 List<DomMimeType> take(int n) => new ListView<DomMimeType>(this, 0, n);
6526
6527 Iterable<DomMimeType> takeWhile(bool test(DomMimeType value)) {
6528 return new TakeWhileIterable<DomMimeType>(this, test);
6529 }
6530
6531 List<DomMimeType> skip(int n) => new ListView<DomMimeType>(this, n, null);
6532
6533 Iterable<DomMimeType> skipWhile(bool test(DomMimeType value)) {
6534 return new SkipWhileIterable<DomMimeType>(this, test);
6535 }
6536
6537 DomMimeType firstMatching(bool test(DomMimeType value), { DomMimeType orElse() }) {
6538 return Collections.firstMatching(this, test, orElse);
6539 }
6540
6541 DomMimeType lastMatching(bool test(DomMimeType value), {DomMimeType orElse()}) {
6542 return Collections.lastMatchingInList(this, test, orElse);
6543 }
6544
6545 DomMimeType singleMatching(bool test(DomMimeType value)) {
6546 return Collections.singleMatching(this, test);
6547 }
6548
6549 DomMimeType elementAt(int index) {
6550 return this[index];
6551 }
6552
6553 // From Collection<DomMimeType>:
6554
6555 void add(DomMimeType value) {
6556 throw new UnsupportedError("Cannot add to immutable List.");
6557 }
6558
6559 void addLast(DomMimeType value) {
6560 throw new UnsupportedError("Cannot add to immutable List.");
6561 }
6562
6563 void addAll(Iterable<DomMimeType> iterable) {
6564 throw new UnsupportedError("Cannot add to immutable List.");
6565 }
6566
6537 // From List<DomMimeType>: 6567 // From List<DomMimeType>:
6538 void set length(int value) { 6568 void set length(int value) {
6539 throw new UnsupportedError("Cannot resize immutable List."); 6569 throw new UnsupportedError("Cannot resize immutable List.");
6540 } 6570 }
6541 6571
6542 void clear() { 6572 void clear() {
6543 throw new UnsupportedError("Cannot clear immutable List."); 6573 throw new UnsupportedError("Cannot clear immutable List.");
6544 } 6574 }
6545 6575
6546 void sort([int compare(DomMimeType a, DomMimeType b)]) { 6576 void sort([int compare(DomMimeType a, DomMimeType b)]) {
6547 throw new UnsupportedError("Cannot sort immutable List."); 6577 throw new UnsupportedError("Cannot sort immutable List.");
6548 } 6578 }
6549 6579
6550 int indexOf(DomMimeType element, [int start = 0]) => 6580 int indexOf(DomMimeType element, [int start = 0]) =>
6551 Lists.indexOf(this, element, start, this.length); 6581 Lists.indexOf(this, element, start, this.length);
6552 6582
6553 int lastIndexOf(DomMimeType element, [int start]) { 6583 int lastIndexOf(DomMimeType element, [int start]) {
6554 if (start == null) start = length - 1; 6584 if (start == null) start = length - 1;
6555 return Lists.lastIndexOf(this, element, start); 6585 return Lists.lastIndexOf(this, element, start);
6556 } 6586 }
6557 6587
6558 DomMimeType get first => this[0]; 6588 DomMimeType get first {
6589 if (this.length > 0) return this[0];
6590 throw new StateError("No elements");
6591 }
6559 6592
6560 DomMimeType get last => this[length - 1]; 6593 DomMimeType get last {
6594 if (this.length > 0) return this[this.length - 1];
6595 throw new StateError("No elements");
6596 }
6597
6598 DomMimeType get single {
6599 if (length == 1) return this[0];
6600 if (length == 0) throw new StateError("No elements");
6601 throw new StateError("More than one element");
6602 }
6603
6604 DomMimeType min([int compare(DomMimeType a, DomMimeType b)]) => _Collections.m inInList(this, compare);
6605
6606 DomMimeType max([int compare(DomMimeType a, DomMimeType b)]) => _Collections.m axInList(this, compare);
6561 6607
6562 DomMimeType removeAt(int pos) { 6608 DomMimeType removeAt(int pos) {
6563 throw new UnsupportedError("Cannot removeAt on immutable List."); 6609 throw new UnsupportedError("Cannot removeAt on immutable List.");
6564 } 6610 }
6565 6611
6566 DomMimeType removeLast() { 6612 DomMimeType removeLast() {
6567 throw new UnsupportedError("Cannot removeLast on immutable List."); 6613 throw new UnsupportedError("Cannot removeLast on immutable List.");
6568 } 6614 }
6569 6615
6570 void setRange(int start, int rangeLength, List<DomMimeType> from, [int startFr om]) { 6616 void setRange(int start, int rangeLength, List<DomMimeType> from, [int startFr om]) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
6645 DomPlugin operator[](int index) => JS("DomPlugin", "#[#]", this, index); 6691 DomPlugin operator[](int index) => JS("DomPlugin", "#[#]", this, index);
6646 6692
6647 void operator[]=(int index, DomPlugin value) { 6693 void operator[]=(int index, DomPlugin value) {
6648 throw new UnsupportedError("Cannot assign element of immutable List."); 6694 throw new UnsupportedError("Cannot assign element of immutable List.");
6649 } 6695 }
6650 // -- start List<DomPlugin> mixins. 6696 // -- start List<DomPlugin> mixins.
6651 // DomPlugin is the element type. 6697 // DomPlugin is the element type.
6652 6698
6653 // From Iterable<DomPlugin>: 6699 // From Iterable<DomPlugin>:
6654 6700
6655 Iterator<DomPlugin> iterator() { 6701 Iterator<DomPlugin> get iterator {
6656 // Note: NodeLists are not fixed size. And most probably length shouldn't 6702 // Note: NodeLists are not fixed size. And most probably length shouldn't
6657 // be cached in both iterator _and_ forEach method. For now caching it 6703 // be cached in both iterator _and_ forEach method. For now caching it
6658 // for consistency. 6704 // for consistency.
6659 return new FixedSizeListIterator<DomPlugin>(this); 6705 return new FixedSizeListIterator<DomPlugin>(this);
6660 } 6706 }
6661 6707
6662 // From Collection<DomPlugin>:
6663
6664 void add(DomPlugin value) {
6665 throw new UnsupportedError("Cannot add to immutable List.");
6666 }
6667
6668 void addLast(DomPlugin value) {
6669 throw new UnsupportedError("Cannot add to immutable List.");
6670 }
6671
6672 void addAll(Collection<DomPlugin> collection) {
6673 throw new UnsupportedError("Cannot add to immutable List.");
6674 }
6675
6676 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomPlugin)) { 6708 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomPlugin)) {
6677 return Collections.reduce(this, initialValue, combine); 6709 return Collections.reduce(this, initialValue, combine);
6678 } 6710 }
6679 6711
6680 bool contains(DomPlugin element) => Collections.contains(this, element); 6712 bool contains(DomPlugin element) => Collections.contains(this, element);
6681 6713
6682 void forEach(void f(DomPlugin element)) => Collections.forEach(this, f); 6714 void forEach(void f(DomPlugin element)) => Collections.forEach(this, f);
6683 6715
6684 Collection map(f(DomPlugin element)) => Collections.map(this, [], f); 6716 String join([String separator]) => Collections.joinList(this, separator);
6685 6717
6686 Collection<DomPlugin> filter(bool f(DomPlugin element)) => 6718 List mappedBy(f(DomPlugin element)) => new MappedList<DomPlugin, dynamic>(this , f);
6687 Collections.filter(this, <DomPlugin>[], f); 6719
6720 Iterable<DomPlugin> where(bool f(DomPlugin element)) => new WhereIterable<DomP lugin>(this, f);
6688 6721
6689 bool every(bool f(DomPlugin element)) => Collections.every(this, f); 6722 bool every(bool f(DomPlugin element)) => Collections.every(this, f);
6690 6723
6691 bool some(bool f(DomPlugin element)) => Collections.some(this, f); 6724 bool any(bool f(DomPlugin element)) => Collections.any(this, f);
6692 6725
6693 bool get isEmpty => this.length == 0; 6726 bool get isEmpty => this.length == 0;
6694 6727
6728 List<DomPlugin> take(int n) => new ListView<DomPlugin>(this, 0, n);
6729
6730 Iterable<DomPlugin> takeWhile(bool test(DomPlugin value)) {
6731 return new TakeWhileIterable<DomPlugin>(this, test);
6732 }
6733
6734 List<DomPlugin> skip(int n) => new ListView<DomPlugin>(this, n, null);
6735
6736 Iterable<DomPlugin> skipWhile(bool test(DomPlugin value)) {
6737 return new SkipWhileIterable<DomPlugin>(this, test);
6738 }
6739
6740 DomPlugin firstMatching(bool test(DomPlugin value), { DomPlugin orElse() }) {
6741 return Collections.firstMatching(this, test, orElse);
6742 }
6743
6744 DomPlugin lastMatching(bool test(DomPlugin value), {DomPlugin orElse()}) {
6745 return Collections.lastMatchingInList(this, test, orElse);
6746 }
6747
6748 DomPlugin singleMatching(bool test(DomPlugin value)) {
6749 return Collections.singleMatching(this, test);
6750 }
6751
6752 DomPlugin elementAt(int index) {
6753 return this[index];
6754 }
6755
6756 // From Collection<DomPlugin>:
6757
6758 void add(DomPlugin value) {
6759 throw new UnsupportedError("Cannot add to immutable List.");
6760 }
6761
6762 void addLast(DomPlugin value) {
6763 throw new UnsupportedError("Cannot add to immutable List.");
6764 }
6765
6766 void addAll(Iterable<DomPlugin> iterable) {
6767 throw new UnsupportedError("Cannot add to immutable List.");
6768 }
6769
6695 // From List<DomPlugin>: 6770 // From List<DomPlugin>:
6696 void set length(int value) { 6771 void set length(int value) {
6697 throw new UnsupportedError("Cannot resize immutable List."); 6772 throw new UnsupportedError("Cannot resize immutable List.");
6698 } 6773 }
6699 6774
6700 void clear() { 6775 void clear() {
6701 throw new UnsupportedError("Cannot clear immutable List."); 6776 throw new UnsupportedError("Cannot clear immutable List.");
6702 } 6777 }
6703 6778
6704 void sort([int compare(DomPlugin a, DomPlugin b)]) { 6779 void sort([int compare(DomPlugin a, DomPlugin b)]) {
6705 throw new UnsupportedError("Cannot sort immutable List."); 6780 throw new UnsupportedError("Cannot sort immutable List.");
6706 } 6781 }
6707 6782
6708 int indexOf(DomPlugin element, [int start = 0]) => 6783 int indexOf(DomPlugin element, [int start = 0]) =>
6709 Lists.indexOf(this, element, start, this.length); 6784 Lists.indexOf(this, element, start, this.length);
6710 6785
6711 int lastIndexOf(DomPlugin element, [int start]) { 6786 int lastIndexOf(DomPlugin element, [int start]) {
6712 if (start == null) start = length - 1; 6787 if (start == null) start = length - 1;
6713 return Lists.lastIndexOf(this, element, start); 6788 return Lists.lastIndexOf(this, element, start);
6714 } 6789 }
6715 6790
6716 DomPlugin get first => this[0]; 6791 DomPlugin get first {
6792 if (this.length > 0) return this[0];
6793 throw new StateError("No elements");
6794 }
6717 6795
6718 DomPlugin get last => this[length - 1]; 6796 DomPlugin get last {
6797 if (this.length > 0) return this[this.length - 1];
6798 throw new StateError("No elements");
6799 }
6800
6801 DomPlugin get single {
6802 if (length == 1) return this[0];
6803 if (length == 0) throw new StateError("No elements");
6804 throw new StateError("More than one element");
6805 }
6806
6807 DomPlugin min([int compare(DomPlugin a, DomPlugin b)]) => _Collections.minInLi st(this, compare);
6808
6809 DomPlugin max([int compare(DomPlugin a, DomPlugin b)]) => _Collections.maxInLi st(this, compare);
6719 6810
6720 DomPlugin removeAt(int pos) { 6811 DomPlugin removeAt(int pos) {
6721 throw new UnsupportedError("Cannot removeAt on immutable List."); 6812 throw new UnsupportedError("Cannot removeAt on immutable List.");
6722 } 6813 }
6723 6814
6724 DomPlugin removeLast() { 6815 DomPlugin removeLast() {
6725 throw new UnsupportedError("Cannot removeLast on immutable List."); 6816 throw new UnsupportedError("Cannot removeLast on immutable List.");
6726 } 6817 }
6727 6818
6728 void setRange(int start, int rangeLength, List<DomPlugin> from, [int startFrom ]) { 6819 void setRange(int start, int rangeLength, List<DomPlugin> from, [int startFrom ]) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
6862 String operator[](int index) => JS("String", "#[#]", this, index); 6953 String operator[](int index) => JS("String", "#[#]", this, index);
6863 6954
6864 void operator[]=(int index, String value) { 6955 void operator[]=(int index, String value) {
6865 throw new UnsupportedError("Cannot assign element of immutable List."); 6956 throw new UnsupportedError("Cannot assign element of immutable List.");
6866 } 6957 }
6867 // -- start List<String> mixins. 6958 // -- start List<String> mixins.
6868 // String is the element type. 6959 // String is the element type.
6869 6960
6870 // From Iterable<String>: 6961 // From Iterable<String>:
6871 6962
6872 Iterator<String> iterator() { 6963 Iterator<String> get iterator {
6873 // Note: NodeLists are not fixed size. And most probably length shouldn't 6964 // Note: NodeLists are not fixed size. And most probably length shouldn't
6874 // be cached in both iterator _and_ forEach method. For now caching it 6965 // be cached in both iterator _and_ forEach method. For now caching it
6875 // for consistency. 6966 // for consistency.
6876 return new FixedSizeListIterator<String>(this); 6967 return new FixedSizeListIterator<String>(this);
6877 } 6968 }
6878 6969
6879 // From Collection<String>:
6880
6881 void add(String value) {
6882 throw new UnsupportedError("Cannot add to immutable List.");
6883 }
6884
6885 void addLast(String value) {
6886 throw new UnsupportedError("Cannot add to immutable List.");
6887 }
6888
6889 void addAll(Collection<String> collection) {
6890 throw new UnsupportedError("Cannot add to immutable List.");
6891 }
6892
6893 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { 6970 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) {
6894 return Collections.reduce(this, initialValue, combine); 6971 return Collections.reduce(this, initialValue, combine);
6895 } 6972 }
6896 6973
6897 // contains() defined by IDL. 6974 // contains() defined by IDL.
6898 6975
6899 void forEach(void f(String element)) => Collections.forEach(this, f); 6976 void forEach(void f(String element)) => Collections.forEach(this, f);
6900 6977
6901 Collection map(f(String element)) => Collections.map(this, [], f); 6978 String join([String separator]) => Collections.joinList(this, separator);
6902 6979
6903 Collection<String> filter(bool f(String element)) => 6980 List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f);
6904 Collections.filter(this, <String>[], f); 6981
6982 Iterable<String> where(bool f(String element)) => new WhereIterable<String>(th is, f);
6905 6983
6906 bool every(bool f(String element)) => Collections.every(this, f); 6984 bool every(bool f(String element)) => Collections.every(this, f);
6907 6985
6908 bool some(bool f(String element)) => Collections.some(this, f); 6986 bool any(bool f(String element)) => Collections.any(this, f);
6909 6987
6910 bool get isEmpty => this.length == 0; 6988 bool get isEmpty => this.length == 0;
6911 6989
6990 List<String> take(int n) => new ListView<String>(this, 0, n);
6991
6992 Iterable<String> takeWhile(bool test(String value)) {
6993 return new TakeWhileIterable<String>(this, test);
6994 }
6995
6996 List<String> skip(int n) => new ListView<String>(this, n, null);
6997
6998 Iterable<String> skipWhile(bool test(String value)) {
6999 return new SkipWhileIterable<String>(this, test);
7000 }
7001
7002 String firstMatching(bool test(String value), { String orElse() }) {
7003 return Collections.firstMatching(this, test, orElse);
7004 }
7005
7006 String lastMatching(bool test(String value), {String orElse()}) {
7007 return Collections.lastMatchingInList(this, test, orElse);
7008 }
7009
7010 String singleMatching(bool test(String value)) {
7011 return Collections.singleMatching(this, test);
7012 }
7013
7014 String elementAt(int index) {
7015 return this[index];
7016 }
7017
7018 // From Collection<String>:
7019
7020 void add(String value) {
7021 throw new UnsupportedError("Cannot add to immutable List.");
7022 }
7023
7024 void addLast(String value) {
7025 throw new UnsupportedError("Cannot add to immutable List.");
7026 }
7027
7028 void addAll(Iterable<String> iterable) {
7029 throw new UnsupportedError("Cannot add to immutable List.");
7030 }
7031
6912 // From List<String>: 7032 // From List<String>:
6913 void set length(int value) { 7033 void set length(int value) {
6914 throw new UnsupportedError("Cannot resize immutable List."); 7034 throw new UnsupportedError("Cannot resize immutable List.");
6915 } 7035 }
6916 7036
6917 void clear() { 7037 void clear() {
6918 throw new UnsupportedError("Cannot clear immutable List."); 7038 throw new UnsupportedError("Cannot clear immutable List.");
6919 } 7039 }
6920 7040
6921 void sort([int compare(String a, String b)]) { 7041 void sort([int compare(String a, String b)]) {
6922 throw new UnsupportedError("Cannot sort immutable List."); 7042 throw new UnsupportedError("Cannot sort immutable List.");
6923 } 7043 }
6924 7044
6925 int indexOf(String element, [int start = 0]) => 7045 int indexOf(String element, [int start = 0]) =>
6926 Lists.indexOf(this, element, start, this.length); 7046 Lists.indexOf(this, element, start, this.length);
6927 7047
6928 int lastIndexOf(String element, [int start]) { 7048 int lastIndexOf(String element, [int start]) {
6929 if (start == null) start = length - 1; 7049 if (start == null) start = length - 1;
6930 return Lists.lastIndexOf(this, element, start); 7050 return Lists.lastIndexOf(this, element, start);
6931 } 7051 }
6932 7052
6933 String get first => this[0]; 7053 String get first {
7054 if (this.length > 0) return this[0];
7055 throw new StateError("No elements");
7056 }
6934 7057
6935 String get last => this[length - 1]; 7058 String get last {
7059 if (this.length > 0) return this[this.length - 1];
7060 throw new StateError("No elements");
7061 }
7062
7063 String get single {
7064 if (length == 1) return this[0];
7065 if (length == 0) throw new StateError("No elements");
7066 throw new StateError("More than one element");
7067 }
7068
7069 String min([int compare(String a, String b)]) => _Collections.minInList(this, compare);
7070
7071 String max([int compare(String a, String b)]) => _Collections.maxInList(this, compare);
6936 7072
6937 String removeAt(int pos) { 7073 String removeAt(int pos) {
6938 throw new UnsupportedError("Cannot removeAt on immutable List."); 7074 throw new UnsupportedError("Cannot removeAt on immutable List.");
6939 } 7075 }
6940 7076
6941 String removeLast() { 7077 String removeLast() {
6942 throw new UnsupportedError("Cannot removeLast on immutable List."); 7078 throw new UnsupportedError("Cannot removeLast on immutable List.");
6943 } 7079 }
6944 7080
6945 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) { 7081 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
7005 // functionality. 7141 // functionality.
7006 class _ChildrenElementList implements List { 7142 class _ChildrenElementList implements List {
7007 // Raw Element. 7143 // Raw Element.
7008 final Element _element; 7144 final Element _element;
7009 final HtmlCollection _childElements; 7145 final HtmlCollection _childElements;
7010 7146
7011 _ChildrenElementList._wrap(Element element) 7147 _ChildrenElementList._wrap(Element element)
7012 : _childElements = element.$dom_children, 7148 : _childElements = element.$dom_children,
7013 _element = element; 7149 _element = element;
7014 7150
7015 List<Element> _toList() { 7151 List<Element> toList() {
7016 final output = new List(_childElements.length); 7152 final output = new List<Element>.fixedLength(_childElements.length);
7017 for (int i = 0, len = _childElements.length; i < len; i++) { 7153 for (int i = 0, len = _childElements.length; i < len; i++) {
7018 output[i] = _childElements[i]; 7154 output[i] = _childElements[i];
7019 } 7155 }
7020 return output; 7156 return output;
7021 } 7157 }
7022 7158
7159 Set<Element> toSet() {
7160 final output = new Set<Element>(_childElements.length);
7161 for (int i = 0, len = _childElements.length; i < len; i++) {
7162 output.add(_childElements[i]);
7163 }
7164 return output;
7165 }
7166
7023 bool contains(Element element) => _childElements.contains(element); 7167 bool contains(Element element) => _childElements.contains(element);
7024 7168
7025 void forEach(void f(Element element)) { 7169 void forEach(void f(Element element)) {
7026 for (Element element in _childElements) { 7170 for (Element element in _childElements) {
7027 f(element); 7171 f(element);
7028 } 7172 }
7029 } 7173 }
7030 7174
7031 List<Element> filter(bool f(Element element)) {
7032 final output = [];
7033 forEach((Element element) {
7034 if (f(element)) {
7035 output.add(element);
7036 }
7037 });
7038 return new _FrozenElementList._wrap(output);
7039 }
7040
7041 bool every(bool f(Element element)) { 7175 bool every(bool f(Element element)) {
7042 for (Element element in this) { 7176 for (Element element in this) {
7043 if (!f(element)) { 7177 if (!f(element)) {
7044 return false; 7178 return false;
7045 } 7179 }
7046 }; 7180 }
7047 return true; 7181 return true;
7048 } 7182 }
7049 7183
7050 bool some(bool f(Element element)) { 7184 bool any(bool f(Element element)) {
7051 for (Element element in this) { 7185 for (Element element in this) {
7052 if (f(element)) { 7186 if (f(element)) {
7053 return true; 7187 return true;
7054 } 7188 }
7055 }; 7189 }
7056 return false; 7190 return false;
7057 } 7191 }
7058 7192
7059 Collection map(f(Element element)) { 7193 String join([String separator]) {
7060 final out = []; 7194 return Collections.joinList(this, separator);
7061 for (Element el in this) {
7062 out.add(f(el));
7063 }
7064 return out;
7065 } 7195 }
7066 7196
7197 List mappedBy(f(Element element)) {
7198 return new MappedList<Element, dynamic>(this, f);
7199 }
7200
7201 Iterable<Element> where(bool f(Element element))
7202 => new WhereIterable<Element>(this, f);
7203
7067 bool get isEmpty { 7204 bool get isEmpty {
7068 return _element.$dom_firstElementChild == null; 7205 return _element.$dom_firstElementChild == null;
7069 } 7206 }
7070 7207
7208 List<Element> take(int n) {
7209 return new ListView<Element>(this, 0, n);
7210 }
7211
7212 Iterable<Element> takeWhile(bool test(Element value)) {
7213 return new TakeWhileIterable<Element>(this, test);
7214 }
7215
7216 List<Element> skip(int n) {
7217 return new ListView<Element>(this, n, null);
7218 }
7219
7220 Iterable<Element> skipWhile(bool test(Element value)) {
7221 return new SkipWhileIterable<Element>(this, test);
7222 }
7223
7224 Element firstMatching(bool test(Element value), {Element orElse()}) {
7225 return Collections.firstMatching(this, test, orElse);
7226 }
7227
7228 Element lastMatching(bool test(Element value), {Element orElse()}) {
7229 return Collections.lastMatchingInList(this, test, orElse);
7230 }
7231
7232 Element singleMatching(bool test(Element value)) {
7233 return Collections.singleMatching(this, test);
7234 }
7235
7236 Element elementAt(int index) {
7237 return this[index];
7238 }
7239
7071 int get length { 7240 int get length {
7072 return _childElements.length; 7241 return _childElements.length;
7073 } 7242 }
7074 7243
7075 Element operator [](int index) { 7244 Element operator [](int index) {
7076 return _childElements[index]; 7245 return _childElements[index];
7077 } 7246 }
7078 7247
7079 void operator []=(int index, Element value) { 7248 void operator []=(int index, Element value) {
7080 _element.$dom_replaceChild(value, _childElements[index]); 7249 _element.$dom_replaceChild(value, _childElements[index]);
7081 } 7250 }
7082 7251
7083 void set length(int newLength) { 7252 void set length(int newLength) {
7084 // TODO(jacobr): remove children when length is reduced. 7253 // TODO(jacobr): remove children when length is reduced.
7085 throw new UnsupportedError(''); 7254 throw new UnsupportedError('');
7086 } 7255 }
7087 7256
7088 Element add(Element value) { 7257 Element add(Element value) {
7089 _element.$dom_appendChild(value); 7258 _element.$dom_appendChild(value);
7090 return value; 7259 return value;
7091 } 7260 }
7092 7261
7093 Element addLast(Element value) => add(value); 7262 Element addLast(Element value) => add(value);
7094 7263
7095 Iterator<Element> iterator() => _toList().iterator(); 7264 Iterator<Element> get iterator => toList().iterator;
7096 7265
7097 void addAll(Collection<Element> collection) { 7266 void addAll(Iterable<Element> iterable) {
7098 for (Element element in collection) { 7267 for (Element element in iterable) {
7099 _element.$dom_appendChild(element); 7268 _element.$dom_appendChild(element);
7100 } 7269 }
7101 } 7270 }
7102 7271
7103 void sort([int compare(Element a, Element b)]) { 7272 void sort([int compare(Element a, Element b)]) {
7104 throw new UnsupportedError('TODO(jacobr): should we impl?'); 7273 throw new UnsupportedError('TODO(jacobr): should we impl?');
7105 } 7274 }
7106 7275
7107 dynamic reduce(dynamic initialValue, 7276 dynamic reduce(dynamic initialValue,
7108 dynamic combine(dynamic previousValue, Element element)) { 7277 dynamic combine(dynamic previousValue, Element element)) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
7149 7318
7150 Element removeLast() { 7319 Element removeLast() {
7151 final result = this.last; 7320 final result = this.last;
7152 if (result != null) { 7321 if (result != null) {
7153 _element.$dom_removeChild(result); 7322 _element.$dom_removeChild(result);
7154 } 7323 }
7155 return result; 7324 return result;
7156 } 7325 }
7157 7326
7158 Element get first { 7327 Element get first {
7159 return _element.$dom_firstElementChild; 7328 Element result = _element.$dom_firstElementChild;
7329 if (result == null) throw new StateError("No elements");
7330 return result;
7160 } 7331 }
7161 7332
7162 7333
7163 Element get last { 7334 Element get last {
7164 return _element.$dom_lastElementChild; 7335 Element result = _element.$dom_lastElementChild;
7336 if (result == null) throw new StateError("No elements");
7337 return result;
7338 }
7339
7340 Element get single {
7341 if (length > 1) throw new StateError("More than one element");
7342 return first;
7343 }
7344
7345 Element min([int compare(Element a, Element b)]) {
7346 return _Collections.minInList(this, compare);
7347 }
7348
7349 Element max([int compare(Element a, Element b)]) {
7350 return _Collections.maxInList(this, compare);
7165 } 7351 }
7166 } 7352 }
7167 7353
7168 // TODO(jacobr): this is an inefficient implementation but it is hard to see 7354 // TODO(jacobr): this is an inefficient implementation but it is hard to see
7169 // a better option given that we cannot quite force NodeList to be an 7355 // a better option given that we cannot quite force NodeList to be an
7170 // ElementList as there are valid cases where a NodeList JavaScript object 7356 // ElementList as there are valid cases where a NodeList JavaScript object
7171 // contains Node objects that are not Elements. 7357 // contains Node objects that are not Elements.
7172 class _FrozenElementList implements List { 7358 class _FrozenElementList implements List {
7173 final List<Node> _nodeList; 7359 final List<Node> _nodeList;
7174 7360
7175 _FrozenElementList._wrap(this._nodeList); 7361 _FrozenElementList._wrap(this._nodeList);
7176 7362
7177 bool contains(Element element) { 7363 bool contains(Element element) {
7178 for (Element el in this) { 7364 for (Element el in this) {
7179 if (el == element) return true; 7365 if (el == element) return true;
7180 } 7366 }
7181 return false; 7367 return false;
7182 } 7368 }
7183 7369
7184 void forEach(void f(Element element)) { 7370 void forEach(void f(Element element)) {
7185 for (Element el in this) { 7371 for (Element el in this) {
7186 f(el); 7372 f(el);
7187 } 7373 }
7188 } 7374 }
7189 7375
7190 Collection map(f(Element element)) { 7376 String join([String separator]) {
7191 final out = []; 7377 return Collections.joinList(this, separator);
7192 for (Element el in this) {
7193 out.add(f(el));
7194 }
7195 return out;
7196 } 7378 }
7197 7379
7198 List<Element> filter(bool f(Element element)) { 7380 List mappedBy(f(Element element)) {
7199 final out = []; 7381 return new MappedList<Element, dynamic>(this, f);
7200 for (Element el in this) {
7201 if (f(el)) out.add(el);
7202 }
7203 return out;
7204 } 7382 }
7205 7383
7384 Iterable<Element> where(bool f(Element element))
7385 => new WhereIterable<Element>(this, f);
7386
7206 bool every(bool f(Element element)) { 7387 bool every(bool f(Element element)) {
7207 for(Element element in this) { 7388 for(Element element in this) {
7208 if (!f(element)) { 7389 if (!f(element)) {
7209 return false; 7390 return false;
7210 } 7391 }
7211 }; 7392 };
7212 return true; 7393 return true;
7213 } 7394 }
7214 7395
7215 bool some(bool f(Element element)) { 7396 bool any(bool f(Element element)) {
7216 for(Element element in this) { 7397 for(Element element in this) {
7217 if (f(element)) { 7398 if (f(element)) {
7218 return true; 7399 return true;
7219 } 7400 }
7220 }; 7401 };
7221 return false; 7402 return false;
7222 } 7403 }
7223 7404
7405 List<Element> take(int n) {
7406 return new ListView<Element>(this, 0, n);
7407 }
7408
7409 Iterable<Element> takeWhile(bool test(T value)) {
7410 return new TakeWhileIterable<Element>(this, test);
7411 }
7412
7413 List<Element> skip(int n) {
7414 return new ListView<Element>(this, n, null);
7415 }
7416
7417 Iterable<Element> skipWhile(bool test(T value)) {
7418 return new SkipWhileIterable<Element>(this, test);
7419 }
7420
7421 Element firstMatching(bool test(Element value), {Element orElse()}) {
7422 return Collections.firstMatching(this, test, orElse);
7423 }
7424
7425 Element lastMatching(bool test(Element value), {Element orElse()}) {
7426 return Collections.lastMatchingInList(this, test, orElse);
7427 }
7428
7429 Element singleMatching(bool test(Element value)) {
7430 return Collections.singleMatching(this, test);
7431 }
7432
7433 Element elementAt(int index) {
7434 return this[index];
7435 }
7436
7224 bool get isEmpty => _nodeList.isEmpty; 7437 bool get isEmpty => _nodeList.isEmpty;
7225 7438
7226 int get length => _nodeList.length; 7439 int get length => _nodeList.length;
7227 7440
7228 Element operator [](int index) => _nodeList[index]; 7441 Element operator [](int index) => _nodeList[index];
7229 7442
7230 void operator []=(int index, Element value) { 7443 void operator []=(int index, Element value) {
7231 throw new UnsupportedError(''); 7444 throw new UnsupportedError('');
7232 } 7445 }
7233 7446
7234 void set length(int newLength) { 7447 void set length(int newLength) {
7235 _nodeList.length = newLength; 7448 _nodeList.length = newLength;
7236 } 7449 }
7237 7450
7238 void add(Element value) { 7451 void add(Element value) {
7239 throw new UnsupportedError(''); 7452 throw new UnsupportedError('');
7240 } 7453 }
7241 7454
7242 void addLast(Element value) { 7455 void addLast(Element value) {
7243 throw new UnsupportedError(''); 7456 throw new UnsupportedError('');
7244 } 7457 }
7245 7458
7246 Iterator<Element> iterator() => new _FrozenElementListIterator(this); 7459 Iterator<Element> get iterator => new _FrozenElementListIterator(this);
7247 7460
7248 void addAll(Collection<Element> collection) { 7461 void addAll(Iterable<Element> iterable) {
7249 throw new UnsupportedError(''); 7462 throw new UnsupportedError('');
7250 } 7463 }
7251 7464
7252 void sort([int compare(Element a, Element b)]) { 7465 void sort([int compare(Element a, Element b)]) {
7253 throw new UnsupportedError(''); 7466 throw new UnsupportedError('');
7254 } 7467 }
7255 7468
7256 dynamic reduce(dynamic initialValue, 7469 dynamic reduce(dynamic initialValue,
7257 dynamic combine(dynamic previousValue, Element element)) { 7470 dynamic combine(dynamic previousValue, Element element)) {
7258 return Collections.reduce(this, initialValue, combine); 7471 return Collections.reduce(this, initialValue, combine);
(...skipping 28 matching lines...) Expand all
7287 throw new UnsupportedError(''); 7500 throw new UnsupportedError('');
7288 } 7501 }
7289 7502
7290 Element removeLast() { 7503 Element removeLast() {
7291 throw new UnsupportedError(''); 7504 throw new UnsupportedError('');
7292 } 7505 }
7293 7506
7294 Element get first => _nodeList.first; 7507 Element get first => _nodeList.first;
7295 7508
7296 Element get last => _nodeList.last; 7509 Element get last => _nodeList.last;
7510
7511 Element get single => _nodeList.single;
7512
7513 Element min([int compare(Element a, Element b)]) {
7514 return _Collections.minInList(this, compare);
7515 }
7516
7517 Element max([int compare(Element a, Element b)]) {
7518 return _Collections.maxInList(this, compare);
7519 }
7297 } 7520 }
7298 7521
7299 class _FrozenElementListIterator implements Iterator<Element> { 7522 class _FrozenElementListIterator implements Iterator<Element> {
7300 final _FrozenElementList _list; 7523 final _FrozenElementList _list;
7301 int _index = 0; 7524 int _index = 0;
7302 7525
7303 _FrozenElementListIterator(this._list); 7526 _FrozenElementListIterator(this._list);
7304 7527
7305 /** 7528 /**
7306 * Gets the next element in the iteration. Throws a 7529 * Moves to the next element. Returns true if the iterator is positioned
7307 * [StateError("No more elements")] if no element is left. 7530 * at an element. Returns false if it is positioned after the last element.
7308 */ 7531 */
7309 Element next() { 7532 bool moveNext() {
7310 if (!hasNext) { 7533 int nextIndex = _index + 1;
7311 throw new StateError("No more elements"); 7534 if (nextIndex < _list.length) {
7535 _current = _list[nextIndex];
7536 _index = nextIndex;
7537 return true;
7312 } 7538 }
7313 7539 _index = _list.length;
7314 return _list[_index++]; 7540 _current = null;
7541 return false;
7315 } 7542 }
7316 7543
7317 /** 7544 /**
7318 * Returns whether the [Iterator] has elements left. 7545 * Returns the element the [Iterator] is positioned at.
7546 *
7547 * Return [:null:] if the iterator is positioned before the first, or
7548 * after the last element.
7319 */ 7549 */
7320 bool get hasNext => _index < _list.length; 7550 E get current => _current;
7321 } 7551 }
7322 7552
7323 class _ElementCssClassSet extends CssClassSet { 7553 class _ElementCssClassSet extends CssClassSet {
7324 7554
7325 final Element _element; 7555 final Element _element;
7326 7556
7327 _ElementCssClassSet(this._element); 7557 _ElementCssClassSet(this._element);
7328 7558
7329 Set<String> readClasses() { 7559 Set<String> readClasses() {
7330 var s = new Set<String>(); 7560 var s = new Set<String>();
7331 var classname = _element.$dom_className; 7561 var classname = _element.$dom_className;
7332 7562
7333 for (String name in classname.split(' ')) { 7563 for (String name in classname.split(' ')) {
7334 String trimmed = name.trim(); 7564 String trimmed = name.trim();
7335 if (!trimmed.isEmpty) { 7565 if (!trimmed.isEmpty) {
7336 s.add(trimmed); 7566 s.add(trimmed);
7337 } 7567 }
7338 } 7568 }
7339 return s; 7569 return s;
7340 } 7570 }
7341 7571
7342 void writeClasses(Set<String> s) { 7572 void writeClasses(Set<String> s) {
7343 List list = new List.from(s); 7573 List list = new List.from(s);
7344 _element.$dom_className = Strings.join(list, ' '); 7574 _element.$dom_className = s.join(' ');
7345 } 7575 }
7346 } 7576 }
7347 7577
7348 /** 7578 /**
7349 * An abstract class, which all HTML elements extend. 7579 * An abstract class, which all HTML elements extend.
7350 */ 7580 */
7351 abstract class Element extends Node implements ElementTraversal native "*Element " { 7581 abstract class Element extends Node implements ElementTraversal native "*Element " {
7352 7582
7353 /** 7583 /**
7354 * Creates an HTML element from a valid fragment of HTML. 7584 * Creates an HTML element from a valid fragment of HTML.
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
8840 File operator[](int index) => JS("File", "#[#]", this, index); 9070 File operator[](int index) => JS("File", "#[#]", this, index);
8841 9071
8842 void operator[]=(int index, File value) { 9072 void operator[]=(int index, File value) {
8843 throw new UnsupportedError("Cannot assign element of immutable List."); 9073 throw new UnsupportedError("Cannot assign element of immutable List.");
8844 } 9074 }
8845 // -- start List<File> mixins. 9075 // -- start List<File> mixins.
8846 // File is the element type. 9076 // File is the element type.
8847 9077
8848 // From Iterable<File>: 9078 // From Iterable<File>:
8849 9079
8850 Iterator<File> iterator() { 9080 Iterator<File> get iterator {
8851 // Note: NodeLists are not fixed size. And most probably length shouldn't 9081 // Note: NodeLists are not fixed size. And most probably length shouldn't
8852 // be cached in both iterator _and_ forEach method. For now caching it 9082 // be cached in both iterator _and_ forEach method. For now caching it
8853 // for consistency. 9083 // for consistency.
8854 return new FixedSizeListIterator<File>(this); 9084 return new FixedSizeListIterator<File>(this);
8855 } 9085 }
8856 9086
8857 // From Collection<File>:
8858
8859 void add(File value) {
8860 throw new UnsupportedError("Cannot add to immutable List.");
8861 }
8862
8863 void addLast(File value) {
8864 throw new UnsupportedError("Cannot add to immutable List.");
8865 }
8866
8867 void addAll(Collection<File> collection) {
8868 throw new UnsupportedError("Cannot add to immutable List.");
8869 }
8870
8871 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, File)) { 9087 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, File)) {
8872 return Collections.reduce(this, initialValue, combine); 9088 return Collections.reduce(this, initialValue, combine);
8873 } 9089 }
8874 9090
8875 bool contains(File element) => Collections.contains(this, element); 9091 bool contains(File element) => Collections.contains(this, element);
8876 9092
8877 void forEach(void f(File element)) => Collections.forEach(this, f); 9093 void forEach(void f(File element)) => Collections.forEach(this, f);
8878 9094
8879 Collection map(f(File element)) => Collections.map(this, [], f); 9095 String join([String separator]) => Collections.joinList(this, separator);
8880 9096
8881 Collection<File> filter(bool f(File element)) => 9097 List mappedBy(f(File element)) => new MappedList<File, dynamic>(this, f);
8882 Collections.filter(this, <File>[], f); 9098
9099 Iterable<File> where(bool f(File element)) => new WhereIterable<File>(this, f) ;
8883 9100
8884 bool every(bool f(File element)) => Collections.every(this, f); 9101 bool every(bool f(File element)) => Collections.every(this, f);
8885 9102
8886 bool some(bool f(File element)) => Collections.some(this, f); 9103 bool any(bool f(File element)) => Collections.any(this, f);
8887 9104
8888 bool get isEmpty => this.length == 0; 9105 bool get isEmpty => this.length == 0;
8889 9106
9107 List<File> take(int n) => new ListView<File>(this, 0, n);
9108
9109 Iterable<File> takeWhile(bool test(File value)) {
9110 return new TakeWhileIterable<File>(this, test);
9111 }
9112
9113 List<File> skip(int n) => new ListView<File>(this, n, null);
9114
9115 Iterable<File> skipWhile(bool test(File value)) {
9116 return new SkipWhileIterable<File>(this, test);
9117 }
9118
9119 File firstMatching(bool test(File value), { File orElse() }) {
9120 return Collections.firstMatching(this, test, orElse);
9121 }
9122
9123 File lastMatching(bool test(File value), {File orElse()}) {
9124 return Collections.lastMatchingInList(this, test, orElse);
9125 }
9126
9127 File singleMatching(bool test(File value)) {
9128 return Collections.singleMatching(this, test);
9129 }
9130
9131 File elementAt(int index) {
9132 return this[index];
9133 }
9134
9135 // From Collection<File>:
9136
9137 void add(File value) {
9138 throw new UnsupportedError("Cannot add to immutable List.");
9139 }
9140
9141 void addLast(File value) {
9142 throw new UnsupportedError("Cannot add to immutable List.");
9143 }
9144
9145 void addAll(Iterable<File> iterable) {
9146 throw new UnsupportedError("Cannot add to immutable List.");
9147 }
9148
8890 // From List<File>: 9149 // From List<File>:
8891 void set length(int value) { 9150 void set length(int value) {
8892 throw new UnsupportedError("Cannot resize immutable List."); 9151 throw new UnsupportedError("Cannot resize immutable List.");
8893 } 9152 }
8894 9153
8895 void clear() { 9154 void clear() {
8896 throw new UnsupportedError("Cannot clear immutable List."); 9155 throw new UnsupportedError("Cannot clear immutable List.");
8897 } 9156 }
8898 9157
8899 void sort([int compare(File a, File b)]) { 9158 void sort([int compare(File a, File b)]) {
8900 throw new UnsupportedError("Cannot sort immutable List."); 9159 throw new UnsupportedError("Cannot sort immutable List.");
8901 } 9160 }
8902 9161
8903 int indexOf(File element, [int start = 0]) => 9162 int indexOf(File element, [int start = 0]) =>
8904 Lists.indexOf(this, element, start, this.length); 9163 Lists.indexOf(this, element, start, this.length);
8905 9164
8906 int lastIndexOf(File element, [int start]) { 9165 int lastIndexOf(File element, [int start]) {
8907 if (start == null) start = length - 1; 9166 if (start == null) start = length - 1;
8908 return Lists.lastIndexOf(this, element, start); 9167 return Lists.lastIndexOf(this, element, start);
8909 } 9168 }
8910 9169
8911 File get first => this[0]; 9170 File get first {
9171 if (this.length > 0) return this[0];
9172 throw new StateError("No elements");
9173 }
8912 9174
8913 File get last => this[length - 1]; 9175 File get last {
9176 if (this.length > 0) return this[this.length - 1];
9177 throw new StateError("No elements");
9178 }
9179
9180 File get single {
9181 if (length == 1) return this[0];
9182 if (length == 0) throw new StateError("No elements");
9183 throw new StateError("More than one element");
9184 }
9185
9186 File min([int compare(File a, File b)]) => _Collections.minInList(this, compar e);
9187
9188 File max([int compare(File a, File b)]) => _Collections.maxInList(this, compar e);
8914 9189
8915 File removeAt(int pos) { 9190 File removeAt(int pos) {
8916 throw new UnsupportedError("Cannot removeAt on immutable List."); 9191 throw new UnsupportedError("Cannot removeAt on immutable List.");
8917 } 9192 }
8918 9193
8919 File removeLast() { 9194 File removeLast() {
8920 throw new UnsupportedError("Cannot removeLast on immutable List."); 9195 throw new UnsupportedError("Cannot removeLast on immutable List.");
8921 } 9196 }
8922 9197
8923 void setRange(int start, int rangeLength, List<File> from, [int startFrom]) { 9198 void setRange(int start, int rangeLength, List<File> from, [int startFrom]) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
9216 /// @domName Float32Array.length; @docsEditable true 9491 /// @domName Float32Array.length; @docsEditable true
9217 int get length => JS("int", "#.length", this); 9492 int get length => JS("int", "#.length", this);
9218 9493
9219 num operator[](int index) => JS("num", "#[#]", this, index); 9494 num operator[](int index) => JS("num", "#[#]", this, index);
9220 9495
9221 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins. 9496 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins.
9222 // num is the element type. 9497 // num is the element type.
9223 9498
9224 // From Iterable<num>: 9499 // From Iterable<num>:
9225 9500
9226 Iterator<num> iterator() { 9501 Iterator<num> get iterator {
9227 // Note: NodeLists are not fixed size. And most probably length shouldn't 9502 // Note: NodeLists are not fixed size. And most probably length shouldn't
9228 // be cached in both iterator _and_ forEach method. For now caching it 9503 // be cached in both iterator _and_ forEach method. For now caching it
9229 // for consistency. 9504 // for consistency.
9230 return new FixedSizeListIterator<num>(this); 9505 return new FixedSizeListIterator<num>(this);
9231 } 9506 }
9232 9507
9233 // From Collection<num>:
9234
9235 void add(num value) {
9236 throw new UnsupportedError("Cannot add to immutable List.");
9237 }
9238
9239 void addLast(num value) {
9240 throw new UnsupportedError("Cannot add to immutable List.");
9241 }
9242
9243 void addAll(Collection<num> collection) {
9244 throw new UnsupportedError("Cannot add to immutable List.");
9245 }
9246
9247 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) { 9508 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) {
9248 return Collections.reduce(this, initialValue, combine); 9509 return Collections.reduce(this, initialValue, combine);
9249 } 9510 }
9250 9511
9251 bool contains(num element) => Collections.contains(this, element); 9512 bool contains(num element) => Collections.contains(this, element);
9252 9513
9253 void forEach(void f(num element)) => Collections.forEach(this, f); 9514 void forEach(void f(num element)) => Collections.forEach(this, f);
9254 9515
9255 Collection map(f(num element)) => Collections.map(this, [], f); 9516 String join([String separator]) => Collections.joinList(this, separator);
9256 9517
9257 Collection<num> filter(bool f(num element)) => 9518 List mappedBy(f(num element)) => new MappedList<num, dynamic>(this, f);
9258 Collections.filter(this, <num>[], f); 9519
9520 Iterable<num> where(bool f(num element)) => new WhereIterable<num>(this, f);
9259 9521
9260 bool every(bool f(num element)) => Collections.every(this, f); 9522 bool every(bool f(num element)) => Collections.every(this, f);
9261 9523
9262 bool some(bool f(num element)) => Collections.some(this, f); 9524 bool any(bool f(num element)) => Collections.any(this, f);
9263 9525
9264 bool get isEmpty => this.length == 0; 9526 bool get isEmpty => this.length == 0;
9265 9527
9528 List<num> take(int n) => new ListView<num>(this, 0, n);
9529
9530 Iterable<num> takeWhile(bool test(num value)) {
9531 return new TakeWhileIterable<num>(this, test);
9532 }
9533
9534 List<num> skip(int n) => new ListView<num>(this, n, null);
9535
9536 Iterable<num> skipWhile(bool test(num value)) {
9537 return new SkipWhileIterable<num>(this, test);
9538 }
9539
9540 num firstMatching(bool test(num value), { num orElse() }) {
9541 return Collections.firstMatching(this, test, orElse);
9542 }
9543
9544 num lastMatching(bool test(num value), {num orElse()}) {
9545 return Collections.lastMatchingInList(this, test, orElse);
9546 }
9547
9548 num singleMatching(bool test(num value)) {
9549 return Collections.singleMatching(this, test);
9550 }
9551
9552 num elementAt(int index) {
9553 return this[index];
9554 }
9555
9556 // From Collection<num>:
9557
9558 void add(num value) {
9559 throw new UnsupportedError("Cannot add to immutable List.");
9560 }
9561
9562 void addLast(num value) {
9563 throw new UnsupportedError("Cannot add to immutable List.");
9564 }
9565
9566 void addAll(Iterable<num> iterable) {
9567 throw new UnsupportedError("Cannot add to immutable List.");
9568 }
9569
9266 // From List<num>: 9570 // From List<num>:
9267 void set length(int value) { 9571 void set length(int value) {
9268 throw new UnsupportedError("Cannot resize immutable List."); 9572 throw new UnsupportedError("Cannot resize immutable List.");
9269 } 9573 }
9270 9574
9271 void clear() { 9575 void clear() {
9272 throw new UnsupportedError("Cannot clear immutable List."); 9576 throw new UnsupportedError("Cannot clear immutable List.");
9273 } 9577 }
9274 9578
9275 void sort([int compare(num a, num b)]) { 9579 void sort([int compare(num a, num b)]) {
9276 throw new UnsupportedError("Cannot sort immutable List."); 9580 throw new UnsupportedError("Cannot sort immutable List.");
9277 } 9581 }
9278 9582
9279 int indexOf(num element, [int start = 0]) => 9583 int indexOf(num element, [int start = 0]) =>
9280 Lists.indexOf(this, element, start, this.length); 9584 Lists.indexOf(this, element, start, this.length);
9281 9585
9282 int lastIndexOf(num element, [int start]) { 9586 int lastIndexOf(num element, [int start]) {
9283 if (start == null) start = length - 1; 9587 if (start == null) start = length - 1;
9284 return Lists.lastIndexOf(this, element, start); 9588 return Lists.lastIndexOf(this, element, start);
9285 } 9589 }
9286 9590
9287 num get first => this[0]; 9591 num get first {
9592 if (this.length > 0) return this[0];
9593 throw new StateError("No elements");
9594 }
9288 9595
9289 num get last => this[length - 1]; 9596 num get last {
9597 if (this.length > 0) return this[this.length - 1];
9598 throw new StateError("No elements");
9599 }
9600
9601 num get single {
9602 if (length == 1) return this[0];
9603 if (length == 0) throw new StateError("No elements");
9604 throw new StateError("More than one element");
9605 }
9606
9607 num min([int compare(num a, num b)]) => _Collections.minInList(this, compare);
9608
9609 num max([int compare(num a, num b)]) => _Collections.maxInList(this, compare);
9290 9610
9291 num removeAt(int pos) { 9611 num removeAt(int pos) {
9292 throw new UnsupportedError("Cannot removeAt on immutable List."); 9612 throw new UnsupportedError("Cannot removeAt on immutable List.");
9293 } 9613 }
9294 9614
9295 num removeLast() { 9615 num removeLast() {
9296 throw new UnsupportedError("Cannot removeLast on immutable List."); 9616 throw new UnsupportedError("Cannot removeLast on immutable List.");
9297 } 9617 }
9298 9618
9299 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) { 9619 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
9342 /// @domName Float64Array.length; @docsEditable true 9662 /// @domName Float64Array.length; @docsEditable true
9343 int get length => JS("int", "#.length", this); 9663 int get length => JS("int", "#.length", this);
9344 9664
9345 num operator[](int index) => JS("num", "#[#]", this, index); 9665 num operator[](int index) => JS("num", "#[#]", this, index);
9346 9666
9347 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins. 9667 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<num> mixins.
9348 // num is the element type. 9668 // num is the element type.
9349 9669
9350 // From Iterable<num>: 9670 // From Iterable<num>:
9351 9671
9352 Iterator<num> iterator() { 9672 Iterator<num> get iterator {
9353 // Note: NodeLists are not fixed size. And most probably length shouldn't 9673 // Note: NodeLists are not fixed size. And most probably length shouldn't
9354 // be cached in both iterator _and_ forEach method. For now caching it 9674 // be cached in both iterator _and_ forEach method. For now caching it
9355 // for consistency. 9675 // for consistency.
9356 return new FixedSizeListIterator<num>(this); 9676 return new FixedSizeListIterator<num>(this);
9357 } 9677 }
9358 9678
9359 // From Collection<num>:
9360
9361 void add(num value) {
9362 throw new UnsupportedError("Cannot add to immutable List.");
9363 }
9364
9365 void addLast(num value) {
9366 throw new UnsupportedError("Cannot add to immutable List.");
9367 }
9368
9369 void addAll(Collection<num> collection) {
9370 throw new UnsupportedError("Cannot add to immutable List.");
9371 }
9372
9373 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) { 9679 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) {
9374 return Collections.reduce(this, initialValue, combine); 9680 return Collections.reduce(this, initialValue, combine);
9375 } 9681 }
9376 9682
9377 bool contains(num element) => Collections.contains(this, element); 9683 bool contains(num element) => Collections.contains(this, element);
9378 9684
9379 void forEach(void f(num element)) => Collections.forEach(this, f); 9685 void forEach(void f(num element)) => Collections.forEach(this, f);
9380 9686
9381 Collection map(f(num element)) => Collections.map(this, [], f); 9687 String join([String separator]) => Collections.joinList(this, separator);
9382 9688
9383 Collection<num> filter(bool f(num element)) => 9689 List mappedBy(f(num element)) => new MappedList<num, dynamic>(this, f);
9384 Collections.filter(this, <num>[], f); 9690
9691 Iterable<num> where(bool f(num element)) => new WhereIterable<num>(this, f);
9385 9692
9386 bool every(bool f(num element)) => Collections.every(this, f); 9693 bool every(bool f(num element)) => Collections.every(this, f);
9387 9694
9388 bool some(bool f(num element)) => Collections.some(this, f); 9695 bool any(bool f(num element)) => Collections.any(this, f);
9389 9696
9390 bool get isEmpty => this.length == 0; 9697 bool get isEmpty => this.length == 0;
9391 9698
9699 List<num> take(int n) => new ListView<num>(this, 0, n);
9700
9701 Iterable<num> takeWhile(bool test(num value)) {
9702 return new TakeWhileIterable<num>(this, test);
9703 }
9704
9705 List<num> skip(int n) => new ListView<num>(this, n, null);
9706
9707 Iterable<num> skipWhile(bool test(num value)) {
9708 return new SkipWhileIterable<num>(this, test);
9709 }
9710
9711 num firstMatching(bool test(num value), { num orElse() }) {
9712 return Collections.firstMatching(this, test, orElse);
9713 }
9714
9715 num lastMatching(bool test(num value), {num orElse()}) {
9716 return Collections.lastMatchingInList(this, test, orElse);
9717 }
9718
9719 num singleMatching(bool test(num value)) {
9720 return Collections.singleMatching(this, test);
9721 }
9722
9723 num elementAt(int index) {
9724 return this[index];
9725 }
9726
9727 // From Collection<num>:
9728
9729 void add(num value) {
9730 throw new UnsupportedError("Cannot add to immutable List.");
9731 }
9732
9733 void addLast(num value) {
9734 throw new UnsupportedError("Cannot add to immutable List.");
9735 }
9736
9737 void addAll(Iterable<num> iterable) {
9738 throw new UnsupportedError("Cannot add to immutable List.");
9739 }
9740
9392 // From List<num>: 9741 // From List<num>:
9393 void set length(int value) { 9742 void set length(int value) {
9394 throw new UnsupportedError("Cannot resize immutable List."); 9743 throw new UnsupportedError("Cannot resize immutable List.");
9395 } 9744 }
9396 9745
9397 void clear() { 9746 void clear() {
9398 throw new UnsupportedError("Cannot clear immutable List."); 9747 throw new UnsupportedError("Cannot clear immutable List.");
9399 } 9748 }
9400 9749
9401 void sort([int compare(num a, num b)]) { 9750 void sort([int compare(num a, num b)]) {
9402 throw new UnsupportedError("Cannot sort immutable List."); 9751 throw new UnsupportedError("Cannot sort immutable List.");
9403 } 9752 }
9404 9753
9405 int indexOf(num element, [int start = 0]) => 9754 int indexOf(num element, [int start = 0]) =>
9406 Lists.indexOf(this, element, start, this.length); 9755 Lists.indexOf(this, element, start, this.length);
9407 9756
9408 int lastIndexOf(num element, [int start]) { 9757 int lastIndexOf(num element, [int start]) {
9409 if (start == null) start = length - 1; 9758 if (start == null) start = length - 1;
9410 return Lists.lastIndexOf(this, element, start); 9759 return Lists.lastIndexOf(this, element, start);
9411 } 9760 }
9412 9761
9413 num get first => this[0]; 9762 num get first {
9763 if (this.length > 0) return this[0];
9764 throw new StateError("No elements");
9765 }
9414 9766
9415 num get last => this[length - 1]; 9767 num get last {
9768 if (this.length > 0) return this[this.length - 1];
9769 throw new StateError("No elements");
9770 }
9771
9772 num get single {
9773 if (length == 1) return this[0];
9774 if (length == 0) throw new StateError("No elements");
9775 throw new StateError("More than one element");
9776 }
9777
9778 num min([int compare(num a, num b)]) => _Collections.minInList(this, compare);
9779
9780 num max([int compare(num a, num b)]) => _Collections.maxInList(this, compare);
9416 9781
9417 num removeAt(int pos) { 9782 num removeAt(int pos) {
9418 throw new UnsupportedError("Cannot removeAt on immutable List."); 9783 throw new UnsupportedError("Cannot removeAt on immutable List.");
9419 } 9784 }
9420 9785
9421 num removeLast() { 9786 num removeLast() {
9422 throw new UnsupportedError("Cannot removeLast on immutable List."); 9787 throw new UnsupportedError("Cannot removeLast on immutable List.");
9423 } 9788 }
9424 9789
9425 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) { 9790 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
9828 Node operator[](int index) => JS("Node", "#[#]", this, index); 10193 Node operator[](int index) => JS("Node", "#[#]", this, index);
9829 10194
9830 void operator[]=(int index, Node value) { 10195 void operator[]=(int index, Node value) {
9831 throw new UnsupportedError("Cannot assign element of immutable List."); 10196 throw new UnsupportedError("Cannot assign element of immutable List.");
9832 } 10197 }
9833 // -- start List<Node> mixins. 10198 // -- start List<Node> mixins.
9834 // Node is the element type. 10199 // Node is the element type.
9835 10200
9836 // From Iterable<Node>: 10201 // From Iterable<Node>:
9837 10202
9838 Iterator<Node> iterator() { 10203 Iterator<Node> get iterator {
9839 // Note: NodeLists are not fixed size. And most probably length shouldn't 10204 // Note: NodeLists are not fixed size. And most probably length shouldn't
9840 // be cached in both iterator _and_ forEach method. For now caching it 10205 // be cached in both iterator _and_ forEach method. For now caching it
9841 // for consistency. 10206 // for consistency.
9842 return new FixedSizeListIterator<Node>(this); 10207 return new FixedSizeListIterator<Node>(this);
9843 } 10208 }
9844 10209
9845 // From Collection<Node>:
9846
9847 void add(Node value) {
9848 throw new UnsupportedError("Cannot add to immutable List.");
9849 }
9850
9851 void addLast(Node value) {
9852 throw new UnsupportedError("Cannot add to immutable List.");
9853 }
9854
9855 void addAll(Collection<Node> collection) {
9856 throw new UnsupportedError("Cannot add to immutable List.");
9857 }
9858
9859 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 10210 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
9860 return Collections.reduce(this, initialValue, combine); 10211 return Collections.reduce(this, initialValue, combine);
9861 } 10212 }
9862 10213
9863 bool contains(Node element) => Collections.contains(this, element); 10214 bool contains(Node element) => Collections.contains(this, element);
9864 10215
9865 void forEach(void f(Node element)) => Collections.forEach(this, f); 10216 void forEach(void f(Node element)) => Collections.forEach(this, f);
9866 10217
9867 Collection map(f(Node element)) => Collections.map(this, [], f); 10218 String join([String separator]) => Collections.joinList(this, separator);
9868 10219
9869 Collection<Node> filter(bool f(Node element)) => 10220 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
9870 Collections.filter(this, <Node>[], f); 10221
10222 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
9871 10223
9872 bool every(bool f(Node element)) => Collections.every(this, f); 10224 bool every(bool f(Node element)) => Collections.every(this, f);
9873 10225
9874 bool some(bool f(Node element)) => Collections.some(this, f); 10226 bool any(bool f(Node element)) => Collections.any(this, f);
9875 10227
9876 bool get isEmpty => this.length == 0; 10228 bool get isEmpty => this.length == 0;
9877 10229
10230 List<Node> take(int n) => new ListView<Node>(this, 0, n);
10231
10232 Iterable<Node> takeWhile(bool test(Node value)) {
10233 return new TakeWhileIterable<Node>(this, test);
10234 }
10235
10236 List<Node> skip(int n) => new ListView<Node>(this, n, null);
10237
10238 Iterable<Node> skipWhile(bool test(Node value)) {
10239 return new SkipWhileIterable<Node>(this, test);
10240 }
10241
10242 Node firstMatching(bool test(Node value), { Node orElse() }) {
10243 return Collections.firstMatching(this, test, orElse);
10244 }
10245
10246 Node lastMatching(bool test(Node value), {Node orElse()}) {
10247 return Collections.lastMatchingInList(this, test, orElse);
10248 }
10249
10250 Node singleMatching(bool test(Node value)) {
10251 return Collections.singleMatching(this, test);
10252 }
10253
10254 Node elementAt(int index) {
10255 return this[index];
10256 }
10257
10258 // From Collection<Node>:
10259
10260 void add(Node value) {
10261 throw new UnsupportedError("Cannot add to immutable List.");
10262 }
10263
10264 void addLast(Node value) {
10265 throw new UnsupportedError("Cannot add to immutable List.");
10266 }
10267
10268 void addAll(Iterable<Node> iterable) {
10269 throw new UnsupportedError("Cannot add to immutable List.");
10270 }
10271
9878 // From List<Node>: 10272 // From List<Node>:
9879 void set length(int value) { 10273 void set length(int value) {
9880 throw new UnsupportedError("Cannot resize immutable List."); 10274 throw new UnsupportedError("Cannot resize immutable List.");
9881 } 10275 }
9882 10276
9883 void clear() { 10277 void clear() {
9884 throw new UnsupportedError("Cannot clear immutable List."); 10278 throw new UnsupportedError("Cannot clear immutable List.");
9885 } 10279 }
9886 10280
9887 void sort([int compare(Node a, Node b)]) { 10281 void sort([int compare(Node a, Node b)]) {
9888 throw new UnsupportedError("Cannot sort immutable List."); 10282 throw new UnsupportedError("Cannot sort immutable List.");
9889 } 10283 }
9890 10284
9891 int indexOf(Node element, [int start = 0]) => 10285 int indexOf(Node element, [int start = 0]) =>
9892 Lists.indexOf(this, element, start, this.length); 10286 Lists.indexOf(this, element, start, this.length);
9893 10287
9894 int lastIndexOf(Node element, [int start]) { 10288 int lastIndexOf(Node element, [int start]) {
9895 if (start == null) start = length - 1; 10289 if (start == null) start = length - 1;
9896 return Lists.lastIndexOf(this, element, start); 10290 return Lists.lastIndexOf(this, element, start);
9897 } 10291 }
9898 10292
9899 Node get first => this[0]; 10293 Node get first {
10294 if (this.length > 0) return this[0];
10295 throw new StateError("No elements");
10296 }
9900 10297
9901 Node get last => this[length - 1]; 10298 Node get last {
10299 if (this.length > 0) return this[this.length - 1];
10300 throw new StateError("No elements");
10301 }
10302
10303 Node get single {
10304 if (length == 1) return this[0];
10305 if (length == 0) throw new StateError("No elements");
10306 throw new StateError("More than one element");
10307 }
10308
10309 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
10310
10311 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
9902 10312
9903 Node removeAt(int pos) { 10313 Node removeAt(int pos) {
9904 throw new UnsupportedError("Cannot removeAt on immutable List."); 10314 throw new UnsupportedError("Cannot removeAt on immutable List.");
9905 } 10315 }
9906 10316
9907 Node removeLast() { 10317 Node removeLast() {
9908 throw new UnsupportedError("Cannot removeLast on immutable List."); 10318 throw new UnsupportedError("Cannot removeLast on immutable List.");
9909 } 10319 }
9910 10320
9911 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 10321 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
9949 Node operator[](int index) => JS("Node", "#[#]", this, index); 10359 Node operator[](int index) => JS("Node", "#[#]", this, index);
9950 10360
9951 void operator[]=(int index, Node value) { 10361 void operator[]=(int index, Node value) {
9952 throw new UnsupportedError("Cannot assign element of immutable List."); 10362 throw new UnsupportedError("Cannot assign element of immutable List.");
9953 } 10363 }
9954 // -- start List<Node> mixins. 10364 // -- start List<Node> mixins.
9955 // Node is the element type. 10365 // Node is the element type.
9956 10366
9957 // From Iterable<Node>: 10367 // From Iterable<Node>:
9958 10368
9959 Iterator<Node> iterator() { 10369 Iterator<Node> get iterator {
9960 // Note: NodeLists are not fixed size. And most probably length shouldn't 10370 // Note: NodeLists are not fixed size. And most probably length shouldn't
9961 // be cached in both iterator _and_ forEach method. For now caching it 10371 // be cached in both iterator _and_ forEach method. For now caching it
9962 // for consistency. 10372 // for consistency.
9963 return new FixedSizeListIterator<Node>(this); 10373 return new FixedSizeListIterator<Node>(this);
9964 } 10374 }
9965 10375
9966 // From Collection<Node>:
9967
9968 void add(Node value) {
9969 throw new UnsupportedError("Cannot add to immutable List.");
9970 }
9971
9972 void addLast(Node value) {
9973 throw new UnsupportedError("Cannot add to immutable List.");
9974 }
9975
9976 void addAll(Collection<Node> collection) {
9977 throw new UnsupportedError("Cannot add to immutable List.");
9978 }
9979
9980 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 10376 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
9981 return Collections.reduce(this, initialValue, combine); 10377 return Collections.reduce(this, initialValue, combine);
9982 } 10378 }
9983 10379
9984 bool contains(Node element) => Collections.contains(this, element); 10380 bool contains(Node element) => Collections.contains(this, element);
9985 10381
9986 void forEach(void f(Node element)) => Collections.forEach(this, f); 10382 void forEach(void f(Node element)) => Collections.forEach(this, f);
9987 10383
9988 Collection map(f(Node element)) => Collections.map(this, [], f); 10384 String join([String separator]) => Collections.joinList(this, separator);
9989 10385
9990 Collection<Node> filter(bool f(Node element)) => 10386 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
9991 Collections.filter(this, <Node>[], f); 10387
10388 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
9992 10389
9993 bool every(bool f(Node element)) => Collections.every(this, f); 10390 bool every(bool f(Node element)) => Collections.every(this, f);
9994 10391
9995 bool some(bool f(Node element)) => Collections.some(this, f); 10392 bool any(bool f(Node element)) => Collections.any(this, f);
9996 10393
9997 bool get isEmpty => this.length == 0; 10394 bool get isEmpty => this.length == 0;
9998 10395
10396 List<Node> take(int n) => new ListView<Node>(this, 0, n);
10397
10398 Iterable<Node> takeWhile(bool test(Node value)) {
10399 return new TakeWhileIterable<Node>(this, test);
10400 }
10401
10402 List<Node> skip(int n) => new ListView<Node>(this, n, null);
10403
10404 Iterable<Node> skipWhile(bool test(Node value)) {
10405 return new SkipWhileIterable<Node>(this, test);
10406 }
10407
10408 Node firstMatching(bool test(Node value), { Node orElse() }) {
10409 return Collections.firstMatching(this, test, orElse);
10410 }
10411
10412 Node lastMatching(bool test(Node value), {Node orElse()}) {
10413 return Collections.lastMatchingInList(this, test, orElse);
10414 }
10415
10416 Node singleMatching(bool test(Node value)) {
10417 return Collections.singleMatching(this, test);
10418 }
10419
10420 Node elementAt(int index) {
10421 return this[index];
10422 }
10423
10424 // From Collection<Node>:
10425
10426 void add(Node value) {
10427 throw new UnsupportedError("Cannot add to immutable List.");
10428 }
10429
10430 void addLast(Node value) {
10431 throw new UnsupportedError("Cannot add to immutable List.");
10432 }
10433
10434 void addAll(Iterable<Node> iterable) {
10435 throw new UnsupportedError("Cannot add to immutable List.");
10436 }
10437
9999 // From List<Node>: 10438 // From List<Node>:
10000 void set length(int value) { 10439 void set length(int value) {
10001 throw new UnsupportedError("Cannot resize immutable List."); 10440 throw new UnsupportedError("Cannot resize immutable List.");
10002 } 10441 }
10003 10442
10004 void clear() { 10443 void clear() {
10005 throw new UnsupportedError("Cannot clear immutable List."); 10444 throw new UnsupportedError("Cannot clear immutable List.");
10006 } 10445 }
10007 10446
10008 void sort([int compare(Node a, Node b)]) { 10447 void sort([int compare(Node a, Node b)]) {
10009 throw new UnsupportedError("Cannot sort immutable List."); 10448 throw new UnsupportedError("Cannot sort immutable List.");
10010 } 10449 }
10011 10450
10012 int indexOf(Node element, [int start = 0]) => 10451 int indexOf(Node element, [int start = 0]) =>
10013 Lists.indexOf(this, element, start, this.length); 10452 Lists.indexOf(this, element, start, this.length);
10014 10453
10015 int lastIndexOf(Node element, [int start]) { 10454 int lastIndexOf(Node element, [int start]) {
10016 if (start == null) start = length - 1; 10455 if (start == null) start = length - 1;
10017 return Lists.lastIndexOf(this, element, start); 10456 return Lists.lastIndexOf(this, element, start);
10018 } 10457 }
10019 10458
10020 Node get first => this[0]; 10459 Node get first {
10460 if (this.length > 0) return this[0];
10461 throw new StateError("No elements");
10462 }
10021 10463
10022 Node get last => this[length - 1]; 10464 Node get last {
10465 if (this.length > 0) return this[this.length - 1];
10466 throw new StateError("No elements");
10467 }
10468
10469 Node get single {
10470 if (length == 1) return this[0];
10471 if (length == 0) throw new StateError("No elements");
10472 throw new StateError("More than one element");
10473 }
10474
10475 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
10476
10477 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
10023 10478
10024 Node removeAt(int pos) { 10479 Node removeAt(int pos) {
10025 throw new UnsupportedError("Cannot removeAt on immutable List."); 10480 throw new UnsupportedError("Cannot removeAt on immutable List.");
10026 } 10481 }
10027 10482
10028 Node removeLast() { 10483 Node removeLast() {
10029 throw new UnsupportedError("Cannot removeLast on immutable List."); 10484 throw new UnsupportedError("Cannot removeLast on immutable List.");
10030 } 10485 }
10031 10486
10032 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 10487 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
11575 /// @domName Int16Array.length; @docsEditable true 12030 /// @domName Int16Array.length; @docsEditable true
11576 int get length => JS("int", "#.length", this); 12031 int get length => JS("int", "#.length", this);
11577 12032
11578 int operator[](int index) => JS("int", "#[#]", this, index); 12033 int operator[](int index) => JS("int", "#[#]", this, index);
11579 12034
11580 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 12035 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
11581 // int is the element type. 12036 // int is the element type.
11582 12037
11583 // From Iterable<int>: 12038 // From Iterable<int>:
11584 12039
11585 Iterator<int> iterator() { 12040 Iterator<int> get iterator {
11586 // Note: NodeLists are not fixed size. And most probably length shouldn't 12041 // Note: NodeLists are not fixed size. And most probably length shouldn't
11587 // be cached in both iterator _and_ forEach method. For now caching it 12042 // be cached in both iterator _and_ forEach method. For now caching it
11588 // for consistency. 12043 // for consistency.
11589 return new FixedSizeListIterator<int>(this); 12044 return new FixedSizeListIterator<int>(this);
11590 } 12045 }
11591 12046
11592 // From Collection<int>:
11593
11594 void add(int value) {
11595 throw new UnsupportedError("Cannot add to immutable List.");
11596 }
11597
11598 void addLast(int value) {
11599 throw new UnsupportedError("Cannot add to immutable List.");
11600 }
11601
11602 void addAll(Collection<int> collection) {
11603 throw new UnsupportedError("Cannot add to immutable List.");
11604 }
11605
11606 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 12047 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
11607 return Collections.reduce(this, initialValue, combine); 12048 return Collections.reduce(this, initialValue, combine);
11608 } 12049 }
11609 12050
11610 bool contains(int element) => Collections.contains(this, element); 12051 bool contains(int element) => Collections.contains(this, element);
11611 12052
11612 void forEach(void f(int element)) => Collections.forEach(this, f); 12053 void forEach(void f(int element)) => Collections.forEach(this, f);
11613 12054
11614 Collection map(f(int element)) => Collections.map(this, [], f); 12055 String join([String separator]) => Collections.joinList(this, separator);
11615 12056
11616 Collection<int> filter(bool f(int element)) => 12057 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
11617 Collections.filter(this, <int>[], f); 12058
12059 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
11618 12060
11619 bool every(bool f(int element)) => Collections.every(this, f); 12061 bool every(bool f(int element)) => Collections.every(this, f);
11620 12062
11621 bool some(bool f(int element)) => Collections.some(this, f); 12063 bool any(bool f(int element)) => Collections.any(this, f);
11622 12064
11623 bool get isEmpty => this.length == 0; 12065 bool get isEmpty => this.length == 0;
11624 12066
12067 List<int> take(int n) => new ListView<int>(this, 0, n);
12068
12069 Iterable<int> takeWhile(bool test(int value)) {
12070 return new TakeWhileIterable<int>(this, test);
12071 }
12072
12073 List<int> skip(int n) => new ListView<int>(this, n, null);
12074
12075 Iterable<int> skipWhile(bool test(int value)) {
12076 return new SkipWhileIterable<int>(this, test);
12077 }
12078
12079 int firstMatching(bool test(int value), { int orElse() }) {
12080 return Collections.firstMatching(this, test, orElse);
12081 }
12082
12083 int lastMatching(bool test(int value), {int orElse()}) {
12084 return Collections.lastMatchingInList(this, test, orElse);
12085 }
12086
12087 int singleMatching(bool test(int value)) {
12088 return Collections.singleMatching(this, test);
12089 }
12090
12091 int elementAt(int index) {
12092 return this[index];
12093 }
12094
12095 // From Collection<int>:
12096
12097 void add(int value) {
12098 throw new UnsupportedError("Cannot add to immutable List.");
12099 }
12100
12101 void addLast(int value) {
12102 throw new UnsupportedError("Cannot add to immutable List.");
12103 }
12104
12105 void addAll(Iterable<int> iterable) {
12106 throw new UnsupportedError("Cannot add to immutable List.");
12107 }
12108
11625 // From List<int>: 12109 // From List<int>:
11626 void set length(int value) { 12110 void set length(int value) {
11627 throw new UnsupportedError("Cannot resize immutable List."); 12111 throw new UnsupportedError("Cannot resize immutable List.");
11628 } 12112 }
11629 12113
11630 void clear() { 12114 void clear() {
11631 throw new UnsupportedError("Cannot clear immutable List."); 12115 throw new UnsupportedError("Cannot clear immutable List.");
11632 } 12116 }
11633 12117
11634 void sort([int compare(int a, int b)]) { 12118 void sort([int compare(int a, int b)]) {
11635 throw new UnsupportedError("Cannot sort immutable List."); 12119 throw new UnsupportedError("Cannot sort immutable List.");
11636 } 12120 }
11637 12121
11638 int indexOf(int element, [int start = 0]) => 12122 int indexOf(int element, [int start = 0]) =>
11639 Lists.indexOf(this, element, start, this.length); 12123 Lists.indexOf(this, element, start, this.length);
11640 12124
11641 int lastIndexOf(int element, [int start]) { 12125 int lastIndexOf(int element, [int start]) {
11642 if (start == null) start = length - 1; 12126 if (start == null) start = length - 1;
11643 return Lists.lastIndexOf(this, element, start); 12127 return Lists.lastIndexOf(this, element, start);
11644 } 12128 }
11645 12129
11646 int get first => this[0]; 12130 int get first {
12131 if (this.length > 0) return this[0];
12132 throw new StateError("No elements");
12133 }
11647 12134
11648 int get last => this[length - 1]; 12135 int get last {
12136 if (this.length > 0) return this[this.length - 1];
12137 throw new StateError("No elements");
12138 }
12139
12140 int get single {
12141 if (length == 1) return this[0];
12142 if (length == 0) throw new StateError("No elements");
12143 throw new StateError("More than one element");
12144 }
12145
12146 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
12147
12148 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
11649 12149
11650 int removeAt(int pos) { 12150 int removeAt(int pos) {
11651 throw new UnsupportedError("Cannot removeAt on immutable List."); 12151 throw new UnsupportedError("Cannot removeAt on immutable List.");
11652 } 12152 }
11653 12153
11654 int removeLast() { 12154 int removeLast() {
11655 throw new UnsupportedError("Cannot removeLast on immutable List."); 12155 throw new UnsupportedError("Cannot removeLast on immutable List.");
11656 } 12156 }
11657 12157
11658 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 12158 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
11701 /// @domName Int32Array.length; @docsEditable true 12201 /// @domName Int32Array.length; @docsEditable true
11702 int get length => JS("int", "#.length", this); 12202 int get length => JS("int", "#.length", this);
11703 12203
11704 int operator[](int index) => JS("int", "#[#]", this, index); 12204 int operator[](int index) => JS("int", "#[#]", this, index);
11705 12205
11706 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 12206 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
11707 // int is the element type. 12207 // int is the element type.
11708 12208
11709 // From Iterable<int>: 12209 // From Iterable<int>:
11710 12210
11711 Iterator<int> iterator() { 12211 Iterator<int> get iterator {
11712 // Note: NodeLists are not fixed size. And most probably length shouldn't 12212 // Note: NodeLists are not fixed size. And most probably length shouldn't
11713 // be cached in both iterator _and_ forEach method. For now caching it 12213 // be cached in both iterator _and_ forEach method. For now caching it
11714 // for consistency. 12214 // for consistency.
11715 return new FixedSizeListIterator<int>(this); 12215 return new FixedSizeListIterator<int>(this);
11716 } 12216 }
11717 12217
11718 // From Collection<int>:
11719
11720 void add(int value) {
11721 throw new UnsupportedError("Cannot add to immutable List.");
11722 }
11723
11724 void addLast(int value) {
11725 throw new UnsupportedError("Cannot add to immutable List.");
11726 }
11727
11728 void addAll(Collection<int> collection) {
11729 throw new UnsupportedError("Cannot add to immutable List.");
11730 }
11731
11732 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 12218 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
11733 return Collections.reduce(this, initialValue, combine); 12219 return Collections.reduce(this, initialValue, combine);
11734 } 12220 }
11735 12221
11736 bool contains(int element) => Collections.contains(this, element); 12222 bool contains(int element) => Collections.contains(this, element);
11737 12223
11738 void forEach(void f(int element)) => Collections.forEach(this, f); 12224 void forEach(void f(int element)) => Collections.forEach(this, f);
11739 12225
11740 Collection map(f(int element)) => Collections.map(this, [], f); 12226 String join([String separator]) => Collections.joinList(this, separator);
11741 12227
11742 Collection<int> filter(bool f(int element)) => 12228 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
11743 Collections.filter(this, <int>[], f); 12229
12230 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
11744 12231
11745 bool every(bool f(int element)) => Collections.every(this, f); 12232 bool every(bool f(int element)) => Collections.every(this, f);
11746 12233
11747 bool some(bool f(int element)) => Collections.some(this, f); 12234 bool any(bool f(int element)) => Collections.any(this, f);
11748 12235
11749 bool get isEmpty => this.length == 0; 12236 bool get isEmpty => this.length == 0;
11750 12237
12238 List<int> take(int n) => new ListView<int>(this, 0, n);
12239
12240 Iterable<int> takeWhile(bool test(int value)) {
12241 return new TakeWhileIterable<int>(this, test);
12242 }
12243
12244 List<int> skip(int n) => new ListView<int>(this, n, null);
12245
12246 Iterable<int> skipWhile(bool test(int value)) {
12247 return new SkipWhileIterable<int>(this, test);
12248 }
12249
12250 int firstMatching(bool test(int value), { int orElse() }) {
12251 return Collections.firstMatching(this, test, orElse);
12252 }
12253
12254 int lastMatching(bool test(int value), {int orElse()}) {
12255 return Collections.lastMatchingInList(this, test, orElse);
12256 }
12257
12258 int singleMatching(bool test(int value)) {
12259 return Collections.singleMatching(this, test);
12260 }
12261
12262 int elementAt(int index) {
12263 return this[index];
12264 }
12265
12266 // From Collection<int>:
12267
12268 void add(int value) {
12269 throw new UnsupportedError("Cannot add to immutable List.");
12270 }
12271
12272 void addLast(int value) {
12273 throw new UnsupportedError("Cannot add to immutable List.");
12274 }
12275
12276 void addAll(Iterable<int> iterable) {
12277 throw new UnsupportedError("Cannot add to immutable List.");
12278 }
12279
11751 // From List<int>: 12280 // From List<int>:
11752 void set length(int value) { 12281 void set length(int value) {
11753 throw new UnsupportedError("Cannot resize immutable List."); 12282 throw new UnsupportedError("Cannot resize immutable List.");
11754 } 12283 }
11755 12284
11756 void clear() { 12285 void clear() {
11757 throw new UnsupportedError("Cannot clear immutable List."); 12286 throw new UnsupportedError("Cannot clear immutable List.");
11758 } 12287 }
11759 12288
11760 void sort([int compare(int a, int b)]) { 12289 void sort([int compare(int a, int b)]) {
11761 throw new UnsupportedError("Cannot sort immutable List."); 12290 throw new UnsupportedError("Cannot sort immutable List.");
11762 } 12291 }
11763 12292
11764 int indexOf(int element, [int start = 0]) => 12293 int indexOf(int element, [int start = 0]) =>
11765 Lists.indexOf(this, element, start, this.length); 12294 Lists.indexOf(this, element, start, this.length);
11766 12295
11767 int lastIndexOf(int element, [int start]) { 12296 int lastIndexOf(int element, [int start]) {
11768 if (start == null) start = length - 1; 12297 if (start == null) start = length - 1;
11769 return Lists.lastIndexOf(this, element, start); 12298 return Lists.lastIndexOf(this, element, start);
11770 } 12299 }
11771 12300
11772 int get first => this[0]; 12301 int get first {
12302 if (this.length > 0) return this[0];
12303 throw new StateError("No elements");
12304 }
11773 12305
11774 int get last => this[length - 1]; 12306 int get last {
12307 if (this.length > 0) return this[this.length - 1];
12308 throw new StateError("No elements");
12309 }
12310
12311 int get single {
12312 if (length == 1) return this[0];
12313 if (length == 0) throw new StateError("No elements");
12314 throw new StateError("More than one element");
12315 }
12316
12317 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
12318
12319 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
11775 12320
11776 int removeAt(int pos) { 12321 int removeAt(int pos) {
11777 throw new UnsupportedError("Cannot removeAt on immutable List."); 12322 throw new UnsupportedError("Cannot removeAt on immutable List.");
11778 } 12323 }
11779 12324
11780 int removeLast() { 12325 int removeLast() {
11781 throw new UnsupportedError("Cannot removeLast on immutable List."); 12326 throw new UnsupportedError("Cannot removeLast on immutable List.");
11782 } 12327 }
11783 12328
11784 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 12329 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
11827 /// @domName Int8Array.length; @docsEditable true 12372 /// @domName Int8Array.length; @docsEditable true
11828 int get length => JS("int", "#.length", this); 12373 int get length => JS("int", "#.length", this);
11829 12374
11830 int operator[](int index) => JS("int", "#[#]", this, index); 12375 int operator[](int index) => JS("int", "#[#]", this, index);
11831 12376
11832 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 12377 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
11833 // int is the element type. 12378 // int is the element type.
11834 12379
11835 // From Iterable<int>: 12380 // From Iterable<int>:
11836 12381
11837 Iterator<int> iterator() { 12382 Iterator<int> get iterator {
11838 // Note: NodeLists are not fixed size. And most probably length shouldn't 12383 // Note: NodeLists are not fixed size. And most probably length shouldn't
11839 // be cached in both iterator _and_ forEach method. For now caching it 12384 // be cached in both iterator _and_ forEach method. For now caching it
11840 // for consistency. 12385 // for consistency.
11841 return new FixedSizeListIterator<int>(this); 12386 return new FixedSizeListIterator<int>(this);
11842 } 12387 }
11843 12388
11844 // From Collection<int>:
11845
11846 void add(int value) {
11847 throw new UnsupportedError("Cannot add to immutable List.");
11848 }
11849
11850 void addLast(int value) {
11851 throw new UnsupportedError("Cannot add to immutable List.");
11852 }
11853
11854 void addAll(Collection<int> collection) {
11855 throw new UnsupportedError("Cannot add to immutable List.");
11856 }
11857
11858 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 12389 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
11859 return Collections.reduce(this, initialValue, combine); 12390 return Collections.reduce(this, initialValue, combine);
11860 } 12391 }
11861 12392
11862 bool contains(int element) => Collections.contains(this, element); 12393 bool contains(int element) => Collections.contains(this, element);
11863 12394
11864 void forEach(void f(int element)) => Collections.forEach(this, f); 12395 void forEach(void f(int element)) => Collections.forEach(this, f);
11865 12396
11866 Collection map(f(int element)) => Collections.map(this, [], f); 12397 String join([String separator]) => Collections.joinList(this, separator);
11867 12398
11868 Collection<int> filter(bool f(int element)) => 12399 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
11869 Collections.filter(this, <int>[], f); 12400
12401 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
11870 12402
11871 bool every(bool f(int element)) => Collections.every(this, f); 12403 bool every(bool f(int element)) => Collections.every(this, f);
11872 12404
11873 bool some(bool f(int element)) => Collections.some(this, f); 12405 bool any(bool f(int element)) => Collections.any(this, f);
11874 12406
11875 bool get isEmpty => this.length == 0; 12407 bool get isEmpty => this.length == 0;
11876 12408
12409 List<int> take(int n) => new ListView<int>(this, 0, n);
12410
12411 Iterable<int> takeWhile(bool test(int value)) {
12412 return new TakeWhileIterable<int>(this, test);
12413 }
12414
12415 List<int> skip(int n) => new ListView<int>(this, n, null);
12416
12417 Iterable<int> skipWhile(bool test(int value)) {
12418 return new SkipWhileIterable<int>(this, test);
12419 }
12420
12421 int firstMatching(bool test(int value), { int orElse() }) {
12422 return Collections.firstMatching(this, test, orElse);
12423 }
12424
12425 int lastMatching(bool test(int value), {int orElse()}) {
12426 return Collections.lastMatchingInList(this, test, orElse);
12427 }
12428
12429 int singleMatching(bool test(int value)) {
12430 return Collections.singleMatching(this, test);
12431 }
12432
12433 int elementAt(int index) {
12434 return this[index];
12435 }
12436
12437 // From Collection<int>:
12438
12439 void add(int value) {
12440 throw new UnsupportedError("Cannot add to immutable List.");
12441 }
12442
12443 void addLast(int value) {
12444 throw new UnsupportedError("Cannot add to immutable List.");
12445 }
12446
12447 void addAll(Iterable<int> iterable) {
12448 throw new UnsupportedError("Cannot add to immutable List.");
12449 }
12450
11877 // From List<int>: 12451 // From List<int>:
11878 void set length(int value) { 12452 void set length(int value) {
11879 throw new UnsupportedError("Cannot resize immutable List."); 12453 throw new UnsupportedError("Cannot resize immutable List.");
11880 } 12454 }
11881 12455
11882 void clear() { 12456 void clear() {
11883 throw new UnsupportedError("Cannot clear immutable List."); 12457 throw new UnsupportedError("Cannot clear immutable List.");
11884 } 12458 }
11885 12459
11886 void sort([int compare(int a, int b)]) { 12460 void sort([int compare(int a, int b)]) {
11887 throw new UnsupportedError("Cannot sort immutable List."); 12461 throw new UnsupportedError("Cannot sort immutable List.");
11888 } 12462 }
11889 12463
11890 int indexOf(int element, [int start = 0]) => 12464 int indexOf(int element, [int start = 0]) =>
11891 Lists.indexOf(this, element, start, this.length); 12465 Lists.indexOf(this, element, start, this.length);
11892 12466
11893 int lastIndexOf(int element, [int start]) { 12467 int lastIndexOf(int element, [int start]) {
11894 if (start == null) start = length - 1; 12468 if (start == null) start = length - 1;
11895 return Lists.lastIndexOf(this, element, start); 12469 return Lists.lastIndexOf(this, element, start);
11896 } 12470 }
11897 12471
11898 int get first => this[0]; 12472 int get first {
12473 if (this.length > 0) return this[0];
12474 throw new StateError("No elements");
12475 }
11899 12476
11900 int get last => this[length - 1]; 12477 int get last {
12478 if (this.length > 0) return this[this.length - 1];
12479 throw new StateError("No elements");
12480 }
12481
12482 int get single {
12483 if (length == 1) return this[0];
12484 if (length == 0) throw new StateError("No elements");
12485 throw new StateError("More than one element");
12486 }
12487
12488 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
12489
12490 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
11901 12491
11902 int removeAt(int pos) { 12492 int removeAt(int pos) {
11903 throw new UnsupportedError("Cannot removeAt on immutable List."); 12493 throw new UnsupportedError("Cannot removeAt on immutable List.");
11904 } 12494 }
11905 12495
11906 int removeLast() { 12496 int removeLast() {
11907 throw new UnsupportedError("Cannot removeLast on immutable List."); 12497 throw new UnsupportedError("Cannot removeLast on immutable List.");
11908 } 12498 }
11909 12499
11910 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 12500 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
13531 Node operator[](int index) => JS("Node", "#[#]", this, index); 14121 Node operator[](int index) => JS("Node", "#[#]", this, index);
13532 14122
13533 void operator[]=(int index, Node value) { 14123 void operator[]=(int index, Node value) {
13534 throw new UnsupportedError("Cannot assign element of immutable List."); 14124 throw new UnsupportedError("Cannot assign element of immutable List.");
13535 } 14125 }
13536 // -- start List<Node> mixins. 14126 // -- start List<Node> mixins.
13537 // Node is the element type. 14127 // Node is the element type.
13538 14128
13539 // From Iterable<Node>: 14129 // From Iterable<Node>:
13540 14130
13541 Iterator<Node> iterator() { 14131 Iterator<Node> get iterator {
13542 // Note: NodeLists are not fixed size. And most probably length shouldn't 14132 // Note: NodeLists are not fixed size. And most probably length shouldn't
13543 // be cached in both iterator _and_ forEach method. For now caching it 14133 // be cached in both iterator _and_ forEach method. For now caching it
13544 // for consistency. 14134 // for consistency.
13545 return new FixedSizeListIterator<Node>(this); 14135 return new FixedSizeListIterator<Node>(this);
13546 } 14136 }
13547 14137
13548 // From Collection<Node>:
13549
13550 void add(Node value) {
13551 throw new UnsupportedError("Cannot add to immutable List.");
13552 }
13553
13554 void addLast(Node value) {
13555 throw new UnsupportedError("Cannot add to immutable List.");
13556 }
13557
13558 void addAll(Collection<Node> collection) {
13559 throw new UnsupportedError("Cannot add to immutable List.");
13560 }
13561
13562 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 14138 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
13563 return Collections.reduce(this, initialValue, combine); 14139 return Collections.reduce(this, initialValue, combine);
13564 } 14140 }
13565 14141
13566 bool contains(Node element) => Collections.contains(this, element); 14142 bool contains(Node element) => Collections.contains(this, element);
13567 14143
13568 void forEach(void f(Node element)) => Collections.forEach(this, f); 14144 void forEach(void f(Node element)) => Collections.forEach(this, f);
13569 14145
13570 Collection map(f(Node element)) => Collections.map(this, [], f); 14146 String join([String separator]) => Collections.joinList(this, separator);
13571 14147
13572 Collection<Node> filter(bool f(Node element)) => 14148 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
13573 Collections.filter(this, <Node>[], f); 14149
14150 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
13574 14151
13575 bool every(bool f(Node element)) => Collections.every(this, f); 14152 bool every(bool f(Node element)) => Collections.every(this, f);
13576 14153
13577 bool some(bool f(Node element)) => Collections.some(this, f); 14154 bool any(bool f(Node element)) => Collections.any(this, f);
13578 14155
13579 bool get isEmpty => this.length == 0; 14156 bool get isEmpty => this.length == 0;
13580 14157
14158 List<Node> take(int n) => new ListView<Node>(this, 0, n);
14159
14160 Iterable<Node> takeWhile(bool test(Node value)) {
14161 return new TakeWhileIterable<Node>(this, test);
14162 }
14163
14164 List<Node> skip(int n) => new ListView<Node>(this, n, null);
14165
14166 Iterable<Node> skipWhile(bool test(Node value)) {
14167 return new SkipWhileIterable<Node>(this, test);
14168 }
14169
14170 Node firstMatching(bool test(Node value), { Node orElse() }) {
14171 return Collections.firstMatching(this, test, orElse);
14172 }
14173
14174 Node lastMatching(bool test(Node value), {Node orElse()}) {
14175 return Collections.lastMatchingInList(this, test, orElse);
14176 }
14177
14178 Node singleMatching(bool test(Node value)) {
14179 return Collections.singleMatching(this, test);
14180 }
14181
14182 Node elementAt(int index) {
14183 return this[index];
14184 }
14185
14186 // From Collection<Node>:
14187
14188 void add(Node value) {
14189 throw new UnsupportedError("Cannot add to immutable List.");
14190 }
14191
14192 void addLast(Node value) {
14193 throw new UnsupportedError("Cannot add to immutable List.");
14194 }
14195
14196 void addAll(Iterable<Node> iterable) {
14197 throw new UnsupportedError("Cannot add to immutable List.");
14198 }
14199
13581 // From List<Node>: 14200 // From List<Node>:
13582 void set length(int value) { 14201 void set length(int value) {
13583 throw new UnsupportedError("Cannot resize immutable List."); 14202 throw new UnsupportedError("Cannot resize immutable List.");
13584 } 14203 }
13585 14204
13586 void clear() { 14205 void clear() {
13587 throw new UnsupportedError("Cannot clear immutable List."); 14206 throw new UnsupportedError("Cannot clear immutable List.");
13588 } 14207 }
13589 14208
13590 void sort([int compare(Node a, Node b)]) { 14209 void sort([int compare(Node a, Node b)]) {
13591 throw new UnsupportedError("Cannot sort immutable List."); 14210 throw new UnsupportedError("Cannot sort immutable List.");
13592 } 14211 }
13593 14212
13594 int indexOf(Node element, [int start = 0]) => 14213 int indexOf(Node element, [int start = 0]) =>
13595 Lists.indexOf(this, element, start, this.length); 14214 Lists.indexOf(this, element, start, this.length);
13596 14215
13597 int lastIndexOf(Node element, [int start]) { 14216 int lastIndexOf(Node element, [int start]) {
13598 if (start == null) start = length - 1; 14217 if (start == null) start = length - 1;
13599 return Lists.lastIndexOf(this, element, start); 14218 return Lists.lastIndexOf(this, element, start);
13600 } 14219 }
13601 14220
13602 Node get first => this[0]; 14221 Node get first {
14222 if (this.length > 0) return this[0];
14223 throw new StateError("No elements");
14224 }
13603 14225
13604 Node get last => this[length - 1]; 14226 Node get last {
14227 if (this.length > 0) return this[this.length - 1];
14228 throw new StateError("No elements");
14229 }
14230
14231 Node get single {
14232 if (length == 1) return this[0];
14233 if (length == 0) throw new StateError("No elements");
14234 throw new StateError("More than one element");
14235 }
14236
14237 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
14238
14239 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
13605 14240
13606 Node removeAt(int pos) { 14241 Node removeAt(int pos) {
13607 throw new UnsupportedError("Cannot removeAt on immutable List."); 14242 throw new UnsupportedError("Cannot removeAt on immutable List.");
13608 } 14243 }
13609 14244
13610 Node removeLast() { 14245 Node removeLast() {
13611 throw new UnsupportedError("Cannot removeLast on immutable List."); 14246 throw new UnsupportedError("Cannot removeLast on immutable List.");
13612 } 14247 }
13613 14248
13614 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 14249 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
13771 * Lazy implementation of the child nodes of an element that does not request 14406 * Lazy implementation of the child nodes of an element that does not request
13772 * the actual child nodes of an element until strictly necessary greatly 14407 * the actual child nodes of an element until strictly necessary greatly
13773 * improving performance for the typical cases where it is not required. 14408 * improving performance for the typical cases where it is not required.
13774 */ 14409 */
13775 class _ChildNodeListLazy implements List { 14410 class _ChildNodeListLazy implements List {
13776 final Node _this; 14411 final Node _this;
13777 14412
13778 _ChildNodeListLazy(this._this); 14413 _ChildNodeListLazy(this._this);
13779 14414
13780 14415
13781 Node get first => JS('Node', '#.firstChild', _this); 14416 Node get first {
13782 Node get last => JS('Node', '#.lastChild', _this); 14417 Node result = JS('Node', '#.firstChild', _this);
14418 if (result == null) throw new StateError("No elements");
14419 return result;
14420 }
14421 Node get last {
14422 Node result = JS('Node', '#.lastChild', _this);
14423 if (result == null) throw new StateError("No elements");
14424 return result;
14425 }
14426 Node get single {
14427 int l = this.length;
14428 if (l == 0) throw new StateError("No elements");
14429 if (l > 1) throw new StateError("More than one element");
14430 return JS('Node', '#.firstChild', _this);
14431 }
14432
14433 Node min([int compare(Node a, Node b)]) {
14434 return _Collections.minInList(this, compare);
14435 }
14436
14437 Node max([int compare(Node a, Node b)]) {
14438 return _Collections.maxInList(this, compare);
14439 }
13783 14440
13784 void add(Node value) { 14441 void add(Node value) {
13785 _this.$dom_appendChild(value); 14442 _this.$dom_appendChild(value);
13786 } 14443 }
13787 14444
13788 void addLast(Node value) { 14445 void addLast(Node value) {
13789 _this.$dom_appendChild(value); 14446 _this.$dom_appendChild(value);
13790 } 14447 }
13791 14448
13792 14449
13793 void addAll(Collection<Node> collection) { 14450 void addAll(Iterable<Node> iterable) {
13794 for (Node node in collection) { 14451 for (Node node in iterable) {
13795 _this.$dom_appendChild(node); 14452 _this.$dom_appendChild(node);
13796 } 14453 }
13797 } 14454 }
13798 14455
13799 Node removeLast() { 14456 Node removeLast() {
13800 final result = last; 14457 final result = last;
13801 if (result != null) { 14458 if (result != null) {
13802 _this.$dom_removeChild(result); 14459 _this.$dom_removeChild(result);
13803 } 14460 }
13804 return result; 14461 return result;
13805 } 14462 }
13806 14463
13807 Node removeAt(int index) { 14464 Node removeAt(int index) {
13808 var result = this[index]; 14465 var result = this[index];
13809 if (result != null) { 14466 if (result != null) {
13810 _this.$dom_removeChild(result); 14467 _this.$dom_removeChild(result);
13811 } 14468 }
13812 return result; 14469 return result;
13813 } 14470 }
13814 14471
13815 void clear() { 14472 void clear() {
13816 _this.text = ''; 14473 _this.text = '';
13817 } 14474 }
13818 14475
13819 void operator []=(int index, Node value) { 14476 void operator []=(int index, Node value) {
13820 _this.$dom_replaceChild(value, this[index]); 14477 _this.$dom_replaceChild(value, this[index]);
13821 } 14478 }
13822 14479
13823 Iterator<Node> iterator() => _this.$dom_childNodes.iterator(); 14480 Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
13824 14481
13825 // TODO(jacobr): We can implement these methods much more efficiently by 14482 // TODO(jacobr): We can implement these methods much more efficiently by
13826 // looking up the nodeList only once instead of once per iteration. 14483 // looking up the nodeList only once instead of once per iteration.
13827 bool contains(Node element) => Collections.contains(this, element); 14484 bool contains(Node element) => Collections.contains(this, element);
13828 14485
13829 void forEach(void f(Node element)) => Collections.forEach(this, f); 14486 void forEach(void f(Node element)) => Collections.forEach(this, f);
13830 14487
13831 dynamic reduce(dynamic initialValue, 14488 dynamic reduce(dynamic initialValue,
13832 dynamic combine(dynamic previousValue, Node element)) { 14489 dynamic combine(dynamic previousValue, Node element)) {
13833 return Collections.reduce(this, initialValue, combine); 14490 return Collections.reduce(this, initialValue, combine);
13834 } 14491 }
13835 14492
13836 Collection map(f(Node element)) => Collections.map(this, [], f); 14493 String join([String separator]) {
14494 return Collections.joinList(this, separator);
14495 }
13837 14496
13838 Collection<Node> filter(bool f(Node element)) => 14497 List mappedBy(f(Node element)) =>
13839 Collections.filter(this, <Node>[], f); 14498 new MappedList<Node, dynamic>(this, f);
14499
14500 Iterable<Node> where(bool f(Node element)) =>
14501 new WhereIterable<Node>(this, f);
13840 14502
13841 bool every(bool f(Node element)) => Collections.every(this, f); 14503 bool every(bool f(Node element)) => Collections.every(this, f);
13842 14504
13843 bool some(bool f(Node element)) => Collections.some(this, f); 14505 bool any(bool f(Node element)) => Collections.any(this, f);
13844 14506
13845 bool get isEmpty => this.length == 0; 14507 bool get isEmpty => this.length == 0;
13846 14508
13847 // From List<Node>: 14509 // From List<Node>:
13848 14510
14511 List<Node> take(int n) {
14512 return new ListView<Node>(this, 0, n);
14513 }
14514
14515 Iterable<Node> takeWhile(bool test(Node value)) {
14516 return new TakeWhileIterable<Node>(this, test);
14517 }
14518
14519 List<Node> skip(int n) {
14520 return new ListView<Node>(this, n, null);
14521 }
14522
14523 Iterable<Node> skipWhile(bool test(Node value)) {
14524 return new SkipWhileIterable<Node>(this, test);
14525 }
14526
14527 Node firstMatching(bool test(Node value), {Node orElse()}) {
14528 return Collections.firstMatching(this, test, orElse);
14529 }
14530
14531 Node lastMatching(bool test(Node value), {Node orElse()}) {
14532 return Collections.lastMatchingInList(this, test, orElse);
14533 }
14534
14535 Node singleMatching(bool test(Node value)) {
14536 return Collections.singleMatching(this, test);
14537 }
14538
14539 Node elementAt(int index) {
14540 return this[index];
14541 }
14542
13849 // TODO(jacobr): this could be implemented for child node lists. 14543 // TODO(jacobr): this could be implemented for child node lists.
13850 // The exception we throw here is misleading. 14544 // The exception we throw here is misleading.
13851 void sort([int compare(Node a, Node b)]) { 14545 void sort([int compare(Node a, Node b)]) {
13852 throw new UnsupportedError("Cannot sort immutable List."); 14546 throw new UnsupportedError("Cannot sort immutable List.");
13853 } 14547 }
13854 14548
13855 int indexOf(Node element, [int start = 0]) => 14549 int indexOf(Node element, [int start = 0]) =>
13856 Lists.indexOf(this, element, start, this.length); 14550 Lists.indexOf(this, element, start, this.length);
13857 14551
13858 int lastIndexOf(Node element, [int start = 0]) => 14552 int lastIndexOf(Node element, [int start = 0]) =>
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
14149 Node operator[](int index) => JS("Node", "#[#]", this, index); 14843 Node operator[](int index) => JS("Node", "#[#]", this, index);
14150 14844
14151 void operator[]=(int index, Node value) { 14845 void operator[]=(int index, Node value) {
14152 throw new UnsupportedError("Cannot assign element of immutable List."); 14846 throw new UnsupportedError("Cannot assign element of immutable List.");
14153 } 14847 }
14154 // -- start List<Node> mixins. 14848 // -- start List<Node> mixins.
14155 // Node is the element type. 14849 // Node is the element type.
14156 14850
14157 // From Iterable<Node>: 14851 // From Iterable<Node>:
14158 14852
14159 Iterator<Node> iterator() { 14853 Iterator<Node> get iterator {
14160 // Note: NodeLists are not fixed size. And most probably length shouldn't 14854 // Note: NodeLists are not fixed size. And most probably length shouldn't
14161 // be cached in both iterator _and_ forEach method. For now caching it 14855 // be cached in both iterator _and_ forEach method. For now caching it
14162 // for consistency. 14856 // for consistency.
14163 return new FixedSizeListIterator<Node>(this); 14857 return new FixedSizeListIterator<Node>(this);
14164 } 14858 }
14165 14859
14166 // From Collection<Node>:
14167
14168 void add(Node value) {
14169 throw new UnsupportedError("Cannot add to immutable List.");
14170 }
14171
14172 void addLast(Node value) {
14173 throw new UnsupportedError("Cannot add to immutable List.");
14174 }
14175
14176 void addAll(Collection<Node> collection) {
14177 throw new UnsupportedError("Cannot add to immutable List.");
14178 }
14179
14180 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 14860 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
14181 return Collections.reduce(this, initialValue, combine); 14861 return Collections.reduce(this, initialValue, combine);
14182 } 14862 }
14183 14863
14184 bool contains(Node element) => Collections.contains(this, element); 14864 bool contains(Node element) => Collections.contains(this, element);
14185 14865
14186 void forEach(void f(Node element)) => Collections.forEach(this, f); 14866 void forEach(void f(Node element)) => Collections.forEach(this, f);
14187 14867
14188 Collection map(f(Node element)) => Collections.map(this, [], f); 14868 String join([String separator]) => Collections.joinList(this, separator);
14189 14869
14190 Collection<Node> filter(bool f(Node element)) => 14870 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
14191 Collections.filter(this, <Node>[], f); 14871
14872 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
14192 14873
14193 bool every(bool f(Node element)) => Collections.every(this, f); 14874 bool every(bool f(Node element)) => Collections.every(this, f);
14194 14875
14195 bool some(bool f(Node element)) => Collections.some(this, f); 14876 bool any(bool f(Node element)) => Collections.any(this, f);
14196 14877
14197 bool get isEmpty => this.length == 0; 14878 bool get isEmpty => this.length == 0;
14198 14879
14880 List<Node> take(int n) => new ListView<Node>(this, 0, n);
14881
14882 Iterable<Node> takeWhile(bool test(Node value)) {
14883 return new TakeWhileIterable<Node>(this, test);
14884 }
14885
14886 List<Node> skip(int n) => new ListView<Node>(this, n, null);
14887
14888 Iterable<Node> skipWhile(bool test(Node value)) {
14889 return new SkipWhileIterable<Node>(this, test);
14890 }
14891
14892 Node firstMatching(bool test(Node value), { Node orElse() }) {
14893 return Collections.firstMatching(this, test, orElse);
14894 }
14895
14896 Node lastMatching(bool test(Node value), {Node orElse()}) {
14897 return Collections.lastMatchingInList(this, test, orElse);
14898 }
14899
14900 Node singleMatching(bool test(Node value)) {
14901 return Collections.singleMatching(this, test);
14902 }
14903
14904 Node elementAt(int index) {
14905 return this[index];
14906 }
14907
14908 // From Collection<Node>:
14909
14910 void add(Node value) {
14911 throw new UnsupportedError("Cannot add to immutable List.");
14912 }
14913
14914 void addLast(Node value) {
14915 throw new UnsupportedError("Cannot add to immutable List.");
14916 }
14917
14918 void addAll(Iterable<Node> iterable) {
14919 throw new UnsupportedError("Cannot add to immutable List.");
14920 }
14921
14199 // From List<Node>: 14922 // From List<Node>:
14200 void set length(int value) { 14923 void set length(int value) {
14201 throw new UnsupportedError("Cannot resize immutable List."); 14924 throw new UnsupportedError("Cannot resize immutable List.");
14202 } 14925 }
14203 14926
14204 void clear() { 14927 void clear() {
14205 throw new UnsupportedError("Cannot clear immutable List."); 14928 throw new UnsupportedError("Cannot clear immutable List.");
14206 } 14929 }
14207 14930
14208 void sort([int compare(Node a, Node b)]) { 14931 void sort([int compare(Node a, Node b)]) {
14209 throw new UnsupportedError("Cannot sort immutable List."); 14932 throw new UnsupportedError("Cannot sort immutable List.");
14210 } 14933 }
14211 14934
14212 int indexOf(Node element, [int start = 0]) => 14935 int indexOf(Node element, [int start = 0]) =>
14213 Lists.indexOf(this, element, start, this.length); 14936 Lists.indexOf(this, element, start, this.length);
14214 14937
14215 int lastIndexOf(Node element, [int start]) { 14938 int lastIndexOf(Node element, [int start]) {
14216 if (start == null) start = length - 1; 14939 if (start == null) start = length - 1;
14217 return Lists.lastIndexOf(this, element, start); 14940 return Lists.lastIndexOf(this, element, start);
14218 } 14941 }
14219 14942
14220 Node get first => this[0]; 14943 Node get first {
14944 if (this.length > 0) return this[0];
14945 throw new StateError("No elements");
14946 }
14221 14947
14222 Node get last => this[length - 1]; 14948 Node get last {
14949 if (this.length > 0) return this[this.length - 1];
14950 throw new StateError("No elements");
14951 }
14952
14953 Node get single {
14954 if (length == 1) return this[0];
14955 if (length == 0) throw new StateError("No elements");
14956 throw new StateError("More than one element");
14957 }
14958
14959 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
14960
14961 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
14223 14962
14224 Node removeAt(int pos) { 14963 Node removeAt(int pos) {
14225 throw new UnsupportedError("Cannot removeAt on immutable List."); 14964 throw new UnsupportedError("Cannot removeAt on immutable List.");
14226 } 14965 }
14227 14966
14228 Node removeLast() { 14967 Node removeLast() {
14229 throw new UnsupportedError("Cannot removeLast on immutable List."); 14968 throw new UnsupportedError("Cannot removeLast on immutable List.");
14230 } 14969 }
14231 14970
14232 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 14971 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
15801 /// @domName HTMLSelectElement.namedItem; @docsEditable true 16540 /// @domName HTMLSelectElement.namedItem; @docsEditable true
15802 Node namedItem(String name) native; 16541 Node namedItem(String name) native;
15803 16542
15804 /// @domName HTMLSelectElement.setCustomValidity; @docsEditable true 16543 /// @domName HTMLSelectElement.setCustomValidity; @docsEditable true
15805 void setCustomValidity(String error) native; 16544 void setCustomValidity(String error) native;
15806 16545
15807 16546
15808 // Override default options, since IE returns SelectElement itself and it 16547 // Override default options, since IE returns SelectElement itself and it
15809 // does not operate as a List. 16548 // does not operate as a List.
15810 List<OptionElement> get options { 16549 List<OptionElement> get options {
15811 return this.children.filter((e) => e is OptionElement); 16550 return this.children.where((e) => e is OptionElement).toList();
15812 } 16551 }
15813 16552
15814 List<OptionElement> get selectedOptions { 16553 List<OptionElement> get selectedOptions {
15815 // IE does not change the selected flag for single-selection items. 16554 // IE does not change the selected flag for single-selection items.
15816 if (this.multiple) { 16555 if (this.multiple) {
15817 return this.options.filter((o) => o.selected); 16556 return this.options.where((o) => o.selected).toList();
15818 } else { 16557 } else {
15819 return [this.options[this.selectedIndex]]; 16558 return [this.options[this.selectedIndex]];
15820 } 16559 }
15821 } 16560 }
15822 } 16561 }
15823 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 16562 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
15824 // for details. All rights reserved. Use of this source code is governed by a 16563 // for details. All rights reserved. Use of this source code is governed by a
15825 // BSD-style license that can be found in the LICENSE file. 16564 // BSD-style license that can be found in the LICENSE file.
15826 16565
15827 16566
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
15973 SourceBuffer operator[](int index) => JS("SourceBuffer", "#[#]", this, index); 16712 SourceBuffer operator[](int index) => JS("SourceBuffer", "#[#]", this, index);
15974 16713
15975 void operator[]=(int index, SourceBuffer value) { 16714 void operator[]=(int index, SourceBuffer value) {
15976 throw new UnsupportedError("Cannot assign element of immutable List."); 16715 throw new UnsupportedError("Cannot assign element of immutable List.");
15977 } 16716 }
15978 // -- start List<SourceBuffer> mixins. 16717 // -- start List<SourceBuffer> mixins.
15979 // SourceBuffer is the element type. 16718 // SourceBuffer is the element type.
15980 16719
15981 // From Iterable<SourceBuffer>: 16720 // From Iterable<SourceBuffer>:
15982 16721
15983 Iterator<SourceBuffer> iterator() { 16722 Iterator<SourceBuffer> get iterator {
15984 // Note: NodeLists are not fixed size. And most probably length shouldn't 16723 // Note: NodeLists are not fixed size. And most probably length shouldn't
15985 // be cached in both iterator _and_ forEach method. For now caching it 16724 // be cached in both iterator _and_ forEach method. For now caching it
15986 // for consistency. 16725 // for consistency.
15987 return new FixedSizeListIterator<SourceBuffer>(this); 16726 return new FixedSizeListIterator<SourceBuffer>(this);
15988 } 16727 }
15989 16728
15990 // From Collection<SourceBuffer>:
15991
15992 void add(SourceBuffer value) {
15993 throw new UnsupportedError("Cannot add to immutable List.");
15994 }
15995
15996 void addLast(SourceBuffer value) {
15997 throw new UnsupportedError("Cannot add to immutable List.");
15998 }
15999
16000 void addAll(Collection<SourceBuffer> collection) {
16001 throw new UnsupportedError("Cannot add to immutable List.");
16002 }
16003
16004 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SourceBuffer)) { 16729 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SourceBuffer)) {
16005 return Collections.reduce(this, initialValue, combine); 16730 return Collections.reduce(this, initialValue, combine);
16006 } 16731 }
16007 16732
16008 bool contains(SourceBuffer element) => Collections.contains(this, element); 16733 bool contains(SourceBuffer element) => Collections.contains(this, element);
16009 16734
16010 void forEach(void f(SourceBuffer element)) => Collections.forEach(this, f); 16735 void forEach(void f(SourceBuffer element)) => Collections.forEach(this, f);
16011 16736
16012 Collection map(f(SourceBuffer element)) => Collections.map(this, [], f); 16737 String join([String separator]) => Collections.joinList(this, separator);
16013 16738
16014 Collection<SourceBuffer> filter(bool f(SourceBuffer element)) => 16739 List mappedBy(f(SourceBuffer element)) => new MappedList<SourceBuffer, dynamic >(this, f);
16015 Collections.filter(this, <SourceBuffer>[], f); 16740
16741 Iterable<SourceBuffer> where(bool f(SourceBuffer element)) => new WhereIterabl e<SourceBuffer>(this, f);
16016 16742
16017 bool every(bool f(SourceBuffer element)) => Collections.every(this, f); 16743 bool every(bool f(SourceBuffer element)) => Collections.every(this, f);
16018 16744
16019 bool some(bool f(SourceBuffer element)) => Collections.some(this, f); 16745 bool any(bool f(SourceBuffer element)) => Collections.any(this, f);
16020 16746
16021 bool get isEmpty => this.length == 0; 16747 bool get isEmpty => this.length == 0;
16022 16748
16749 List<SourceBuffer> take(int n) => new ListView<SourceBuffer>(this, 0, n);
16750
16751 Iterable<SourceBuffer> takeWhile(bool test(SourceBuffer value)) {
16752 return new TakeWhileIterable<SourceBuffer>(this, test);
16753 }
16754
16755 List<SourceBuffer> skip(int n) => new ListView<SourceBuffer>(this, n, null);
16756
16757 Iterable<SourceBuffer> skipWhile(bool test(SourceBuffer value)) {
16758 return new SkipWhileIterable<SourceBuffer>(this, test);
16759 }
16760
16761 SourceBuffer firstMatching(bool test(SourceBuffer value), { SourceBuffer orEls e() }) {
16762 return Collections.firstMatching(this, test, orElse);
16763 }
16764
16765 SourceBuffer lastMatching(bool test(SourceBuffer value), {SourceBuffer orElse( )}) {
16766 return Collections.lastMatchingInList(this, test, orElse);
16767 }
16768
16769 SourceBuffer singleMatching(bool test(SourceBuffer value)) {
16770 return Collections.singleMatching(this, test);
16771 }
16772
16773 SourceBuffer elementAt(int index) {
16774 return this[index];
16775 }
16776
16777 // From Collection<SourceBuffer>:
16778
16779 void add(SourceBuffer value) {
16780 throw new UnsupportedError("Cannot add to immutable List.");
16781 }
16782
16783 void addLast(SourceBuffer value) {
16784 throw new UnsupportedError("Cannot add to immutable List.");
16785 }
16786
16787 void addAll(Iterable<SourceBuffer> iterable) {
16788 throw new UnsupportedError("Cannot add to immutable List.");
16789 }
16790
16023 // From List<SourceBuffer>: 16791 // From List<SourceBuffer>:
16024 void set length(int value) { 16792 void set length(int value) {
16025 throw new UnsupportedError("Cannot resize immutable List."); 16793 throw new UnsupportedError("Cannot resize immutable List.");
16026 } 16794 }
16027 16795
16028 void clear() { 16796 void clear() {
16029 throw new UnsupportedError("Cannot clear immutable List."); 16797 throw new UnsupportedError("Cannot clear immutable List.");
16030 } 16798 }
16031 16799
16032 void sort([int compare(SourceBuffer a, SourceBuffer b)]) { 16800 void sort([int compare(SourceBuffer a, SourceBuffer b)]) {
16033 throw new UnsupportedError("Cannot sort immutable List."); 16801 throw new UnsupportedError("Cannot sort immutable List.");
16034 } 16802 }
16035 16803
16036 int indexOf(SourceBuffer element, [int start = 0]) => 16804 int indexOf(SourceBuffer element, [int start = 0]) =>
16037 Lists.indexOf(this, element, start, this.length); 16805 Lists.indexOf(this, element, start, this.length);
16038 16806
16039 int lastIndexOf(SourceBuffer element, [int start]) { 16807 int lastIndexOf(SourceBuffer element, [int start]) {
16040 if (start == null) start = length - 1; 16808 if (start == null) start = length - 1;
16041 return Lists.lastIndexOf(this, element, start); 16809 return Lists.lastIndexOf(this, element, start);
16042 } 16810 }
16043 16811
16044 SourceBuffer get first => this[0]; 16812 SourceBuffer get first {
16813 if (this.length > 0) return this[0];
16814 throw new StateError("No elements");
16815 }
16045 16816
16046 SourceBuffer get last => this[length - 1]; 16817 SourceBuffer get last {
16818 if (this.length > 0) return this[this.length - 1];
16819 throw new StateError("No elements");
16820 }
16821
16822 SourceBuffer get single {
16823 if (length == 1) return this[0];
16824 if (length == 0) throw new StateError("No elements");
16825 throw new StateError("More than one element");
16826 }
16827
16828 SourceBuffer min([int compare(SourceBuffer a, SourceBuffer b)]) => _Collection s.minInList(this, compare);
16829
16830 SourceBuffer max([int compare(SourceBuffer a, SourceBuffer b)]) => _Collection s.maxInList(this, compare);
16047 16831
16048 SourceBuffer removeAt(int pos) { 16832 SourceBuffer removeAt(int pos) {
16049 throw new UnsupportedError("Cannot removeAt on immutable List."); 16833 throw new UnsupportedError("Cannot removeAt on immutable List.");
16050 } 16834 }
16051 16835
16052 SourceBuffer removeLast() { 16836 SourceBuffer removeLast() {
16053 throw new UnsupportedError("Cannot removeLast on immutable List."); 16837 throw new UnsupportedError("Cannot removeLast on immutable List.");
16054 } 16838 }
16055 16839
16056 void setRange(int start, int rangeLength, List<SourceBuffer> from, [int startF rom]) { 16840 void setRange(int start, int rangeLength, List<SourceBuffer> from, [int startF rom]) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
16152 SpeechGrammar operator[](int index) => JS("SpeechGrammar", "#[#]", this, index ); 16936 SpeechGrammar operator[](int index) => JS("SpeechGrammar", "#[#]", this, index );
16153 16937
16154 void operator[]=(int index, SpeechGrammar value) { 16938 void operator[]=(int index, SpeechGrammar value) {
16155 throw new UnsupportedError("Cannot assign element of immutable List."); 16939 throw new UnsupportedError("Cannot assign element of immutable List.");
16156 } 16940 }
16157 // -- start List<SpeechGrammar> mixins. 16941 // -- start List<SpeechGrammar> mixins.
16158 // SpeechGrammar is the element type. 16942 // SpeechGrammar is the element type.
16159 16943
16160 // From Iterable<SpeechGrammar>: 16944 // From Iterable<SpeechGrammar>:
16161 16945
16162 Iterator<SpeechGrammar> iterator() { 16946 Iterator<SpeechGrammar> get iterator {
16163 // Note: NodeLists are not fixed size. And most probably length shouldn't 16947 // Note: NodeLists are not fixed size. And most probably length shouldn't
16164 // be cached in both iterator _and_ forEach method. For now caching it 16948 // be cached in both iterator _and_ forEach method. For now caching it
16165 // for consistency. 16949 // for consistency.
16166 return new FixedSizeListIterator<SpeechGrammar>(this); 16950 return new FixedSizeListIterator<SpeechGrammar>(this);
16167 } 16951 }
16168 16952
16953 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechGrammar)) {
16954 return Collections.reduce(this, initialValue, combine);
16955 }
16956
16957 bool contains(SpeechGrammar element) => Collections.contains(this, element);
16958
16959 void forEach(void f(SpeechGrammar element)) => Collections.forEach(this, f);
16960
16961 String join([String separator]) => Collections.joinList(this, separator);
16962
16963 List mappedBy(f(SpeechGrammar element)) => new MappedList<SpeechGrammar, dynam ic>(this, f);
16964
16965 Iterable<SpeechGrammar> where(bool f(SpeechGrammar element)) => new WhereItera ble<SpeechGrammar>(this, f);
16966
16967 bool every(bool f(SpeechGrammar element)) => Collections.every(this, f);
16968
16969 bool any(bool f(SpeechGrammar element)) => Collections.any(this, f);
16970
16971 bool get isEmpty => this.length == 0;
16972
16973 List<SpeechGrammar> take(int n) => new ListView<SpeechGrammar>(this, 0, n);
16974
16975 Iterable<SpeechGrammar> takeWhile(bool test(SpeechGrammar value)) {
16976 return new TakeWhileIterable<SpeechGrammar>(this, test);
16977 }
16978
16979 List<SpeechGrammar> skip(int n) => new ListView<SpeechGrammar>(this, n, null);
16980
16981 Iterable<SpeechGrammar> skipWhile(bool test(SpeechGrammar value)) {
16982 return new SkipWhileIterable<SpeechGrammar>(this, test);
16983 }
16984
16985 SpeechGrammar firstMatching(bool test(SpeechGrammar value), { SpeechGrammar or Else() }) {
16986 return Collections.firstMatching(this, test, orElse);
16987 }
16988
16989 SpeechGrammar lastMatching(bool test(SpeechGrammar value), {SpeechGrammar orEl se()}) {
16990 return Collections.lastMatchingInList(this, test, orElse);
16991 }
16992
16993 SpeechGrammar singleMatching(bool test(SpeechGrammar value)) {
16994 return Collections.singleMatching(this, test);
16995 }
16996
16997 SpeechGrammar elementAt(int index) {
16998 return this[index];
16999 }
17000
16169 // From Collection<SpeechGrammar>: 17001 // From Collection<SpeechGrammar>:
16170 17002
16171 void add(SpeechGrammar value) { 17003 void add(SpeechGrammar value) {
16172 throw new UnsupportedError("Cannot add to immutable List."); 17004 throw new UnsupportedError("Cannot add to immutable List.");
16173 } 17005 }
16174 17006
16175 void addLast(SpeechGrammar value) { 17007 void addLast(SpeechGrammar value) {
16176 throw new UnsupportedError("Cannot add to immutable List."); 17008 throw new UnsupportedError("Cannot add to immutable List.");
16177 } 17009 }
16178 17010
16179 void addAll(Collection<SpeechGrammar> collection) { 17011 void addAll(Iterable<SpeechGrammar> iterable) {
16180 throw new UnsupportedError("Cannot add to immutable List."); 17012 throw new UnsupportedError("Cannot add to immutable List.");
16181 } 17013 }
16182 17014
16183 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechGrammar)) {
16184 return Collections.reduce(this, initialValue, combine);
16185 }
16186
16187 bool contains(SpeechGrammar element) => Collections.contains(this, element);
16188
16189 void forEach(void f(SpeechGrammar element)) => Collections.forEach(this, f);
16190
16191 Collection map(f(SpeechGrammar element)) => Collections.map(this, [], f);
16192
16193 Collection<SpeechGrammar> filter(bool f(SpeechGrammar element)) =>
16194 Collections.filter(this, <SpeechGrammar>[], f);
16195
16196 bool every(bool f(SpeechGrammar element)) => Collections.every(this, f);
16197
16198 bool some(bool f(SpeechGrammar element)) => Collections.some(this, f);
16199
16200 bool get isEmpty => this.length == 0;
16201
16202 // From List<SpeechGrammar>: 17015 // From List<SpeechGrammar>:
16203 void set length(int value) { 17016 void set length(int value) {
16204 throw new UnsupportedError("Cannot resize immutable List."); 17017 throw new UnsupportedError("Cannot resize immutable List.");
16205 } 17018 }
16206 17019
16207 void clear() { 17020 void clear() {
16208 throw new UnsupportedError("Cannot clear immutable List."); 17021 throw new UnsupportedError("Cannot clear immutable List.");
16209 } 17022 }
16210 17023
16211 void sort([int compare(SpeechGrammar a, SpeechGrammar b)]) { 17024 void sort([int compare(SpeechGrammar a, SpeechGrammar b)]) {
16212 throw new UnsupportedError("Cannot sort immutable List."); 17025 throw new UnsupportedError("Cannot sort immutable List.");
16213 } 17026 }
16214 17027
16215 int indexOf(SpeechGrammar element, [int start = 0]) => 17028 int indexOf(SpeechGrammar element, [int start = 0]) =>
16216 Lists.indexOf(this, element, start, this.length); 17029 Lists.indexOf(this, element, start, this.length);
16217 17030
16218 int lastIndexOf(SpeechGrammar element, [int start]) { 17031 int lastIndexOf(SpeechGrammar element, [int start]) {
16219 if (start == null) start = length - 1; 17032 if (start == null) start = length - 1;
16220 return Lists.lastIndexOf(this, element, start); 17033 return Lists.lastIndexOf(this, element, start);
16221 } 17034 }
16222 17035
16223 SpeechGrammar get first => this[0]; 17036 SpeechGrammar get first {
17037 if (this.length > 0) return this[0];
17038 throw new StateError("No elements");
17039 }
16224 17040
16225 SpeechGrammar get last => this[length - 1]; 17041 SpeechGrammar get last {
17042 if (this.length > 0) return this[this.length - 1];
17043 throw new StateError("No elements");
17044 }
17045
17046 SpeechGrammar get single {
17047 if (length == 1) return this[0];
17048 if (length == 0) throw new StateError("No elements");
17049 throw new StateError("More than one element");
17050 }
17051
17052 SpeechGrammar min([int compare(SpeechGrammar a, SpeechGrammar b)]) => _Collect ions.minInList(this, compare);
17053
17054 SpeechGrammar max([int compare(SpeechGrammar a, SpeechGrammar b)]) => _Collect ions.maxInList(this, compare);
16226 17055
16227 SpeechGrammar removeAt(int pos) { 17056 SpeechGrammar removeAt(int pos) {
16228 throw new UnsupportedError("Cannot removeAt on immutable List."); 17057 throw new UnsupportedError("Cannot removeAt on immutable List.");
16229 } 17058 }
16230 17059
16231 SpeechGrammar removeLast() { 17060 SpeechGrammar removeLast() {
16232 throw new UnsupportedError("Cannot removeLast on immutable List."); 17061 throw new UnsupportedError("Cannot removeLast on immutable List.");
16233 } 17062 }
16234 17063
16235 void setRange(int start, int rangeLength, List<SpeechGrammar> from, [int start From]) { 17064 void setRange(int start, int rangeLength, List<SpeechGrammar> from, [int start From]) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
16533 Map operator[](int index) => JS("Map", "#[#]", this, index); 17362 Map operator[](int index) => JS("Map", "#[#]", this, index);
16534 17363
16535 void operator[]=(int index, Map value) { 17364 void operator[]=(int index, Map value) {
16536 throw new UnsupportedError("Cannot assign element of immutable List."); 17365 throw new UnsupportedError("Cannot assign element of immutable List.");
16537 } 17366 }
16538 // -- start List<Map> mixins. 17367 // -- start List<Map> mixins.
16539 // Map is the element type. 17368 // Map is the element type.
16540 17369
16541 // From Iterable<Map>: 17370 // From Iterable<Map>:
16542 17371
16543 Iterator<Map> iterator() { 17372 Iterator<Map> get iterator {
16544 // Note: NodeLists are not fixed size. And most probably length shouldn't 17373 // Note: NodeLists are not fixed size. And most probably length shouldn't
16545 // be cached in both iterator _and_ forEach method. For now caching it 17374 // be cached in both iterator _and_ forEach method. For now caching it
16546 // for consistency. 17375 // for consistency.
16547 return new FixedSizeListIterator<Map>(this); 17376 return new FixedSizeListIterator<Map>(this);
16548 } 17377 }
16549 17378
16550 // From Collection<Map>:
16551
16552 void add(Map value) {
16553 throw new UnsupportedError("Cannot add to immutable List.");
16554 }
16555
16556 void addLast(Map value) {
16557 throw new UnsupportedError("Cannot add to immutable List.");
16558 }
16559
16560 void addAll(Collection<Map> collection) {
16561 throw new UnsupportedError("Cannot add to immutable List.");
16562 }
16563
16564 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Map)) { 17379 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Map)) {
16565 return Collections.reduce(this, initialValue, combine); 17380 return Collections.reduce(this, initialValue, combine);
16566 } 17381 }
16567 17382
16568 bool contains(Map element) => Collections.contains(this, element); 17383 bool contains(Map element) => Collections.contains(this, element);
16569 17384
16570 void forEach(void f(Map element)) => Collections.forEach(this, f); 17385 void forEach(void f(Map element)) => Collections.forEach(this, f);
16571 17386
16572 Collection map(f(Map element)) => Collections.map(this, [], f); 17387 String join([String separator]) => Collections.joinList(this, separator);
16573 17388
16574 Collection<Map> filter(bool f(Map element)) => 17389 List mappedBy(f(Map element)) => new MappedList<Map, dynamic>(this, f);
16575 Collections.filter(this, <Map>[], f); 17390
17391 Iterable<Map> where(bool f(Map element)) => new WhereIterable<Map>(this, f);
16576 17392
16577 bool every(bool f(Map element)) => Collections.every(this, f); 17393 bool every(bool f(Map element)) => Collections.every(this, f);
16578 17394
16579 bool some(bool f(Map element)) => Collections.some(this, f); 17395 bool any(bool f(Map element)) => Collections.any(this, f);
16580 17396
16581 bool get isEmpty => this.length == 0; 17397 bool get isEmpty => this.length == 0;
16582 17398
17399 List<Map> take(int n) => new ListView<Map>(this, 0, n);
17400
17401 Iterable<Map> takeWhile(bool test(Map value)) {
17402 return new TakeWhileIterable<Map>(this, test);
17403 }
17404
17405 List<Map> skip(int n) => new ListView<Map>(this, n, null);
17406
17407 Iterable<Map> skipWhile(bool test(Map value)) {
17408 return new SkipWhileIterable<Map>(this, test);
17409 }
17410
17411 Map firstMatching(bool test(Map value), { Map orElse() }) {
17412 return Collections.firstMatching(this, test, orElse);
17413 }
17414
17415 Map lastMatching(bool test(Map value), {Map orElse()}) {
17416 return Collections.lastMatchingInList(this, test, orElse);
17417 }
17418
17419 Map singleMatching(bool test(Map value)) {
17420 return Collections.singleMatching(this, test);
17421 }
17422
17423 Map elementAt(int index) {
17424 return this[index];
17425 }
17426
17427 // From Collection<Map>:
17428
17429 void add(Map value) {
17430 throw new UnsupportedError("Cannot add to immutable List.");
17431 }
17432
17433 void addLast(Map value) {
17434 throw new UnsupportedError("Cannot add to immutable List.");
17435 }
17436
17437 void addAll(Iterable<Map> iterable) {
17438 throw new UnsupportedError("Cannot add to immutable List.");
17439 }
17440
16583 // From List<Map>: 17441 // From List<Map>:
16584 void set length(int value) { 17442 void set length(int value) {
16585 throw new UnsupportedError("Cannot resize immutable List."); 17443 throw new UnsupportedError("Cannot resize immutable List.");
16586 } 17444 }
16587 17445
16588 void clear() { 17446 void clear() {
16589 throw new UnsupportedError("Cannot clear immutable List."); 17447 throw new UnsupportedError("Cannot clear immutable List.");
16590 } 17448 }
16591 17449
16592 void sort([int compare(Map a, Map b)]) { 17450 void sort([int compare(Map a, Map b)]) {
16593 throw new UnsupportedError("Cannot sort immutable List."); 17451 throw new UnsupportedError("Cannot sort immutable List.");
16594 } 17452 }
16595 17453
16596 int indexOf(Map element, [int start = 0]) => 17454 int indexOf(Map element, [int start = 0]) =>
16597 Lists.indexOf(this, element, start, this.length); 17455 Lists.indexOf(this, element, start, this.length);
16598 17456
16599 int lastIndexOf(Map element, [int start]) { 17457 int lastIndexOf(Map element, [int start]) {
16600 if (start == null) start = length - 1; 17458 if (start == null) start = length - 1;
16601 return Lists.lastIndexOf(this, element, start); 17459 return Lists.lastIndexOf(this, element, start);
16602 } 17460 }
16603 17461
16604 Map get first => this[0]; 17462 Map get first {
17463 if (this.length > 0) return this[0];
17464 throw new StateError("No elements");
17465 }
16605 17466
16606 Map get last => this[length - 1]; 17467 Map get last {
17468 if (this.length > 0) return this[this.length - 1];
17469 throw new StateError("No elements");
17470 }
17471
17472 Map get single {
17473 if (length == 1) return this[0];
17474 if (length == 0) throw new StateError("No elements");
17475 throw new StateError("More than one element");
17476 }
17477
17478 Map min([int compare(Map a, Map b)]) => _Collections.minInList(this, compare);
17479
17480 Map max([int compare(Map a, Map b)]) => _Collections.maxInList(this, compare);
16607 17481
16608 Map removeAt(int pos) { 17482 Map removeAt(int pos) {
16609 throw new UnsupportedError("Cannot removeAt on immutable List."); 17483 throw new UnsupportedError("Cannot removeAt on immutable List.");
16610 } 17484 }
16611 17485
16612 Map removeLast() { 17486 Map removeLast() {
16613 throw new UnsupportedError("Cannot removeLast on immutable List."); 17487 throw new UnsupportedError("Cannot removeLast on immutable List.");
16614 } 17488 }
16615 17489
16616 void setRange(int start, int rangeLength, List<Map> from, [int startFrom]) { 17490 void setRange(int start, int rangeLength, List<Map> from, [int startFrom]) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
16662 } 17536 }
16663 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 17537 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
16664 // for details. All rights reserved. Use of this source code is governed by a 17538 // for details. All rights reserved. Use of this source code is governed by a
16665 // BSD-style license that can be found in the LICENSE file. 17539 // BSD-style license that can be found in the LICENSE file.
16666 17540
16667 17541
16668 /// @domName Storage 17542 /// @domName Storage
16669 class Storage implements Map<String, String> native "*Storage" { 17543 class Storage implements Map<String, String> native "*Storage" {
16670 17544
16671 // TODO(nweiz): update this when maps support lazy iteration 17545 // TODO(nweiz): update this when maps support lazy iteration
16672 bool containsValue(String value) => values.some((e) => e == value); 17546 bool containsValue(String value) => values.any((e) => e == value);
16673 17547
16674 bool containsKey(String key) => $dom_getItem(key) != null; 17548 bool containsKey(String key) => $dom_getItem(key) != null;
16675 17549
16676 String operator [](String key) => $dom_getItem(key); 17550 String operator [](String key) => $dom_getItem(key);
16677 17551
16678 void operator []=(String key, String value) { $dom_setItem(key, value); } 17552 void operator []=(String key, String value) { $dom_setItem(key, value); }
16679 17553
16680 String putIfAbsent(String key, String ifAbsent()) { 17554 String putIfAbsent(String key, String ifAbsent()) {
16681 if (!containsKey(key)) this[key] = ifAbsent(); 17555 if (!containsKey(key)) this[key] = ifAbsent();
16682 return this[key]; 17556 return this[key];
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
17338 TextTrackCue operator[](int index) => JS("TextTrackCue", "#[#]", this, index); 18212 TextTrackCue operator[](int index) => JS("TextTrackCue", "#[#]", this, index);
17339 18213
17340 void operator[]=(int index, TextTrackCue value) { 18214 void operator[]=(int index, TextTrackCue value) {
17341 throw new UnsupportedError("Cannot assign element of immutable List."); 18215 throw new UnsupportedError("Cannot assign element of immutable List.");
17342 } 18216 }
17343 // -- start List<TextTrackCue> mixins. 18217 // -- start List<TextTrackCue> mixins.
17344 // TextTrackCue is the element type. 18218 // TextTrackCue is the element type.
17345 18219
17346 // From Iterable<TextTrackCue>: 18220 // From Iterable<TextTrackCue>:
17347 18221
17348 Iterator<TextTrackCue> iterator() { 18222 Iterator<TextTrackCue> get iterator {
17349 // Note: NodeLists are not fixed size. And most probably length shouldn't 18223 // Note: NodeLists are not fixed size. And most probably length shouldn't
17350 // be cached in both iterator _and_ forEach method. For now caching it 18224 // be cached in both iterator _and_ forEach method. For now caching it
17351 // for consistency. 18225 // for consistency.
17352 return new FixedSizeListIterator<TextTrackCue>(this); 18226 return new FixedSizeListIterator<TextTrackCue>(this);
17353 } 18227 }
17354 18228
17355 // From Collection<TextTrackCue>:
17356
17357 void add(TextTrackCue value) {
17358 throw new UnsupportedError("Cannot add to immutable List.");
17359 }
17360
17361 void addLast(TextTrackCue value) {
17362 throw new UnsupportedError("Cannot add to immutable List.");
17363 }
17364
17365 void addAll(Collection<TextTrackCue> collection) {
17366 throw new UnsupportedError("Cannot add to immutable List.");
17367 }
17368
17369 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrackCue)) { 18229 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrackCue)) {
17370 return Collections.reduce(this, initialValue, combine); 18230 return Collections.reduce(this, initialValue, combine);
17371 } 18231 }
17372 18232
17373 bool contains(TextTrackCue element) => Collections.contains(this, element); 18233 bool contains(TextTrackCue element) => Collections.contains(this, element);
17374 18234
17375 void forEach(void f(TextTrackCue element)) => Collections.forEach(this, f); 18235 void forEach(void f(TextTrackCue element)) => Collections.forEach(this, f);
17376 18236
17377 Collection map(f(TextTrackCue element)) => Collections.map(this, [], f); 18237 String join([String separator]) => Collections.joinList(this, separator);
17378 18238
17379 Collection<TextTrackCue> filter(bool f(TextTrackCue element)) => 18239 List mappedBy(f(TextTrackCue element)) => new MappedList<TextTrackCue, dynamic >(this, f);
17380 Collections.filter(this, <TextTrackCue>[], f); 18240
18241 Iterable<TextTrackCue> where(bool f(TextTrackCue element)) => new WhereIterabl e<TextTrackCue>(this, f);
17381 18242
17382 bool every(bool f(TextTrackCue element)) => Collections.every(this, f); 18243 bool every(bool f(TextTrackCue element)) => Collections.every(this, f);
17383 18244
17384 bool some(bool f(TextTrackCue element)) => Collections.some(this, f); 18245 bool any(bool f(TextTrackCue element)) => Collections.any(this, f);
17385 18246
17386 bool get isEmpty => this.length == 0; 18247 bool get isEmpty => this.length == 0;
17387 18248
18249 List<TextTrackCue> take(int n) => new ListView<TextTrackCue>(this, 0, n);
18250
18251 Iterable<TextTrackCue> takeWhile(bool test(TextTrackCue value)) {
18252 return new TakeWhileIterable<TextTrackCue>(this, test);
18253 }
18254
18255 List<TextTrackCue> skip(int n) => new ListView<TextTrackCue>(this, n, null);
18256
18257 Iterable<TextTrackCue> skipWhile(bool test(TextTrackCue value)) {
18258 return new SkipWhileIterable<TextTrackCue>(this, test);
18259 }
18260
18261 TextTrackCue firstMatching(bool test(TextTrackCue value), { TextTrackCue orEls e() }) {
18262 return Collections.firstMatching(this, test, orElse);
18263 }
18264
18265 TextTrackCue lastMatching(bool test(TextTrackCue value), {TextTrackCue orElse( )}) {
18266 return Collections.lastMatchingInList(this, test, orElse);
18267 }
18268
18269 TextTrackCue singleMatching(bool test(TextTrackCue value)) {
18270 return Collections.singleMatching(this, test);
18271 }
18272
18273 TextTrackCue elementAt(int index) {
18274 return this[index];
18275 }
18276
18277 // From Collection<TextTrackCue>:
18278
18279 void add(TextTrackCue value) {
18280 throw new UnsupportedError("Cannot add to immutable List.");
18281 }
18282
18283 void addLast(TextTrackCue value) {
18284 throw new UnsupportedError("Cannot add to immutable List.");
18285 }
18286
18287 void addAll(Iterable<TextTrackCue> iterable) {
18288 throw new UnsupportedError("Cannot add to immutable List.");
18289 }
18290
17388 // From List<TextTrackCue>: 18291 // From List<TextTrackCue>:
17389 void set length(int value) { 18292 void set length(int value) {
17390 throw new UnsupportedError("Cannot resize immutable List."); 18293 throw new UnsupportedError("Cannot resize immutable List.");
17391 } 18294 }
17392 18295
17393 void clear() { 18296 void clear() {
17394 throw new UnsupportedError("Cannot clear immutable List."); 18297 throw new UnsupportedError("Cannot clear immutable List.");
17395 } 18298 }
17396 18299
17397 void sort([int compare(TextTrackCue a, TextTrackCue b)]) { 18300 void sort([int compare(TextTrackCue a, TextTrackCue b)]) {
17398 throw new UnsupportedError("Cannot sort immutable List."); 18301 throw new UnsupportedError("Cannot sort immutable List.");
17399 } 18302 }
17400 18303
17401 int indexOf(TextTrackCue element, [int start = 0]) => 18304 int indexOf(TextTrackCue element, [int start = 0]) =>
17402 Lists.indexOf(this, element, start, this.length); 18305 Lists.indexOf(this, element, start, this.length);
17403 18306
17404 int lastIndexOf(TextTrackCue element, [int start]) { 18307 int lastIndexOf(TextTrackCue element, [int start]) {
17405 if (start == null) start = length - 1; 18308 if (start == null) start = length - 1;
17406 return Lists.lastIndexOf(this, element, start); 18309 return Lists.lastIndexOf(this, element, start);
17407 } 18310 }
17408 18311
17409 TextTrackCue get first => this[0]; 18312 TextTrackCue get first {
18313 if (this.length > 0) return this[0];
18314 throw new StateError("No elements");
18315 }
17410 18316
17411 TextTrackCue get last => this[length - 1]; 18317 TextTrackCue get last {
18318 if (this.length > 0) return this[this.length - 1];
18319 throw new StateError("No elements");
18320 }
18321
18322 TextTrackCue get single {
18323 if (length == 1) return this[0];
18324 if (length == 0) throw new StateError("No elements");
18325 throw new StateError("More than one element");
18326 }
18327
18328 TextTrackCue min([int compare(TextTrackCue a, TextTrackCue b)]) => _Collection s.minInList(this, compare);
18329
18330 TextTrackCue max([int compare(TextTrackCue a, TextTrackCue b)]) => _Collection s.maxInList(this, compare);
17412 18331
17413 TextTrackCue removeAt(int pos) { 18332 TextTrackCue removeAt(int pos) {
17414 throw new UnsupportedError("Cannot removeAt on immutable List."); 18333 throw new UnsupportedError("Cannot removeAt on immutable List.");
17415 } 18334 }
17416 18335
17417 TextTrackCue removeLast() { 18336 TextTrackCue removeLast() {
17418 throw new UnsupportedError("Cannot removeLast on immutable List."); 18337 throw new UnsupportedError("Cannot removeLast on immutable List.");
17419 } 18338 }
17420 18339
17421 void setRange(int start, int rangeLength, List<TextTrackCue> from, [int startF rom]) { 18340 void setRange(int start, int rangeLength, List<TextTrackCue> from, [int startF rom]) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
17459 TextTrack operator[](int index) => JS("TextTrack", "#[#]", this, index); 18378 TextTrack operator[](int index) => JS("TextTrack", "#[#]", this, index);
17460 18379
17461 void operator[]=(int index, TextTrack value) { 18380 void operator[]=(int index, TextTrack value) {
17462 throw new UnsupportedError("Cannot assign element of immutable List."); 18381 throw new UnsupportedError("Cannot assign element of immutable List.");
17463 } 18382 }
17464 // -- start List<TextTrack> mixins. 18383 // -- start List<TextTrack> mixins.
17465 // TextTrack is the element type. 18384 // TextTrack is the element type.
17466 18385
17467 // From Iterable<TextTrack>: 18386 // From Iterable<TextTrack>:
17468 18387
17469 Iterator<TextTrack> iterator() { 18388 Iterator<TextTrack> get iterator {
17470 // Note: NodeLists are not fixed size. And most probably length shouldn't 18389 // Note: NodeLists are not fixed size. And most probably length shouldn't
17471 // be cached in both iterator _and_ forEach method. For now caching it 18390 // be cached in both iterator _and_ forEach method. For now caching it
17472 // for consistency. 18391 // for consistency.
17473 return new FixedSizeListIterator<TextTrack>(this); 18392 return new FixedSizeListIterator<TextTrack>(this);
17474 } 18393 }
17475 18394
17476 // From Collection<TextTrack>:
17477
17478 void add(TextTrack value) {
17479 throw new UnsupportedError("Cannot add to immutable List.");
17480 }
17481
17482 void addLast(TextTrack value) {
17483 throw new UnsupportedError("Cannot add to immutable List.");
17484 }
17485
17486 void addAll(Collection<TextTrack> collection) {
17487 throw new UnsupportedError("Cannot add to immutable List.");
17488 }
17489
17490 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrack)) { 18395 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrack)) {
17491 return Collections.reduce(this, initialValue, combine); 18396 return Collections.reduce(this, initialValue, combine);
17492 } 18397 }
17493 18398
17494 bool contains(TextTrack element) => Collections.contains(this, element); 18399 bool contains(TextTrack element) => Collections.contains(this, element);
17495 18400
17496 void forEach(void f(TextTrack element)) => Collections.forEach(this, f); 18401 void forEach(void f(TextTrack element)) => Collections.forEach(this, f);
17497 18402
17498 Collection map(f(TextTrack element)) => Collections.map(this, [], f); 18403 String join([String separator]) => Collections.joinList(this, separator);
17499 18404
17500 Collection<TextTrack> filter(bool f(TextTrack element)) => 18405 List mappedBy(f(TextTrack element)) => new MappedList<TextTrack, dynamic>(this , f);
17501 Collections.filter(this, <TextTrack>[], f); 18406
18407 Iterable<TextTrack> where(bool f(TextTrack element)) => new WhereIterable<Text Track>(this, f);
17502 18408
17503 bool every(bool f(TextTrack element)) => Collections.every(this, f); 18409 bool every(bool f(TextTrack element)) => Collections.every(this, f);
17504 18410
17505 bool some(bool f(TextTrack element)) => Collections.some(this, f); 18411 bool any(bool f(TextTrack element)) => Collections.any(this, f);
17506 18412
17507 bool get isEmpty => this.length == 0; 18413 bool get isEmpty => this.length == 0;
17508 18414
18415 List<TextTrack> take(int n) => new ListView<TextTrack>(this, 0, n);
18416
18417 Iterable<TextTrack> takeWhile(bool test(TextTrack value)) {
18418 return new TakeWhileIterable<TextTrack>(this, test);
18419 }
18420
18421 List<TextTrack> skip(int n) => new ListView<TextTrack>(this, n, null);
18422
18423 Iterable<TextTrack> skipWhile(bool test(TextTrack value)) {
18424 return new SkipWhileIterable<TextTrack>(this, test);
18425 }
18426
18427 TextTrack firstMatching(bool test(TextTrack value), { TextTrack orElse() }) {
18428 return Collections.firstMatching(this, test, orElse);
18429 }
18430
18431 TextTrack lastMatching(bool test(TextTrack value), {TextTrack orElse()}) {
18432 return Collections.lastMatchingInList(this, test, orElse);
18433 }
18434
18435 TextTrack singleMatching(bool test(TextTrack value)) {
18436 return Collections.singleMatching(this, test);
18437 }
18438
18439 TextTrack elementAt(int index) {
18440 return this[index];
18441 }
18442
18443 // From Collection<TextTrack>:
18444
18445 void add(TextTrack value) {
18446 throw new UnsupportedError("Cannot add to immutable List.");
18447 }
18448
18449 void addLast(TextTrack value) {
18450 throw new UnsupportedError("Cannot add to immutable List.");
18451 }
18452
18453 void addAll(Iterable<TextTrack> iterable) {
18454 throw new UnsupportedError("Cannot add to immutable List.");
18455 }
18456
17509 // From List<TextTrack>: 18457 // From List<TextTrack>:
17510 void set length(int value) { 18458 void set length(int value) {
17511 throw new UnsupportedError("Cannot resize immutable List."); 18459 throw new UnsupportedError("Cannot resize immutable List.");
17512 } 18460 }
17513 18461
17514 void clear() { 18462 void clear() {
17515 throw new UnsupportedError("Cannot clear immutable List."); 18463 throw new UnsupportedError("Cannot clear immutable List.");
17516 } 18464 }
17517 18465
17518 void sort([int compare(TextTrack a, TextTrack b)]) { 18466 void sort([int compare(TextTrack a, TextTrack b)]) {
17519 throw new UnsupportedError("Cannot sort immutable List."); 18467 throw new UnsupportedError("Cannot sort immutable List.");
17520 } 18468 }
17521 18469
17522 int indexOf(TextTrack element, [int start = 0]) => 18470 int indexOf(TextTrack element, [int start = 0]) =>
17523 Lists.indexOf(this, element, start, this.length); 18471 Lists.indexOf(this, element, start, this.length);
17524 18472
17525 int lastIndexOf(TextTrack element, [int start]) { 18473 int lastIndexOf(TextTrack element, [int start]) {
17526 if (start == null) start = length - 1; 18474 if (start == null) start = length - 1;
17527 return Lists.lastIndexOf(this, element, start); 18475 return Lists.lastIndexOf(this, element, start);
17528 } 18476 }
17529 18477
17530 TextTrack get first => this[0]; 18478 TextTrack get first {
18479 if (this.length > 0) return this[0];
18480 throw new StateError("No elements");
18481 }
17531 18482
17532 TextTrack get last => this[length - 1]; 18483 TextTrack get last {
18484 if (this.length > 0) return this[this.length - 1];
18485 throw new StateError("No elements");
18486 }
18487
18488 TextTrack get single {
18489 if (length == 1) return this[0];
18490 if (length == 0) throw new StateError("No elements");
18491 throw new StateError("More than one element");
18492 }
18493
18494 TextTrack min([int compare(TextTrack a, TextTrack b)]) => _Collections.minInLi st(this, compare);
18495
18496 TextTrack max([int compare(TextTrack a, TextTrack b)]) => _Collections.maxInLi st(this, compare);
17533 18497
17534 TextTrack removeAt(int pos) { 18498 TextTrack removeAt(int pos) {
17535 throw new UnsupportedError("Cannot removeAt on immutable List."); 18499 throw new UnsupportedError("Cannot removeAt on immutable List.");
17536 } 18500 }
17537 18501
17538 TextTrack removeLast() { 18502 TextTrack removeLast() {
17539 throw new UnsupportedError("Cannot removeLast on immutable List."); 18503 throw new UnsupportedError("Cannot removeLast on immutable List.");
17540 } 18504 }
17541 18505
17542 void setRange(int start, int rangeLength, List<TextTrack> from, [int startFrom ]) { 18506 void setRange(int start, int rangeLength, List<TextTrack> from, [int startFrom ]) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
17709 Touch operator[](int index) => JS("Touch", "#[#]", this, index); 18673 Touch operator[](int index) => JS("Touch", "#[#]", this, index);
17710 18674
17711 void operator[]=(int index, Touch value) { 18675 void operator[]=(int index, Touch value) {
17712 throw new UnsupportedError("Cannot assign element of immutable List."); 18676 throw new UnsupportedError("Cannot assign element of immutable List.");
17713 } 18677 }
17714 // -- start List<Touch> mixins. 18678 // -- start List<Touch> mixins.
17715 // Touch is the element type. 18679 // Touch is the element type.
17716 18680
17717 // From Iterable<Touch>: 18681 // From Iterable<Touch>:
17718 18682
17719 Iterator<Touch> iterator() { 18683 Iterator<Touch> get iterator {
17720 // Note: NodeLists are not fixed size. And most probably length shouldn't 18684 // Note: NodeLists are not fixed size. And most probably length shouldn't
17721 // be cached in both iterator _and_ forEach method. For now caching it 18685 // be cached in both iterator _and_ forEach method. For now caching it
17722 // for consistency. 18686 // for consistency.
17723 return new FixedSizeListIterator<Touch>(this); 18687 return new FixedSizeListIterator<Touch>(this);
17724 } 18688 }
17725 18689
17726 // From Collection<Touch>:
17727
17728 void add(Touch value) {
17729 throw new UnsupportedError("Cannot add to immutable List.");
17730 }
17731
17732 void addLast(Touch value) {
17733 throw new UnsupportedError("Cannot add to immutable List.");
17734 }
17735
17736 void addAll(Collection<Touch> collection) {
17737 throw new UnsupportedError("Cannot add to immutable List.");
17738 }
17739
17740 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Touch)) { 18690 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Touch)) {
17741 return Collections.reduce(this, initialValue, combine); 18691 return Collections.reduce(this, initialValue, combine);
17742 } 18692 }
17743 18693
17744 bool contains(Touch element) => Collections.contains(this, element); 18694 bool contains(Touch element) => Collections.contains(this, element);
17745 18695
17746 void forEach(void f(Touch element)) => Collections.forEach(this, f); 18696 void forEach(void f(Touch element)) => Collections.forEach(this, f);
17747 18697
17748 Collection map(f(Touch element)) => Collections.map(this, [], f); 18698 String join([String separator]) => Collections.joinList(this, separator);
17749 18699
17750 Collection<Touch> filter(bool f(Touch element)) => 18700 List mappedBy(f(Touch element)) => new MappedList<Touch, dynamic>(this, f);
17751 Collections.filter(this, <Touch>[], f); 18701
18702 Iterable<Touch> where(bool f(Touch element)) => new WhereIterable<Touch>(this, f);
17752 18703
17753 bool every(bool f(Touch element)) => Collections.every(this, f); 18704 bool every(bool f(Touch element)) => Collections.every(this, f);
17754 18705
17755 bool some(bool f(Touch element)) => Collections.some(this, f); 18706 bool any(bool f(Touch element)) => Collections.any(this, f);
17756 18707
17757 bool get isEmpty => this.length == 0; 18708 bool get isEmpty => this.length == 0;
17758 18709
18710 List<Touch> take(int n) => new ListView<Touch>(this, 0, n);
18711
18712 Iterable<Touch> takeWhile(bool test(Touch value)) {
18713 return new TakeWhileIterable<Touch>(this, test);
18714 }
18715
18716 List<Touch> skip(int n) => new ListView<Touch>(this, n, null);
18717
18718 Iterable<Touch> skipWhile(bool test(Touch value)) {
18719 return new SkipWhileIterable<Touch>(this, test);
18720 }
18721
18722 Touch firstMatching(bool test(Touch value), { Touch orElse() }) {
18723 return Collections.firstMatching(this, test, orElse);
18724 }
18725
18726 Touch lastMatching(bool test(Touch value), {Touch orElse()}) {
18727 return Collections.lastMatchingInList(this, test, orElse);
18728 }
18729
18730 Touch singleMatching(bool test(Touch value)) {
18731 return Collections.singleMatching(this, test);
18732 }
18733
18734 Touch elementAt(int index) {
18735 return this[index];
18736 }
18737
18738 // From Collection<Touch>:
18739
18740 void add(Touch value) {
18741 throw new UnsupportedError("Cannot add to immutable List.");
18742 }
18743
18744 void addLast(Touch value) {
18745 throw new UnsupportedError("Cannot add to immutable List.");
18746 }
18747
18748 void addAll(Iterable<Touch> iterable) {
18749 throw new UnsupportedError("Cannot add to immutable List.");
18750 }
18751
17759 // From List<Touch>: 18752 // From List<Touch>:
17760 void set length(int value) { 18753 void set length(int value) {
17761 throw new UnsupportedError("Cannot resize immutable List."); 18754 throw new UnsupportedError("Cannot resize immutable List.");
17762 } 18755 }
17763 18756
17764 void clear() { 18757 void clear() {
17765 throw new UnsupportedError("Cannot clear immutable List."); 18758 throw new UnsupportedError("Cannot clear immutable List.");
17766 } 18759 }
17767 18760
17768 void sort([int compare(Touch a, Touch b)]) { 18761 void sort([int compare(Touch a, Touch b)]) {
17769 throw new UnsupportedError("Cannot sort immutable List."); 18762 throw new UnsupportedError("Cannot sort immutable List.");
17770 } 18763 }
17771 18764
17772 int indexOf(Touch element, [int start = 0]) => 18765 int indexOf(Touch element, [int start = 0]) =>
17773 Lists.indexOf(this, element, start, this.length); 18766 Lists.indexOf(this, element, start, this.length);
17774 18767
17775 int lastIndexOf(Touch element, [int start]) { 18768 int lastIndexOf(Touch element, [int start]) {
17776 if (start == null) start = length - 1; 18769 if (start == null) start = length - 1;
17777 return Lists.lastIndexOf(this, element, start); 18770 return Lists.lastIndexOf(this, element, start);
17778 } 18771 }
17779 18772
17780 Touch get first => this[0]; 18773 Touch get first {
18774 if (this.length > 0) return this[0];
18775 throw new StateError("No elements");
18776 }
17781 18777
17782 Touch get last => this[length - 1]; 18778 Touch get last {
18779 if (this.length > 0) return this[this.length - 1];
18780 throw new StateError("No elements");
18781 }
18782
18783 Touch get single {
18784 if (length == 1) return this[0];
18785 if (length == 0) throw new StateError("No elements");
18786 throw new StateError("More than one element");
18787 }
18788
18789 Touch min([int compare(Touch a, Touch b)]) => _Collections.minInList(this, com pare);
18790
18791 Touch max([int compare(Touch a, Touch b)]) => _Collections.maxInList(this, com pare);
17783 18792
17784 Touch removeAt(int pos) { 18793 Touch removeAt(int pos) {
17785 throw new UnsupportedError("Cannot removeAt on immutable List."); 18794 throw new UnsupportedError("Cannot removeAt on immutable List.");
17786 } 18795 }
17787 18796
17788 Touch removeLast() { 18797 Touch removeLast() {
17789 throw new UnsupportedError("Cannot removeLast on immutable List."); 18798 throw new UnsupportedError("Cannot removeLast on immutable List.");
17790 } 18799 }
17791 18800
17792 void setRange(int start, int rangeLength, List<Touch> from, [int startFrom]) { 18801 void setRange(int start, int rangeLength, List<Touch> from, [int startFrom]) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
18019 /// @domName Uint16Array.length; @docsEditable true 19028 /// @domName Uint16Array.length; @docsEditable true
18020 int get length => JS("int", "#.length", this); 19029 int get length => JS("int", "#.length", this);
18021 19030
18022 int operator[](int index) => JS("int", "#[#]", this, index); 19031 int operator[](int index) => JS("int", "#[#]", this, index);
18023 19032
18024 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 19033 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
18025 // int is the element type. 19034 // int is the element type.
18026 19035
18027 // From Iterable<int>: 19036 // From Iterable<int>:
18028 19037
18029 Iterator<int> iterator() { 19038 Iterator<int> get iterator {
18030 // Note: NodeLists are not fixed size. And most probably length shouldn't 19039 // Note: NodeLists are not fixed size. And most probably length shouldn't
18031 // be cached in both iterator _and_ forEach method. For now caching it 19040 // be cached in both iterator _and_ forEach method. For now caching it
18032 // for consistency. 19041 // for consistency.
18033 return new FixedSizeListIterator<int>(this); 19042 return new FixedSizeListIterator<int>(this);
18034 } 19043 }
18035 19044
18036 // From Collection<int>:
18037
18038 void add(int value) {
18039 throw new UnsupportedError("Cannot add to immutable List.");
18040 }
18041
18042 void addLast(int value) {
18043 throw new UnsupportedError("Cannot add to immutable List.");
18044 }
18045
18046 void addAll(Collection<int> collection) {
18047 throw new UnsupportedError("Cannot add to immutable List.");
18048 }
18049
18050 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 19045 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
18051 return Collections.reduce(this, initialValue, combine); 19046 return Collections.reduce(this, initialValue, combine);
18052 } 19047 }
18053 19048
18054 bool contains(int element) => Collections.contains(this, element); 19049 bool contains(int element) => Collections.contains(this, element);
18055 19050
18056 void forEach(void f(int element)) => Collections.forEach(this, f); 19051 void forEach(void f(int element)) => Collections.forEach(this, f);
18057 19052
18058 Collection map(f(int element)) => Collections.map(this, [], f); 19053 String join([String separator]) => Collections.joinList(this, separator);
18059 19054
18060 Collection<int> filter(bool f(int element)) => 19055 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
18061 Collections.filter(this, <int>[], f); 19056
19057 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
18062 19058
18063 bool every(bool f(int element)) => Collections.every(this, f); 19059 bool every(bool f(int element)) => Collections.every(this, f);
18064 19060
18065 bool some(bool f(int element)) => Collections.some(this, f); 19061 bool any(bool f(int element)) => Collections.any(this, f);
18066 19062
18067 bool get isEmpty => this.length == 0; 19063 bool get isEmpty => this.length == 0;
18068 19064
19065 List<int> take(int n) => new ListView<int>(this, 0, n);
19066
19067 Iterable<int> takeWhile(bool test(int value)) {
19068 return new TakeWhileIterable<int>(this, test);
19069 }
19070
19071 List<int> skip(int n) => new ListView<int>(this, n, null);
19072
19073 Iterable<int> skipWhile(bool test(int value)) {
19074 return new SkipWhileIterable<int>(this, test);
19075 }
19076
19077 int firstMatching(bool test(int value), { int orElse() }) {
19078 return Collections.firstMatching(this, test, orElse);
19079 }
19080
19081 int lastMatching(bool test(int value), {int orElse()}) {
19082 return Collections.lastMatchingInList(this, test, orElse);
19083 }
19084
19085 int singleMatching(bool test(int value)) {
19086 return Collections.singleMatching(this, test);
19087 }
19088
19089 int elementAt(int index) {
19090 return this[index];
19091 }
19092
19093 // From Collection<int>:
19094
19095 void add(int value) {
19096 throw new UnsupportedError("Cannot add to immutable List.");
19097 }
19098
19099 void addLast(int value) {
19100 throw new UnsupportedError("Cannot add to immutable List.");
19101 }
19102
19103 void addAll(Iterable<int> iterable) {
19104 throw new UnsupportedError("Cannot add to immutable List.");
19105 }
19106
18069 // From List<int>: 19107 // From List<int>:
18070 void set length(int value) { 19108 void set length(int value) {
18071 throw new UnsupportedError("Cannot resize immutable List."); 19109 throw new UnsupportedError("Cannot resize immutable List.");
18072 } 19110 }
18073 19111
18074 void clear() { 19112 void clear() {
18075 throw new UnsupportedError("Cannot clear immutable List."); 19113 throw new UnsupportedError("Cannot clear immutable List.");
18076 } 19114 }
18077 19115
18078 void sort([int compare(int a, int b)]) { 19116 void sort([int compare(int a, int b)]) {
18079 throw new UnsupportedError("Cannot sort immutable List."); 19117 throw new UnsupportedError("Cannot sort immutable List.");
18080 } 19118 }
18081 19119
18082 int indexOf(int element, [int start = 0]) => 19120 int indexOf(int element, [int start = 0]) =>
18083 Lists.indexOf(this, element, start, this.length); 19121 Lists.indexOf(this, element, start, this.length);
18084 19122
18085 int lastIndexOf(int element, [int start]) { 19123 int lastIndexOf(int element, [int start]) {
18086 if (start == null) start = length - 1; 19124 if (start == null) start = length - 1;
18087 return Lists.lastIndexOf(this, element, start); 19125 return Lists.lastIndexOf(this, element, start);
18088 } 19126 }
18089 19127
18090 int get first => this[0]; 19128 int get first {
19129 if (this.length > 0) return this[0];
19130 throw new StateError("No elements");
19131 }
18091 19132
18092 int get last => this[length - 1]; 19133 int get last {
19134 if (this.length > 0) return this[this.length - 1];
19135 throw new StateError("No elements");
19136 }
19137
19138 int get single {
19139 if (length == 1) return this[0];
19140 if (length == 0) throw new StateError("No elements");
19141 throw new StateError("More than one element");
19142 }
19143
19144 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
19145
19146 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
18093 19147
18094 int removeAt(int pos) { 19148 int removeAt(int pos) {
18095 throw new UnsupportedError("Cannot removeAt on immutable List."); 19149 throw new UnsupportedError("Cannot removeAt on immutable List.");
18096 } 19150 }
18097 19151
18098 int removeLast() { 19152 int removeLast() {
18099 throw new UnsupportedError("Cannot removeLast on immutable List."); 19153 throw new UnsupportedError("Cannot removeLast on immutable List.");
18100 } 19154 }
18101 19155
18102 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 19156 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
18145 /// @domName Uint32Array.length; @docsEditable true 19199 /// @domName Uint32Array.length; @docsEditable true
18146 int get length => JS("int", "#.length", this); 19200 int get length => JS("int", "#.length", this);
18147 19201
18148 int operator[](int index) => JS("int", "#[#]", this, index); 19202 int operator[](int index) => JS("int", "#[#]", this, index);
18149 19203
18150 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 19204 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
18151 // int is the element type. 19205 // int is the element type.
18152 19206
18153 // From Iterable<int>: 19207 // From Iterable<int>:
18154 19208
18155 Iterator<int> iterator() { 19209 Iterator<int> get iterator {
18156 // Note: NodeLists are not fixed size. And most probably length shouldn't 19210 // Note: NodeLists are not fixed size. And most probably length shouldn't
18157 // be cached in both iterator _and_ forEach method. For now caching it 19211 // be cached in both iterator _and_ forEach method. For now caching it
18158 // for consistency. 19212 // for consistency.
18159 return new FixedSizeListIterator<int>(this); 19213 return new FixedSizeListIterator<int>(this);
18160 } 19214 }
18161 19215
18162 // From Collection<int>:
18163
18164 void add(int value) {
18165 throw new UnsupportedError("Cannot add to immutable List.");
18166 }
18167
18168 void addLast(int value) {
18169 throw new UnsupportedError("Cannot add to immutable List.");
18170 }
18171
18172 void addAll(Collection<int> collection) {
18173 throw new UnsupportedError("Cannot add to immutable List.");
18174 }
18175
18176 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 19216 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
18177 return Collections.reduce(this, initialValue, combine); 19217 return Collections.reduce(this, initialValue, combine);
18178 } 19218 }
18179 19219
18180 bool contains(int element) => Collections.contains(this, element); 19220 bool contains(int element) => Collections.contains(this, element);
18181 19221
18182 void forEach(void f(int element)) => Collections.forEach(this, f); 19222 void forEach(void f(int element)) => Collections.forEach(this, f);
18183 19223
18184 Collection map(f(int element)) => Collections.map(this, [], f); 19224 String join([String separator]) => Collections.joinList(this, separator);
18185 19225
18186 Collection<int> filter(bool f(int element)) => 19226 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
18187 Collections.filter(this, <int>[], f); 19227
19228 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
18188 19229
18189 bool every(bool f(int element)) => Collections.every(this, f); 19230 bool every(bool f(int element)) => Collections.every(this, f);
18190 19231
18191 bool some(bool f(int element)) => Collections.some(this, f); 19232 bool any(bool f(int element)) => Collections.any(this, f);
18192 19233
18193 bool get isEmpty => this.length == 0; 19234 bool get isEmpty => this.length == 0;
18194 19235
19236 List<int> take(int n) => new ListView<int>(this, 0, n);
19237
19238 Iterable<int> takeWhile(bool test(int value)) {
19239 return new TakeWhileIterable<int>(this, test);
19240 }
19241
19242 List<int> skip(int n) => new ListView<int>(this, n, null);
19243
19244 Iterable<int> skipWhile(bool test(int value)) {
19245 return new SkipWhileIterable<int>(this, test);
19246 }
19247
19248 int firstMatching(bool test(int value), { int orElse() }) {
19249 return Collections.firstMatching(this, test, orElse);
19250 }
19251
19252 int lastMatching(bool test(int value), {int orElse()}) {
19253 return Collections.lastMatchingInList(this, test, orElse);
19254 }
19255
19256 int singleMatching(bool test(int value)) {
19257 return Collections.singleMatching(this, test);
19258 }
19259
19260 int elementAt(int index) {
19261 return this[index];
19262 }
19263
19264 // From Collection<int>:
19265
19266 void add(int value) {
19267 throw new UnsupportedError("Cannot add to immutable List.");
19268 }
19269
19270 void addLast(int value) {
19271 throw new UnsupportedError("Cannot add to immutable List.");
19272 }
19273
19274 void addAll(Iterable<int> iterable) {
19275 throw new UnsupportedError("Cannot add to immutable List.");
19276 }
19277
18195 // From List<int>: 19278 // From List<int>:
18196 void set length(int value) { 19279 void set length(int value) {
18197 throw new UnsupportedError("Cannot resize immutable List."); 19280 throw new UnsupportedError("Cannot resize immutable List.");
18198 } 19281 }
18199 19282
18200 void clear() { 19283 void clear() {
18201 throw new UnsupportedError("Cannot clear immutable List."); 19284 throw new UnsupportedError("Cannot clear immutable List.");
18202 } 19285 }
18203 19286
18204 void sort([int compare(int a, int b)]) { 19287 void sort([int compare(int a, int b)]) {
18205 throw new UnsupportedError("Cannot sort immutable List."); 19288 throw new UnsupportedError("Cannot sort immutable List.");
18206 } 19289 }
18207 19290
18208 int indexOf(int element, [int start = 0]) => 19291 int indexOf(int element, [int start = 0]) =>
18209 Lists.indexOf(this, element, start, this.length); 19292 Lists.indexOf(this, element, start, this.length);
18210 19293
18211 int lastIndexOf(int element, [int start]) { 19294 int lastIndexOf(int element, [int start]) {
18212 if (start == null) start = length - 1; 19295 if (start == null) start = length - 1;
18213 return Lists.lastIndexOf(this, element, start); 19296 return Lists.lastIndexOf(this, element, start);
18214 } 19297 }
18215 19298
18216 int get first => this[0]; 19299 int get first {
19300 if (this.length > 0) return this[0];
19301 throw new StateError("No elements");
19302 }
18217 19303
18218 int get last => this[length - 1]; 19304 int get last {
19305 if (this.length > 0) return this[this.length - 1];
19306 throw new StateError("No elements");
19307 }
19308
19309 int get single {
19310 if (length == 1) return this[0];
19311 if (length == 0) throw new StateError("No elements");
19312 throw new StateError("More than one element");
19313 }
19314
19315 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
19316
19317 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
18219 19318
18220 int removeAt(int pos) { 19319 int removeAt(int pos) {
18221 throw new UnsupportedError("Cannot removeAt on immutable List."); 19320 throw new UnsupportedError("Cannot removeAt on immutable List.");
18222 } 19321 }
18223 19322
18224 int removeLast() { 19323 int removeLast() {
18225 throw new UnsupportedError("Cannot removeLast on immutable List."); 19324 throw new UnsupportedError("Cannot removeLast on immutable List.");
18226 } 19325 }
18227 19326
18228 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 19327 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
18271 /// @domName Uint8Array.length; @docsEditable true 19370 /// @domName Uint8Array.length; @docsEditable true
18272 int get length => JS("int", "#.length", this); 19371 int get length => JS("int", "#.length", this);
18273 19372
18274 int operator[](int index) => JS("int", "#[#]", this, index); 19373 int operator[](int index) => JS("int", "#[#]", this, index);
18275 19374
18276 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins. 19375 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); } // -- start List<int> mixins.
18277 // int is the element type. 19376 // int is the element type.
18278 19377
18279 // From Iterable<int>: 19378 // From Iterable<int>:
18280 19379
18281 Iterator<int> iterator() { 19380 Iterator<int> get iterator {
18282 // Note: NodeLists are not fixed size. And most probably length shouldn't 19381 // Note: NodeLists are not fixed size. And most probably length shouldn't
18283 // be cached in both iterator _and_ forEach method. For now caching it 19382 // be cached in both iterator _and_ forEach method. For now caching it
18284 // for consistency. 19383 // for consistency.
18285 return new FixedSizeListIterator<int>(this); 19384 return new FixedSizeListIterator<int>(this);
18286 } 19385 }
18287 19386
19387 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
19388 return Collections.reduce(this, initialValue, combine);
19389 }
19390
19391 bool contains(int element) => Collections.contains(this, element);
19392
19393 void forEach(void f(int element)) => Collections.forEach(this, f);
19394
19395 String join([String separator]) => Collections.joinList(this, separator);
19396
19397 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
19398
19399 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
19400
19401 bool every(bool f(int element)) => Collections.every(this, f);
19402
19403 bool any(bool f(int element)) => Collections.any(this, f);
19404
19405 bool get isEmpty => this.length == 0;
19406
19407 List<int> take(int n) => new ListView<int>(this, 0, n);
19408
19409 Iterable<int> takeWhile(bool test(int value)) {
19410 return new TakeWhileIterable<int>(this, test);
19411 }
19412
19413 List<int> skip(int n) => new ListView<int>(this, n, null);
19414
19415 Iterable<int> skipWhile(bool test(int value)) {
19416 return new SkipWhileIterable<int>(this, test);
19417 }
19418
19419 int firstMatching(bool test(int value), { int orElse() }) {
19420 return Collections.firstMatching(this, test, orElse);
19421 }
19422
19423 int lastMatching(bool test(int value), {int orElse()}) {
19424 return Collections.lastMatchingInList(this, test, orElse);
19425 }
19426
19427 int singleMatching(bool test(int value)) {
19428 return Collections.singleMatching(this, test);
19429 }
19430
19431 int elementAt(int index) {
19432 return this[index];
19433 }
19434
18288 // From Collection<int>: 19435 // From Collection<int>:
18289 19436
18290 void add(int value) { 19437 void add(int value) {
18291 throw new UnsupportedError("Cannot add to immutable List."); 19438 throw new UnsupportedError("Cannot add to immutable List.");
18292 } 19439 }
18293 19440
18294 void addLast(int value) { 19441 void addLast(int value) {
18295 throw new UnsupportedError("Cannot add to immutable List."); 19442 throw new UnsupportedError("Cannot add to immutable List.");
18296 } 19443 }
18297 19444
18298 void addAll(Collection<int> collection) { 19445 void addAll(Iterable<int> iterable) {
18299 throw new UnsupportedError("Cannot add to immutable List."); 19446 throw new UnsupportedError("Cannot add to immutable List.");
18300 } 19447 }
18301 19448
18302 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
18303 return Collections.reduce(this, initialValue, combine);
18304 }
18305
18306 bool contains(int element) => Collections.contains(this, element);
18307
18308 void forEach(void f(int element)) => Collections.forEach(this, f);
18309
18310 Collection map(f(int element)) => Collections.map(this, [], f);
18311
18312 Collection<int> filter(bool f(int element)) =>
18313 Collections.filter(this, <int>[], f);
18314
18315 bool every(bool f(int element)) => Collections.every(this, f);
18316
18317 bool some(bool f(int element)) => Collections.some(this, f);
18318
18319 bool get isEmpty => this.length == 0;
18320
18321 // From List<int>: 19449 // From List<int>:
18322 void set length(int value) { 19450 void set length(int value) {
18323 throw new UnsupportedError("Cannot resize immutable List."); 19451 throw new UnsupportedError("Cannot resize immutable List.");
18324 } 19452 }
18325 19453
18326 void clear() { 19454 void clear() {
18327 throw new UnsupportedError("Cannot clear immutable List."); 19455 throw new UnsupportedError("Cannot clear immutable List.");
18328 } 19456 }
18329 19457
18330 void sort([int compare(int a, int b)]) { 19458 void sort([int compare(int a, int b)]) {
18331 throw new UnsupportedError("Cannot sort immutable List."); 19459 throw new UnsupportedError("Cannot sort immutable List.");
18332 } 19460 }
18333 19461
18334 int indexOf(int element, [int start = 0]) => 19462 int indexOf(int element, [int start = 0]) =>
18335 Lists.indexOf(this, element, start, this.length); 19463 Lists.indexOf(this, element, start, this.length);
18336 19464
18337 int lastIndexOf(int element, [int start]) { 19465 int lastIndexOf(int element, [int start]) {
18338 if (start == null) start = length - 1; 19466 if (start == null) start = length - 1;
18339 return Lists.lastIndexOf(this, element, start); 19467 return Lists.lastIndexOf(this, element, start);
18340 } 19468 }
18341 19469
18342 int get first => this[0]; 19470 int get first {
19471 if (this.length > 0) return this[0];
19472 throw new StateError("No elements");
19473 }
18343 19474
18344 int get last => this[length - 1]; 19475 int get last {
19476 if (this.length > 0) return this[this.length - 1];
19477 throw new StateError("No elements");
19478 }
19479
19480 int get single {
19481 if (length == 1) return this[0];
19482 if (length == 0) throw new StateError("No elements");
19483 throw new StateError("More than one element");
19484 }
19485
19486 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
19487
19488 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
18345 19489
18346 int removeAt(int pos) { 19490 int removeAt(int pos) {
18347 throw new UnsupportedError("Cannot removeAt on immutable List."); 19491 throw new UnsupportedError("Cannot removeAt on immutable List.");
18348 } 19492 }
18349 19493
18350 int removeLast() { 19494 int removeLast() {
18351 throw new UnsupportedError("Cannot removeLast on immutable List."); 19495 throw new UnsupportedError("Cannot removeLast on immutable List.");
18352 } 19496 }
18353 19497
18354 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 19498 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
20214 IdbFactory get indexedDB => 21358 IdbFactory get indexedDB =>
20215 JS('IdbFactory', 21359 JS('IdbFactory',
20216 '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB', 21360 '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
20217 this, this, this); 21361 this, this, this);
20218 21362
20219 /** 21363 /**
20220 * Lookup a port by its [name]. Return null if no port is 21364 * Lookup a port by its [name]. Return null if no port is
20221 * registered under [name]. 21365 * registered under [name].
20222 */ 21366 */
20223 SendPortSync lookupPort(String name) { 21367 SendPortSync lookupPort(String name) {
20224 var port = JSON.parse(document.documentElement.attributes['dart-port:$name'] ); 21368 var port = json.parse(document.documentElement.attributes['dart-port:$name'] );
20225 return _deserialize(port); 21369 return _deserialize(port);
20226 } 21370 }
20227 21371
20228 /** 21372 /**
20229 * Register a [port] on this window under the given [name]. This 21373 * Register a [port] on this window under the given [name]. This
20230 * port may be retrieved by any isolate (or JavaScript script) 21374 * port may be retrieved by any isolate (or JavaScript script)
20231 * running in this window. 21375 * running in this window.
20232 */ 21376 */
20233 void registerPort(String name, var port) { 21377 void registerPort(String name, var port) {
20234 var serialized = _serialize(port); 21378 var serialized = _serialize(port);
20235 document.documentElement.attributes['dart-port:$name'] = JSON.stringify(seri alized); 21379 document.documentElement.attributes['dart-port:$name'] = json.stringify(seri alized);
20236 } 21380 }
20237 21381
20238 /// @domName Window.console; @docsEditable true 21382 /// @domName Window.console; @docsEditable true
20239 Console get console => Console.safeConsole; 21383 Console get console => Console.safeConsole;
20240 21384
20241 21385
20242 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true 21386 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
20243 WindowEvents get on => 21387 WindowEvents get on =>
20244 new WindowEvents(this); 21388 new WindowEvents(this);
20245 21389
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
21143 ClientRect operator[](int index) => JS("ClientRect", "#[#]", this, index); 22287 ClientRect operator[](int index) => JS("ClientRect", "#[#]", this, index);
21144 22288
21145 void operator[]=(int index, ClientRect value) { 22289 void operator[]=(int index, ClientRect value) {
21146 throw new UnsupportedError("Cannot assign element of immutable List."); 22290 throw new UnsupportedError("Cannot assign element of immutable List.");
21147 } 22291 }
21148 // -- start List<ClientRect> mixins. 22292 // -- start List<ClientRect> mixins.
21149 // ClientRect is the element type. 22293 // ClientRect is the element type.
21150 22294
21151 // From Iterable<ClientRect>: 22295 // From Iterable<ClientRect>:
21152 22296
21153 Iterator<ClientRect> iterator() { 22297 Iterator<ClientRect> get iterator {
21154 // Note: NodeLists are not fixed size. And most probably length shouldn't 22298 // Note: NodeLists are not fixed size. And most probably length shouldn't
21155 // be cached in both iterator _and_ forEach method. For now caching it 22299 // be cached in both iterator _and_ forEach method. For now caching it
21156 // for consistency. 22300 // for consistency.
21157 return new FixedSizeListIterator<ClientRect>(this); 22301 return new FixedSizeListIterator<ClientRect>(this);
21158 } 22302 }
21159 22303
21160 // From Collection<ClientRect>:
21161
21162 void add(ClientRect value) {
21163 throw new UnsupportedError("Cannot add to immutable List.");
21164 }
21165
21166 void addLast(ClientRect value) {
21167 throw new UnsupportedError("Cannot add to immutable List.");
21168 }
21169
21170 void addAll(Collection<ClientRect> collection) {
21171 throw new UnsupportedError("Cannot add to immutable List.");
21172 }
21173
21174 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ClientRect)) { 22304 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ClientRect)) {
21175 return Collections.reduce(this, initialValue, combine); 22305 return Collections.reduce(this, initialValue, combine);
21176 } 22306 }
21177 22307
21178 bool contains(ClientRect element) => Collections.contains(this, element); 22308 bool contains(ClientRect element) => Collections.contains(this, element);
21179 22309
21180 void forEach(void f(ClientRect element)) => Collections.forEach(this, f); 22310 void forEach(void f(ClientRect element)) => Collections.forEach(this, f);
21181 22311
21182 Collection map(f(ClientRect element)) => Collections.map(this, [], f); 22312 String join([String separator]) => Collections.joinList(this, separator);
21183 22313
21184 Collection<ClientRect> filter(bool f(ClientRect element)) => 22314 List mappedBy(f(ClientRect element)) => new MappedList<ClientRect, dynamic>(th is, f);
21185 Collections.filter(this, <ClientRect>[], f); 22315
22316 Iterable<ClientRect> where(bool f(ClientRect element)) => new WhereIterable<Cl ientRect>(this, f);
21186 22317
21187 bool every(bool f(ClientRect element)) => Collections.every(this, f); 22318 bool every(bool f(ClientRect element)) => Collections.every(this, f);
21188 22319
21189 bool some(bool f(ClientRect element)) => Collections.some(this, f); 22320 bool any(bool f(ClientRect element)) => Collections.any(this, f);
21190 22321
21191 bool get isEmpty => this.length == 0; 22322 bool get isEmpty => this.length == 0;
21192 22323
22324 List<ClientRect> take(int n) => new ListView<ClientRect>(this, 0, n);
22325
22326 Iterable<ClientRect> takeWhile(bool test(ClientRect value)) {
22327 return new TakeWhileIterable<ClientRect>(this, test);
22328 }
22329
22330 List<ClientRect> skip(int n) => new ListView<ClientRect>(this, n, null);
22331
22332 Iterable<ClientRect> skipWhile(bool test(ClientRect value)) {
22333 return new SkipWhileIterable<ClientRect>(this, test);
22334 }
22335
22336 ClientRect firstMatching(bool test(ClientRect value), { ClientRect orElse() }) {
22337 return Collections.firstMatching(this, test, orElse);
22338 }
22339
22340 ClientRect lastMatching(bool test(ClientRect value), {ClientRect orElse()}) {
22341 return Collections.lastMatchingInList(this, test, orElse);
22342 }
22343
22344 ClientRect singleMatching(bool test(ClientRect value)) {
22345 return Collections.singleMatching(this, test);
22346 }
22347
22348 ClientRect elementAt(int index) {
22349 return this[index];
22350 }
22351
22352 // From Collection<ClientRect>:
22353
22354 void add(ClientRect value) {
22355 throw new UnsupportedError("Cannot add to immutable List.");
22356 }
22357
22358 void addLast(ClientRect value) {
22359 throw new UnsupportedError("Cannot add to immutable List.");
22360 }
22361
22362 void addAll(Iterable<ClientRect> iterable) {
22363 throw new UnsupportedError("Cannot add to immutable List.");
22364 }
22365
21193 // From List<ClientRect>: 22366 // From List<ClientRect>:
21194 void set length(int value) { 22367 void set length(int value) {
21195 throw new UnsupportedError("Cannot resize immutable List."); 22368 throw new UnsupportedError("Cannot resize immutable List.");
21196 } 22369 }
21197 22370
21198 void clear() { 22371 void clear() {
21199 throw new UnsupportedError("Cannot clear immutable List."); 22372 throw new UnsupportedError("Cannot clear immutable List.");
21200 } 22373 }
21201 22374
21202 void sort([int compare(ClientRect a, ClientRect b)]) { 22375 void sort([int compare(ClientRect a, ClientRect b)]) {
21203 throw new UnsupportedError("Cannot sort immutable List."); 22376 throw new UnsupportedError("Cannot sort immutable List.");
21204 } 22377 }
21205 22378
21206 int indexOf(ClientRect element, [int start = 0]) => 22379 int indexOf(ClientRect element, [int start = 0]) =>
21207 Lists.indexOf(this, element, start, this.length); 22380 Lists.indexOf(this, element, start, this.length);
21208 22381
21209 int lastIndexOf(ClientRect element, [int start]) { 22382 int lastIndexOf(ClientRect element, [int start]) {
21210 if (start == null) start = length - 1; 22383 if (start == null) start = length - 1;
21211 return Lists.lastIndexOf(this, element, start); 22384 return Lists.lastIndexOf(this, element, start);
21212 } 22385 }
21213 22386
21214 ClientRect get first => this[0]; 22387 ClientRect get first {
22388 if (this.length > 0) return this[0];
22389 throw new StateError("No elements");
22390 }
21215 22391
21216 ClientRect get last => this[length - 1]; 22392 ClientRect get last {
22393 if (this.length > 0) return this[this.length - 1];
22394 throw new StateError("No elements");
22395 }
22396
22397 ClientRect get single {
22398 if (length == 1) return this[0];
22399 if (length == 0) throw new StateError("No elements");
22400 throw new StateError("More than one element");
22401 }
22402
22403 ClientRect min([int compare(ClientRect a, ClientRect b)]) => _Collections.minI nList(this, compare);
22404
22405 ClientRect max([int compare(ClientRect a, ClientRect b)]) => _Collections.maxI nList(this, compare);
21217 22406
21218 ClientRect removeAt(int pos) { 22407 ClientRect removeAt(int pos) {
21219 throw new UnsupportedError("Cannot removeAt on immutable List."); 22408 throw new UnsupportedError("Cannot removeAt on immutable List.");
21220 } 22409 }
21221 22410
21222 ClientRect removeLast() { 22411 ClientRect removeLast() {
21223 throw new UnsupportedError("Cannot removeLast on immutable List."); 22412 throw new UnsupportedError("Cannot removeLast on immutable List.");
21224 } 22413 }
21225 22414
21226 void setRange(int start, int rangeLength, List<ClientRect> from, [int startFro m]) { 22415 void setRange(int start, int rangeLength, List<ClientRect> from, [int startFro m]) {
(...skipping 30 matching lines...) Expand all
21257 CssRule operator[](int index) => JS("CssRule", "#[#]", this, index); 22446 CssRule operator[](int index) => JS("CssRule", "#[#]", this, index);
21258 22447
21259 void operator[]=(int index, CssRule value) { 22448 void operator[]=(int index, CssRule value) {
21260 throw new UnsupportedError("Cannot assign element of immutable List."); 22449 throw new UnsupportedError("Cannot assign element of immutable List.");
21261 } 22450 }
21262 // -- start List<CssRule> mixins. 22451 // -- start List<CssRule> mixins.
21263 // CssRule is the element type. 22452 // CssRule is the element type.
21264 22453
21265 // From Iterable<CssRule>: 22454 // From Iterable<CssRule>:
21266 22455
21267 Iterator<CssRule> iterator() { 22456 Iterator<CssRule> get iterator {
21268 // Note: NodeLists are not fixed size. And most probably length shouldn't 22457 // Note: NodeLists are not fixed size. And most probably length shouldn't
21269 // be cached in both iterator _and_ forEach method. For now caching it 22458 // be cached in both iterator _and_ forEach method. For now caching it
21270 // for consistency. 22459 // for consistency.
21271 return new FixedSizeListIterator<CssRule>(this); 22460 return new FixedSizeListIterator<CssRule>(this);
21272 } 22461 }
21273 22462
21274 // From Collection<CssRule>:
21275
21276 void add(CssRule value) {
21277 throw new UnsupportedError("Cannot add to immutable List.");
21278 }
21279
21280 void addLast(CssRule value) {
21281 throw new UnsupportedError("Cannot add to immutable List.");
21282 }
21283
21284 void addAll(Collection<CssRule> collection) {
21285 throw new UnsupportedError("Cannot add to immutable List.");
21286 }
21287
21288 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssRule)) { 22463 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssRule)) {
21289 return Collections.reduce(this, initialValue, combine); 22464 return Collections.reduce(this, initialValue, combine);
21290 } 22465 }
21291 22466
21292 bool contains(CssRule element) => Collections.contains(this, element); 22467 bool contains(CssRule element) => Collections.contains(this, element);
21293 22468
21294 void forEach(void f(CssRule element)) => Collections.forEach(this, f); 22469 void forEach(void f(CssRule element)) => Collections.forEach(this, f);
21295 22470
21296 Collection map(f(CssRule element)) => Collections.map(this, [], f); 22471 String join([String separator]) => Collections.joinList(this, separator);
21297 22472
21298 Collection<CssRule> filter(bool f(CssRule element)) => 22473 List mappedBy(f(CssRule element)) => new MappedList<CssRule, dynamic>(this, f) ;
21299 Collections.filter(this, <CssRule>[], f); 22474
22475 Iterable<CssRule> where(bool f(CssRule element)) => new WhereIterable<CssRule> (this, f);
21300 22476
21301 bool every(bool f(CssRule element)) => Collections.every(this, f); 22477 bool every(bool f(CssRule element)) => Collections.every(this, f);
21302 22478
21303 bool some(bool f(CssRule element)) => Collections.some(this, f); 22479 bool any(bool f(CssRule element)) => Collections.any(this, f);
21304 22480
21305 bool get isEmpty => this.length == 0; 22481 bool get isEmpty => this.length == 0;
21306 22482
22483 List<CssRule> take(int n) => new ListView<CssRule>(this, 0, n);
22484
22485 Iterable<CssRule> takeWhile(bool test(CssRule value)) {
22486 return new TakeWhileIterable<CssRule>(this, test);
22487 }
22488
22489 List<CssRule> skip(int n) => new ListView<CssRule>(this, n, null);
22490
22491 Iterable<CssRule> skipWhile(bool test(CssRule value)) {
22492 return new SkipWhileIterable<CssRule>(this, test);
22493 }
22494
22495 CssRule firstMatching(bool test(CssRule value), { CssRule orElse() }) {
22496 return Collections.firstMatching(this, test, orElse);
22497 }
22498
22499 CssRule lastMatching(bool test(CssRule value), {CssRule orElse()}) {
22500 return Collections.lastMatchingInList(this, test, orElse);
22501 }
22502
22503 CssRule singleMatching(bool test(CssRule value)) {
22504 return Collections.singleMatching(this, test);
22505 }
22506
22507 CssRule elementAt(int index) {
22508 return this[index];
22509 }
22510
22511 // From Collection<CssRule>:
22512
22513 void add(CssRule value) {
22514 throw new UnsupportedError("Cannot add to immutable List.");
22515 }
22516
22517 void addLast(CssRule value) {
22518 throw new UnsupportedError("Cannot add to immutable List.");
22519 }
22520
22521 void addAll(Iterable<CssRule> iterable) {
22522 throw new UnsupportedError("Cannot add to immutable List.");
22523 }
22524
21307 // From List<CssRule>: 22525 // From List<CssRule>:
21308 void set length(int value) { 22526 void set length(int value) {
21309 throw new UnsupportedError("Cannot resize immutable List."); 22527 throw new UnsupportedError("Cannot resize immutable List.");
21310 } 22528 }
21311 22529
21312 void clear() { 22530 void clear() {
21313 throw new UnsupportedError("Cannot clear immutable List."); 22531 throw new UnsupportedError("Cannot clear immutable List.");
21314 } 22532 }
21315 22533
21316 void sort([int compare(CssRule a, CssRule b)]) { 22534 void sort([int compare(CssRule a, CssRule b)]) {
21317 throw new UnsupportedError("Cannot sort immutable List."); 22535 throw new UnsupportedError("Cannot sort immutable List.");
21318 } 22536 }
21319 22537
21320 int indexOf(CssRule element, [int start = 0]) => 22538 int indexOf(CssRule element, [int start = 0]) =>
21321 Lists.indexOf(this, element, start, this.length); 22539 Lists.indexOf(this, element, start, this.length);
21322 22540
21323 int lastIndexOf(CssRule element, [int start]) { 22541 int lastIndexOf(CssRule element, [int start]) {
21324 if (start == null) start = length - 1; 22542 if (start == null) start = length - 1;
21325 return Lists.lastIndexOf(this, element, start); 22543 return Lists.lastIndexOf(this, element, start);
21326 } 22544 }
21327 22545
21328 CssRule get first => this[0]; 22546 CssRule get first {
22547 if (this.length > 0) return this[0];
22548 throw new StateError("No elements");
22549 }
21329 22550
21330 CssRule get last => this[length - 1]; 22551 CssRule get last {
22552 if (this.length > 0) return this[this.length - 1];
22553 throw new StateError("No elements");
22554 }
22555
22556 CssRule get single {
22557 if (length == 1) return this[0];
22558 if (length == 0) throw new StateError("No elements");
22559 throw new StateError("More than one element");
22560 }
22561
22562 CssRule min([int compare(CssRule a, CssRule b)]) => _Collections.minInList(thi s, compare);
22563
22564 CssRule max([int compare(CssRule a, CssRule b)]) => _Collections.maxInList(thi s, compare);
21331 22565
21332 CssRule removeAt(int pos) { 22566 CssRule removeAt(int pos) {
21333 throw new UnsupportedError("Cannot removeAt on immutable List."); 22567 throw new UnsupportedError("Cannot removeAt on immutable List.");
21334 } 22568 }
21335 22569
21336 CssRule removeLast() { 22570 CssRule removeLast() {
21337 throw new UnsupportedError("Cannot removeLast on immutable List."); 22571 throw new UnsupportedError("Cannot removeLast on immutable List.");
21338 } 22572 }
21339 22573
21340 void setRange(int start, int rangeLength, List<CssRule> from, [int startFrom]) { 22574 void setRange(int start, int rangeLength, List<CssRule> from, [int startFrom]) {
(...skipping 30 matching lines...) Expand all
21371 CssValue operator[](int index) => JS("CssValue", "#[#]", this, index); 22605 CssValue operator[](int index) => JS("CssValue", "#[#]", this, index);
21372 22606
21373 void operator[]=(int index, CssValue value) { 22607 void operator[]=(int index, CssValue value) {
21374 throw new UnsupportedError("Cannot assign element of immutable List."); 22608 throw new UnsupportedError("Cannot assign element of immutable List.");
21375 } 22609 }
21376 // -- start List<CssValue> mixins. 22610 // -- start List<CssValue> mixins.
21377 // CssValue is the element type. 22611 // CssValue is the element type.
21378 22612
21379 // From Iterable<CssValue>: 22613 // From Iterable<CssValue>:
21380 22614
21381 Iterator<CssValue> iterator() { 22615 Iterator<CssValue> get iterator {
21382 // Note: NodeLists are not fixed size. And most probably length shouldn't 22616 // Note: NodeLists are not fixed size. And most probably length shouldn't
21383 // be cached in both iterator _and_ forEach method. For now caching it 22617 // be cached in both iterator _and_ forEach method. For now caching it
21384 // for consistency. 22618 // for consistency.
21385 return new FixedSizeListIterator<CssValue>(this); 22619 return new FixedSizeListIterator<CssValue>(this);
21386 } 22620 }
21387 22621
21388 // From Collection<CssValue>:
21389
21390 void add(CssValue value) {
21391 throw new UnsupportedError("Cannot add to immutable List.");
21392 }
21393
21394 void addLast(CssValue value) {
21395 throw new UnsupportedError("Cannot add to immutable List.");
21396 }
21397
21398 void addAll(Collection<CssValue> collection) {
21399 throw new UnsupportedError("Cannot add to immutable List.");
21400 }
21401
21402 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssValue)) { 22622 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssValue)) {
21403 return Collections.reduce(this, initialValue, combine); 22623 return Collections.reduce(this, initialValue, combine);
21404 } 22624 }
21405 22625
21406 bool contains(CssValue element) => Collections.contains(this, element); 22626 bool contains(CssValue element) => Collections.contains(this, element);
21407 22627
21408 void forEach(void f(CssValue element)) => Collections.forEach(this, f); 22628 void forEach(void f(CssValue element)) => Collections.forEach(this, f);
21409 22629
21410 Collection map(f(CssValue element)) => Collections.map(this, [], f); 22630 String join([String separator]) => Collections.joinList(this, separator);
21411 22631
21412 Collection<CssValue> filter(bool f(CssValue element)) => 22632 List mappedBy(f(CssValue element)) => new MappedList<CssValue, dynamic>(this, f);
21413 Collections.filter(this, <CssValue>[], f); 22633
22634 Iterable<CssValue> where(bool f(CssValue element)) => new WhereIterable<CssVal ue>(this, f);
21414 22635
21415 bool every(bool f(CssValue element)) => Collections.every(this, f); 22636 bool every(bool f(CssValue element)) => Collections.every(this, f);
21416 22637
21417 bool some(bool f(CssValue element)) => Collections.some(this, f); 22638 bool any(bool f(CssValue element)) => Collections.any(this, f);
21418 22639
21419 bool get isEmpty => this.length == 0; 22640 bool get isEmpty => this.length == 0;
21420 22641
22642 List<CssValue> take(int n) => new ListView<CssValue>(this, 0, n);
22643
22644 Iterable<CssValue> takeWhile(bool test(CssValue value)) {
22645 return new TakeWhileIterable<CssValue>(this, test);
22646 }
22647
22648 List<CssValue> skip(int n) => new ListView<CssValue>(this, n, null);
22649
22650 Iterable<CssValue> skipWhile(bool test(CssValue value)) {
22651 return new SkipWhileIterable<CssValue>(this, test);
22652 }
22653
22654 CssValue firstMatching(bool test(CssValue value), { CssValue orElse() }) {
22655 return Collections.firstMatching(this, test, orElse);
22656 }
22657
22658 CssValue lastMatching(bool test(CssValue value), {CssValue orElse()}) {
22659 return Collections.lastMatchingInList(this, test, orElse);
22660 }
22661
22662 CssValue singleMatching(bool test(CssValue value)) {
22663 return Collections.singleMatching(this, test);
22664 }
22665
22666 CssValue elementAt(int index) {
22667 return this[index];
22668 }
22669
22670 // From Collection<CssValue>:
22671
22672 void add(CssValue value) {
22673 throw new UnsupportedError("Cannot add to immutable List.");
22674 }
22675
22676 void addLast(CssValue value) {
22677 throw new UnsupportedError("Cannot add to immutable List.");
22678 }
22679
22680 void addAll(Iterable<CssValue> iterable) {
22681 throw new UnsupportedError("Cannot add to immutable List.");
22682 }
22683
21421 // From List<CssValue>: 22684 // From List<CssValue>:
21422 void set length(int value) { 22685 void set length(int value) {
21423 throw new UnsupportedError("Cannot resize immutable List."); 22686 throw new UnsupportedError("Cannot resize immutable List.");
21424 } 22687 }
21425 22688
21426 void clear() { 22689 void clear() {
21427 throw new UnsupportedError("Cannot clear immutable List."); 22690 throw new UnsupportedError("Cannot clear immutable List.");
21428 } 22691 }
21429 22692
21430 void sort([int compare(CssValue a, CssValue b)]) { 22693 void sort([int compare(CssValue a, CssValue b)]) {
21431 throw new UnsupportedError("Cannot sort immutable List."); 22694 throw new UnsupportedError("Cannot sort immutable List.");
21432 } 22695 }
21433 22696
21434 int indexOf(CssValue element, [int start = 0]) => 22697 int indexOf(CssValue element, [int start = 0]) =>
21435 Lists.indexOf(this, element, start, this.length); 22698 Lists.indexOf(this, element, start, this.length);
21436 22699
21437 int lastIndexOf(CssValue element, [int start]) { 22700 int lastIndexOf(CssValue element, [int start]) {
21438 if (start == null) start = length - 1; 22701 if (start == null) start = length - 1;
21439 return Lists.lastIndexOf(this, element, start); 22702 return Lists.lastIndexOf(this, element, start);
21440 } 22703 }
21441 22704
21442 CssValue get first => this[0]; 22705 CssValue get first {
22706 if (this.length > 0) return this[0];
22707 throw new StateError("No elements");
22708 }
21443 22709
21444 CssValue get last => this[length - 1]; 22710 CssValue get last {
22711 if (this.length > 0) return this[this.length - 1];
22712 throw new StateError("No elements");
22713 }
22714
22715 CssValue get single {
22716 if (length == 1) return this[0];
22717 if (length == 0) throw new StateError("No elements");
22718 throw new StateError("More than one element");
22719 }
22720
22721 CssValue min([int compare(CssValue a, CssValue b)]) => _Collections.minInList( this, compare);
22722
22723 CssValue max([int compare(CssValue a, CssValue b)]) => _Collections.maxInList( this, compare);
21445 22724
21446 CssValue removeAt(int pos) { 22725 CssValue removeAt(int pos) {
21447 throw new UnsupportedError("Cannot removeAt on immutable List."); 22726 throw new UnsupportedError("Cannot removeAt on immutable List.");
21448 } 22727 }
21449 22728
21450 CssValue removeLast() { 22729 CssValue removeLast() {
21451 throw new UnsupportedError("Cannot removeLast on immutable List."); 22730 throw new UnsupportedError("Cannot removeLast on immutable List.");
21452 } 22731 }
21453 22732
21454 void setRange(int start, int rangeLength, List<CssValue> from, [int startFrom] ) { 22733 void setRange(int start, int rangeLength, List<CssValue> from, [int startFrom] ) {
(...skipping 30 matching lines...) Expand all
21485 Entry operator[](int index) => JS("Entry", "#[#]", this, index); 22764 Entry operator[](int index) => JS("Entry", "#[#]", this, index);
21486 22765
21487 void operator[]=(int index, Entry value) { 22766 void operator[]=(int index, Entry value) {
21488 throw new UnsupportedError("Cannot assign element of immutable List."); 22767 throw new UnsupportedError("Cannot assign element of immutable List.");
21489 } 22768 }
21490 // -- start List<Entry> mixins. 22769 // -- start List<Entry> mixins.
21491 // Entry is the element type. 22770 // Entry is the element type.
21492 22771
21493 // From Iterable<Entry>: 22772 // From Iterable<Entry>:
21494 22773
21495 Iterator<Entry> iterator() { 22774 Iterator<Entry> get iterator {
21496 // Note: NodeLists are not fixed size. And most probably length shouldn't 22775 // Note: NodeLists are not fixed size. And most probably length shouldn't
21497 // be cached in both iterator _and_ forEach method. For now caching it 22776 // be cached in both iterator _and_ forEach method. For now caching it
21498 // for consistency. 22777 // for consistency.
21499 return new FixedSizeListIterator<Entry>(this); 22778 return new FixedSizeListIterator<Entry>(this);
21500 } 22779 }
21501 22780
21502 // From Collection<Entry>:
21503
21504 void add(Entry value) {
21505 throw new UnsupportedError("Cannot add to immutable List.");
21506 }
21507
21508 void addLast(Entry value) {
21509 throw new UnsupportedError("Cannot add to immutable List.");
21510 }
21511
21512 void addAll(Collection<Entry> collection) {
21513 throw new UnsupportedError("Cannot add to immutable List.");
21514 }
21515
21516 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Entry)) { 22781 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Entry)) {
21517 return Collections.reduce(this, initialValue, combine); 22782 return Collections.reduce(this, initialValue, combine);
21518 } 22783 }
21519 22784
21520 bool contains(Entry element) => Collections.contains(this, element); 22785 bool contains(Entry element) => Collections.contains(this, element);
21521 22786
21522 void forEach(void f(Entry element)) => Collections.forEach(this, f); 22787 void forEach(void f(Entry element)) => Collections.forEach(this, f);
21523 22788
21524 Collection map(f(Entry element)) => Collections.map(this, [], f); 22789 String join([String separator]) => Collections.joinList(this, separator);
21525 22790
21526 Collection<Entry> filter(bool f(Entry element)) => 22791 List mappedBy(f(Entry element)) => new MappedList<Entry, dynamic>(this, f);
21527 Collections.filter(this, <Entry>[], f); 22792
22793 Iterable<Entry> where(bool f(Entry element)) => new WhereIterable<Entry>(this, f);
21528 22794
21529 bool every(bool f(Entry element)) => Collections.every(this, f); 22795 bool every(bool f(Entry element)) => Collections.every(this, f);
21530 22796
21531 bool some(bool f(Entry element)) => Collections.some(this, f); 22797 bool any(bool f(Entry element)) => Collections.any(this, f);
21532 22798
21533 bool get isEmpty => this.length == 0; 22799 bool get isEmpty => this.length == 0;
21534 22800
22801 List<Entry> take(int n) => new ListView<Entry>(this, 0, n);
22802
22803 Iterable<Entry> takeWhile(bool test(Entry value)) {
22804 return new TakeWhileIterable<Entry>(this, test);
22805 }
22806
22807 List<Entry> skip(int n) => new ListView<Entry>(this, n, null);
22808
22809 Iterable<Entry> skipWhile(bool test(Entry value)) {
22810 return new SkipWhileIterable<Entry>(this, test);
22811 }
22812
22813 Entry firstMatching(bool test(Entry value), { Entry orElse() }) {
22814 return Collections.firstMatching(this, test, orElse);
22815 }
22816
22817 Entry lastMatching(bool test(Entry value), {Entry orElse()}) {
22818 return Collections.lastMatchingInList(this, test, orElse);
22819 }
22820
22821 Entry singleMatching(bool test(Entry value)) {
22822 return Collections.singleMatching(this, test);
22823 }
22824
22825 Entry elementAt(int index) {
22826 return this[index];
22827 }
22828
22829 // From Collection<Entry>:
22830
22831 void add(Entry value) {
22832 throw new UnsupportedError("Cannot add to immutable List.");
22833 }
22834
22835 void addLast(Entry value) {
22836 throw new UnsupportedError("Cannot add to immutable List.");
22837 }
22838
22839 void addAll(Iterable<Entry> iterable) {
22840 throw new UnsupportedError("Cannot add to immutable List.");
22841 }
22842
21535 // From List<Entry>: 22843 // From List<Entry>:
21536 void set length(int value) { 22844 void set length(int value) {
21537 throw new UnsupportedError("Cannot resize immutable List."); 22845 throw new UnsupportedError("Cannot resize immutable List.");
21538 } 22846 }
21539 22847
21540 void clear() { 22848 void clear() {
21541 throw new UnsupportedError("Cannot clear immutable List."); 22849 throw new UnsupportedError("Cannot clear immutable List.");
21542 } 22850 }
21543 22851
21544 void sort([int compare(Entry a, Entry b)]) { 22852 void sort([int compare(Entry a, Entry b)]) {
21545 throw new UnsupportedError("Cannot sort immutable List."); 22853 throw new UnsupportedError("Cannot sort immutable List.");
21546 } 22854 }
21547 22855
21548 int indexOf(Entry element, [int start = 0]) => 22856 int indexOf(Entry element, [int start = 0]) =>
21549 Lists.indexOf(this, element, start, this.length); 22857 Lists.indexOf(this, element, start, this.length);
21550 22858
21551 int lastIndexOf(Entry element, [int start]) { 22859 int lastIndexOf(Entry element, [int start]) {
21552 if (start == null) start = length - 1; 22860 if (start == null) start = length - 1;
21553 return Lists.lastIndexOf(this, element, start); 22861 return Lists.lastIndexOf(this, element, start);
21554 } 22862 }
21555 22863
21556 Entry get first => this[0]; 22864 Entry get first {
22865 if (this.length > 0) return this[0];
22866 throw new StateError("No elements");
22867 }
21557 22868
21558 Entry get last => this[length - 1]; 22869 Entry get last {
22870 if (this.length > 0) return this[this.length - 1];
22871 throw new StateError("No elements");
22872 }
22873
22874 Entry get single {
22875 if (length == 1) return this[0];
22876 if (length == 0) throw new StateError("No elements");
22877 throw new StateError("More than one element");
22878 }
22879
22880 Entry min([int compare(Entry a, Entry b)]) => _Collections.minInList(this, com pare);
22881
22882 Entry max([int compare(Entry a, Entry b)]) => _Collections.maxInList(this, com pare);
21559 22883
21560 Entry removeAt(int pos) { 22884 Entry removeAt(int pos) {
21561 throw new UnsupportedError("Cannot removeAt on immutable List."); 22885 throw new UnsupportedError("Cannot removeAt on immutable List.");
21562 } 22886 }
21563 22887
21564 Entry removeLast() { 22888 Entry removeLast() {
21565 throw new UnsupportedError("Cannot removeLast on immutable List."); 22889 throw new UnsupportedError("Cannot removeLast on immutable List.");
21566 } 22890 }
21567 22891
21568 void setRange(int start, int rangeLength, List<Entry> from, [int startFrom]) { 22892 void setRange(int start, int rangeLength, List<Entry> from, [int startFrom]) {
(...skipping 30 matching lines...) Expand all
21599 EntrySync operator[](int index) => JS("EntrySync", "#[#]", this, index); 22923 EntrySync operator[](int index) => JS("EntrySync", "#[#]", this, index);
21600 22924
21601 void operator[]=(int index, EntrySync value) { 22925 void operator[]=(int index, EntrySync value) {
21602 throw new UnsupportedError("Cannot assign element of immutable List."); 22926 throw new UnsupportedError("Cannot assign element of immutable List.");
21603 } 22927 }
21604 // -- start List<EntrySync> mixins. 22928 // -- start List<EntrySync> mixins.
21605 // EntrySync is the element type. 22929 // EntrySync is the element type.
21606 22930
21607 // From Iterable<EntrySync>: 22931 // From Iterable<EntrySync>:
21608 22932
21609 Iterator<EntrySync> iterator() { 22933 Iterator<EntrySync> get iterator {
21610 // Note: NodeLists are not fixed size. And most probably length shouldn't 22934 // Note: NodeLists are not fixed size. And most probably length shouldn't
21611 // be cached in both iterator _and_ forEach method. For now caching it 22935 // be cached in both iterator _and_ forEach method. For now caching it
21612 // for consistency. 22936 // for consistency.
21613 return new FixedSizeListIterator<EntrySync>(this); 22937 return new FixedSizeListIterator<EntrySync>(this);
21614 } 22938 }
21615 22939
21616 // From Collection<EntrySync>:
21617
21618 void add(EntrySync value) {
21619 throw new UnsupportedError("Cannot add to immutable List.");
21620 }
21621
21622 void addLast(EntrySync value) {
21623 throw new UnsupportedError("Cannot add to immutable List.");
21624 }
21625
21626 void addAll(Collection<EntrySync> collection) {
21627 throw new UnsupportedError("Cannot add to immutable List.");
21628 }
21629
21630 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, EntrySync)) { 22940 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, EntrySync)) {
21631 return Collections.reduce(this, initialValue, combine); 22941 return Collections.reduce(this, initialValue, combine);
21632 } 22942 }
21633 22943
21634 bool contains(EntrySync element) => Collections.contains(this, element); 22944 bool contains(EntrySync element) => Collections.contains(this, element);
21635 22945
21636 void forEach(void f(EntrySync element)) => Collections.forEach(this, f); 22946 void forEach(void f(EntrySync element)) => Collections.forEach(this, f);
21637 22947
21638 Collection map(f(EntrySync element)) => Collections.map(this, [], f); 22948 String join([String separator]) => Collections.joinList(this, separator);
21639 22949
21640 Collection<EntrySync> filter(bool f(EntrySync element)) => 22950 List mappedBy(f(EntrySync element)) => new MappedList<EntrySync, dynamic>(this , f);
21641 Collections.filter(this, <EntrySync>[], f); 22951
22952 Iterable<EntrySync> where(bool f(EntrySync element)) => new WhereIterable<Entr ySync>(this, f);
21642 22953
21643 bool every(bool f(EntrySync element)) => Collections.every(this, f); 22954 bool every(bool f(EntrySync element)) => Collections.every(this, f);
21644 22955
21645 bool some(bool f(EntrySync element)) => Collections.some(this, f); 22956 bool any(bool f(EntrySync element)) => Collections.any(this, f);
21646 22957
21647 bool get isEmpty => this.length == 0; 22958 bool get isEmpty => this.length == 0;
21648 22959
22960 List<EntrySync> take(int n) => new ListView<EntrySync>(this, 0, n);
22961
22962 Iterable<EntrySync> takeWhile(bool test(EntrySync value)) {
22963 return new TakeWhileIterable<EntrySync>(this, test);
22964 }
22965
22966 List<EntrySync> skip(int n) => new ListView<EntrySync>(this, n, null);
22967
22968 Iterable<EntrySync> skipWhile(bool test(EntrySync value)) {
22969 return new SkipWhileIterable<EntrySync>(this, test);
22970 }
22971
22972 EntrySync firstMatching(bool test(EntrySync value), { EntrySync orElse() }) {
22973 return Collections.firstMatching(this, test, orElse);
22974 }
22975
22976 EntrySync lastMatching(bool test(EntrySync value), {EntrySync orElse()}) {
22977 return Collections.lastMatchingInList(this, test, orElse);
22978 }
22979
22980 EntrySync singleMatching(bool test(EntrySync value)) {
22981 return Collections.singleMatching(this, test);
22982 }
22983
22984 EntrySync elementAt(int index) {
22985 return this[index];
22986 }
22987
22988 // From Collection<EntrySync>:
22989
22990 void add(EntrySync value) {
22991 throw new UnsupportedError("Cannot add to immutable List.");
22992 }
22993
22994 void addLast(EntrySync value) {
22995 throw new UnsupportedError("Cannot add to immutable List.");
22996 }
22997
22998 void addAll(Iterable<EntrySync> iterable) {
22999 throw new UnsupportedError("Cannot add to immutable List.");
23000 }
23001
21649 // From List<EntrySync>: 23002 // From List<EntrySync>:
21650 void set length(int value) { 23003 void set length(int value) {
21651 throw new UnsupportedError("Cannot resize immutable List."); 23004 throw new UnsupportedError("Cannot resize immutable List.");
21652 } 23005 }
21653 23006
21654 void clear() { 23007 void clear() {
21655 throw new UnsupportedError("Cannot clear immutable List."); 23008 throw new UnsupportedError("Cannot clear immutable List.");
21656 } 23009 }
21657 23010
21658 void sort([int compare(EntrySync a, EntrySync b)]) { 23011 void sort([int compare(EntrySync a, EntrySync b)]) {
21659 throw new UnsupportedError("Cannot sort immutable List."); 23012 throw new UnsupportedError("Cannot sort immutable List.");
21660 } 23013 }
21661 23014
21662 int indexOf(EntrySync element, [int start = 0]) => 23015 int indexOf(EntrySync element, [int start = 0]) =>
21663 Lists.indexOf(this, element, start, this.length); 23016 Lists.indexOf(this, element, start, this.length);
21664 23017
21665 int lastIndexOf(EntrySync element, [int start]) { 23018 int lastIndexOf(EntrySync element, [int start]) {
21666 if (start == null) start = length - 1; 23019 if (start == null) start = length - 1;
21667 return Lists.lastIndexOf(this, element, start); 23020 return Lists.lastIndexOf(this, element, start);
21668 } 23021 }
21669 23022
21670 EntrySync get first => this[0]; 23023 EntrySync get first {
23024 if (this.length > 0) return this[0];
23025 throw new StateError("No elements");
23026 }
21671 23027
21672 EntrySync get last => this[length - 1]; 23028 EntrySync get last {
23029 if (this.length > 0) return this[this.length - 1];
23030 throw new StateError("No elements");
23031 }
23032
23033 EntrySync get single {
23034 if (length == 1) return this[0];
23035 if (length == 0) throw new StateError("No elements");
23036 throw new StateError("More than one element");
23037 }
23038
23039 EntrySync min([int compare(EntrySync a, EntrySync b)]) => _Collections.minInLi st(this, compare);
23040
23041 EntrySync max([int compare(EntrySync a, EntrySync b)]) => _Collections.maxInLi st(this, compare);
21673 23042
21674 EntrySync removeAt(int pos) { 23043 EntrySync removeAt(int pos) {
21675 throw new UnsupportedError("Cannot removeAt on immutable List."); 23044 throw new UnsupportedError("Cannot removeAt on immutable List.");
21676 } 23045 }
21677 23046
21678 EntrySync removeLast() { 23047 EntrySync removeLast() {
21679 throw new UnsupportedError("Cannot removeLast on immutable List."); 23048 throw new UnsupportedError("Cannot removeLast on immutable List.");
21680 } 23049 }
21681 23050
21682 void setRange(int start, int rangeLength, List<EntrySync> from, [int startFrom ]) { 23051 void setRange(int start, int rangeLength, List<EntrySync> from, [int startFrom ]) {
(...skipping 30 matching lines...) Expand all
21713 Gamepad operator[](int index) => JS("Gamepad", "#[#]", this, index); 23082 Gamepad operator[](int index) => JS("Gamepad", "#[#]", this, index);
21714 23083
21715 void operator[]=(int index, Gamepad value) { 23084 void operator[]=(int index, Gamepad value) {
21716 throw new UnsupportedError("Cannot assign element of immutable List."); 23085 throw new UnsupportedError("Cannot assign element of immutable List.");
21717 } 23086 }
21718 // -- start List<Gamepad> mixins. 23087 // -- start List<Gamepad> mixins.
21719 // Gamepad is the element type. 23088 // Gamepad is the element type.
21720 23089
21721 // From Iterable<Gamepad>: 23090 // From Iterable<Gamepad>:
21722 23091
21723 Iterator<Gamepad> iterator() { 23092 Iterator<Gamepad> get iterator {
21724 // Note: NodeLists are not fixed size. And most probably length shouldn't 23093 // Note: NodeLists are not fixed size. And most probably length shouldn't
21725 // be cached in both iterator _and_ forEach method. For now caching it 23094 // be cached in both iterator _and_ forEach method. For now caching it
21726 // for consistency. 23095 // for consistency.
21727 return new FixedSizeListIterator<Gamepad>(this); 23096 return new FixedSizeListIterator<Gamepad>(this);
21728 } 23097 }
21729 23098
21730 // From Collection<Gamepad>:
21731
21732 void add(Gamepad value) {
21733 throw new UnsupportedError("Cannot add to immutable List.");
21734 }
21735
21736 void addLast(Gamepad value) {
21737 throw new UnsupportedError("Cannot add to immutable List.");
21738 }
21739
21740 void addAll(Collection<Gamepad> collection) {
21741 throw new UnsupportedError("Cannot add to immutable List.");
21742 }
21743
21744 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Gamepad)) { 23099 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Gamepad)) {
21745 return Collections.reduce(this, initialValue, combine); 23100 return Collections.reduce(this, initialValue, combine);
21746 } 23101 }
21747 23102
21748 bool contains(Gamepad element) => Collections.contains(this, element); 23103 bool contains(Gamepad element) => Collections.contains(this, element);
21749 23104
21750 void forEach(void f(Gamepad element)) => Collections.forEach(this, f); 23105 void forEach(void f(Gamepad element)) => Collections.forEach(this, f);
21751 23106
21752 Collection map(f(Gamepad element)) => Collections.map(this, [], f); 23107 String join([String separator]) => Collections.joinList(this, separator);
21753 23108
21754 Collection<Gamepad> filter(bool f(Gamepad element)) => 23109 List mappedBy(f(Gamepad element)) => new MappedList<Gamepad, dynamic>(this, f) ;
21755 Collections.filter(this, <Gamepad>[], f); 23110
23111 Iterable<Gamepad> where(bool f(Gamepad element)) => new WhereIterable<Gamepad> (this, f);
21756 23112
21757 bool every(bool f(Gamepad element)) => Collections.every(this, f); 23113 bool every(bool f(Gamepad element)) => Collections.every(this, f);
21758 23114
21759 bool some(bool f(Gamepad element)) => Collections.some(this, f); 23115 bool any(bool f(Gamepad element)) => Collections.any(this, f);
21760 23116
21761 bool get isEmpty => this.length == 0; 23117 bool get isEmpty => this.length == 0;
21762 23118
23119 List<Gamepad> take(int n) => new ListView<Gamepad>(this, 0, n);
23120
23121 Iterable<Gamepad> takeWhile(bool test(Gamepad value)) {
23122 return new TakeWhileIterable<Gamepad>(this, test);
23123 }
23124
23125 List<Gamepad> skip(int n) => new ListView<Gamepad>(this, n, null);
23126
23127 Iterable<Gamepad> skipWhile(bool test(Gamepad value)) {
23128 return new SkipWhileIterable<Gamepad>(this, test);
23129 }
23130
23131 Gamepad firstMatching(bool test(Gamepad value), { Gamepad orElse() }) {
23132 return Collections.firstMatching(this, test, orElse);
23133 }
23134
23135 Gamepad lastMatching(bool test(Gamepad value), {Gamepad orElse()}) {
23136 return Collections.lastMatchingInList(this, test, orElse);
23137 }
23138
23139 Gamepad singleMatching(bool test(Gamepad value)) {
23140 return Collections.singleMatching(this, test);
23141 }
23142
23143 Gamepad elementAt(int index) {
23144 return this[index];
23145 }
23146
23147 // From Collection<Gamepad>:
23148
23149 void add(Gamepad value) {
23150 throw new UnsupportedError("Cannot add to immutable List.");
23151 }
23152
23153 void addLast(Gamepad value) {
23154 throw new UnsupportedError("Cannot add to immutable List.");
23155 }
23156
23157 void addAll(Iterable<Gamepad> iterable) {
23158 throw new UnsupportedError("Cannot add to immutable List.");
23159 }
23160
21763 // From List<Gamepad>: 23161 // From List<Gamepad>:
21764 void set length(int value) { 23162 void set length(int value) {
21765 throw new UnsupportedError("Cannot resize immutable List."); 23163 throw new UnsupportedError("Cannot resize immutable List.");
21766 } 23164 }
21767 23165
21768 void clear() { 23166 void clear() {
21769 throw new UnsupportedError("Cannot clear immutable List."); 23167 throw new UnsupportedError("Cannot clear immutable List.");
21770 } 23168 }
21771 23169
21772 void sort([int compare(Gamepad a, Gamepad b)]) { 23170 void sort([int compare(Gamepad a, Gamepad b)]) {
21773 throw new UnsupportedError("Cannot sort immutable List."); 23171 throw new UnsupportedError("Cannot sort immutable List.");
21774 } 23172 }
21775 23173
21776 int indexOf(Gamepad element, [int start = 0]) => 23174 int indexOf(Gamepad element, [int start = 0]) =>
21777 Lists.indexOf(this, element, start, this.length); 23175 Lists.indexOf(this, element, start, this.length);
21778 23176
21779 int lastIndexOf(Gamepad element, [int start]) { 23177 int lastIndexOf(Gamepad element, [int start]) {
21780 if (start == null) start = length - 1; 23178 if (start == null) start = length - 1;
21781 return Lists.lastIndexOf(this, element, start); 23179 return Lists.lastIndexOf(this, element, start);
21782 } 23180 }
21783 23181
21784 Gamepad get first => this[0]; 23182 Gamepad get first {
23183 if (this.length > 0) return this[0];
23184 throw new StateError("No elements");
23185 }
21785 23186
21786 Gamepad get last => this[length - 1]; 23187 Gamepad get last {
23188 if (this.length > 0) return this[this.length - 1];
23189 throw new StateError("No elements");
23190 }
23191
23192 Gamepad get single {
23193 if (length == 1) return this[0];
23194 if (length == 0) throw new StateError("No elements");
23195 throw new StateError("More than one element");
23196 }
23197
23198 Gamepad min([int compare(Gamepad a, Gamepad b)]) => _Collections.minInList(thi s, compare);
23199
23200 Gamepad max([int compare(Gamepad a, Gamepad b)]) => _Collections.maxInList(thi s, compare);
21787 23201
21788 Gamepad removeAt(int pos) { 23202 Gamepad removeAt(int pos) {
21789 throw new UnsupportedError("Cannot removeAt on immutable List."); 23203 throw new UnsupportedError("Cannot removeAt on immutable List.");
21790 } 23204 }
21791 23205
21792 Gamepad removeLast() { 23206 Gamepad removeLast() {
21793 throw new UnsupportedError("Cannot removeLast on immutable List."); 23207 throw new UnsupportedError("Cannot removeLast on immutable List.");
21794 } 23208 }
21795 23209
21796 void setRange(int start, int rangeLength, List<Gamepad> from, [int startFrom]) { 23210 void setRange(int start, int rangeLength, List<Gamepad> from, [int startFrom]) {
(...skipping 30 matching lines...) Expand all
21827 MediaStream operator[](int index) => JS("MediaStream", "#[#]", this, index); 23241 MediaStream operator[](int index) => JS("MediaStream", "#[#]", this, index);
21828 23242
21829 void operator[]=(int index, MediaStream value) { 23243 void operator[]=(int index, MediaStream value) {
21830 throw new UnsupportedError("Cannot assign element of immutable List."); 23244 throw new UnsupportedError("Cannot assign element of immutable List.");
21831 } 23245 }
21832 // -- start List<MediaStream> mixins. 23246 // -- start List<MediaStream> mixins.
21833 // MediaStream is the element type. 23247 // MediaStream is the element type.
21834 23248
21835 // From Iterable<MediaStream>: 23249 // From Iterable<MediaStream>:
21836 23250
21837 Iterator<MediaStream> iterator() { 23251 Iterator<MediaStream> get iterator {
21838 // Note: NodeLists are not fixed size. And most probably length shouldn't 23252 // Note: NodeLists are not fixed size. And most probably length shouldn't
21839 // be cached in both iterator _and_ forEach method. For now caching it 23253 // be cached in both iterator _and_ forEach method. For now caching it
21840 // for consistency. 23254 // for consistency.
21841 return new FixedSizeListIterator<MediaStream>(this); 23255 return new FixedSizeListIterator<MediaStream>(this);
21842 } 23256 }
21843 23257
21844 // From Collection<MediaStream>:
21845
21846 void add(MediaStream value) {
21847 throw new UnsupportedError("Cannot add to immutable List.");
21848 }
21849
21850 void addLast(MediaStream value) {
21851 throw new UnsupportedError("Cannot add to immutable List.");
21852 }
21853
21854 void addAll(Collection<MediaStream> collection) {
21855 throw new UnsupportedError("Cannot add to immutable List.");
21856 }
21857
21858 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, MediaStream)) { 23258 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, MediaStream)) {
21859 return Collections.reduce(this, initialValue, combine); 23259 return Collections.reduce(this, initialValue, combine);
21860 } 23260 }
21861 23261
21862 bool contains(MediaStream element) => Collections.contains(this, element); 23262 bool contains(MediaStream element) => Collections.contains(this, element);
21863 23263
21864 void forEach(void f(MediaStream element)) => Collections.forEach(this, f); 23264 void forEach(void f(MediaStream element)) => Collections.forEach(this, f);
21865 23265
21866 Collection map(f(MediaStream element)) => Collections.map(this, [], f); 23266 String join([String separator]) => Collections.joinList(this, separator);
21867 23267
21868 Collection<MediaStream> filter(bool f(MediaStream element)) => 23268 List mappedBy(f(MediaStream element)) => new MappedList<MediaStream, dynamic>( this, f);
21869 Collections.filter(this, <MediaStream>[], f); 23269
23270 Iterable<MediaStream> where(bool f(MediaStream element)) => new WhereIterable< MediaStream>(this, f);
21870 23271
21871 bool every(bool f(MediaStream element)) => Collections.every(this, f); 23272 bool every(bool f(MediaStream element)) => Collections.every(this, f);
21872 23273
21873 bool some(bool f(MediaStream element)) => Collections.some(this, f); 23274 bool any(bool f(MediaStream element)) => Collections.any(this, f);
21874 23275
21875 bool get isEmpty => this.length == 0; 23276 bool get isEmpty => this.length == 0;
21876 23277
23278 List<MediaStream> take(int n) => new ListView<MediaStream>(this, 0, n);
23279
23280 Iterable<MediaStream> takeWhile(bool test(MediaStream value)) {
23281 return new TakeWhileIterable<MediaStream>(this, test);
23282 }
23283
23284 List<MediaStream> skip(int n) => new ListView<MediaStream>(this, n, null);
23285
23286 Iterable<MediaStream> skipWhile(bool test(MediaStream value)) {
23287 return new SkipWhileIterable<MediaStream>(this, test);
23288 }
23289
23290 MediaStream firstMatching(bool test(MediaStream value), { MediaStream orElse() }) {
23291 return Collections.firstMatching(this, test, orElse);
23292 }
23293
23294 MediaStream lastMatching(bool test(MediaStream value), {MediaStream orElse()}) {
23295 return Collections.lastMatchingInList(this, test, orElse);
23296 }
23297
23298 MediaStream singleMatching(bool test(MediaStream value)) {
23299 return Collections.singleMatching(this, test);
23300 }
23301
23302 MediaStream elementAt(int index) {
23303 return this[index];
23304 }
23305
23306 // From Collection<MediaStream>:
23307
23308 void add(MediaStream value) {
23309 throw new UnsupportedError("Cannot add to immutable List.");
23310 }
23311
23312 void addLast(MediaStream value) {
23313 throw new UnsupportedError("Cannot add to immutable List.");
23314 }
23315
23316 void addAll(Iterable<MediaStream> iterable) {
23317 throw new UnsupportedError("Cannot add to immutable List.");
23318 }
23319
21877 // From List<MediaStream>: 23320 // From List<MediaStream>:
21878 void set length(int value) { 23321 void set length(int value) {
21879 throw new UnsupportedError("Cannot resize immutable List."); 23322 throw new UnsupportedError("Cannot resize immutable List.");
21880 } 23323 }
21881 23324
21882 void clear() { 23325 void clear() {
21883 throw new UnsupportedError("Cannot clear immutable List."); 23326 throw new UnsupportedError("Cannot clear immutable List.");
21884 } 23327 }
21885 23328
21886 void sort([int compare(MediaStream a, MediaStream b)]) { 23329 void sort([int compare(MediaStream a, MediaStream b)]) {
21887 throw new UnsupportedError("Cannot sort immutable List."); 23330 throw new UnsupportedError("Cannot sort immutable List.");
21888 } 23331 }
21889 23332
21890 int indexOf(MediaStream element, [int start = 0]) => 23333 int indexOf(MediaStream element, [int start = 0]) =>
21891 Lists.indexOf(this, element, start, this.length); 23334 Lists.indexOf(this, element, start, this.length);
21892 23335
21893 int lastIndexOf(MediaStream element, [int start]) { 23336 int lastIndexOf(MediaStream element, [int start]) {
21894 if (start == null) start = length - 1; 23337 if (start == null) start = length - 1;
21895 return Lists.lastIndexOf(this, element, start); 23338 return Lists.lastIndexOf(this, element, start);
21896 } 23339 }
21897 23340
21898 MediaStream get first => this[0]; 23341 MediaStream get first {
23342 if (this.length > 0) return this[0];
23343 throw new StateError("No elements");
23344 }
21899 23345
21900 MediaStream get last => this[length - 1]; 23346 MediaStream get last {
23347 if (this.length > 0) return this[this.length - 1];
23348 throw new StateError("No elements");
23349 }
23350
23351 MediaStream get single {
23352 if (length == 1) return this[0];
23353 if (length == 0) throw new StateError("No elements");
23354 throw new StateError("More than one element");
23355 }
23356
23357 MediaStream min([int compare(MediaStream a, MediaStream b)]) => _Collections.m inInList(this, compare);
23358
23359 MediaStream max([int compare(MediaStream a, MediaStream b)]) => _Collections.m axInList(this, compare);
21901 23360
21902 MediaStream removeAt(int pos) { 23361 MediaStream removeAt(int pos) {
21903 throw new UnsupportedError("Cannot removeAt on immutable List."); 23362 throw new UnsupportedError("Cannot removeAt on immutable List.");
21904 } 23363 }
21905 23364
21906 MediaStream removeLast() { 23365 MediaStream removeLast() {
21907 throw new UnsupportedError("Cannot removeLast on immutable List."); 23366 throw new UnsupportedError("Cannot removeLast on immutable List.");
21908 } 23367 }
21909 23368
21910 void setRange(int start, int rangeLength, List<MediaStream> from, [int startFr om]) { 23369 void setRange(int start, int rangeLength, List<MediaStream> from, [int startFr om]) {
(...skipping 30 matching lines...) Expand all
21941 SpeechInputResult operator[](int index) => JS("SpeechInputResult", "#[#]", thi s, index); 23400 SpeechInputResult operator[](int index) => JS("SpeechInputResult", "#[#]", thi s, index);
21942 23401
21943 void operator[]=(int index, SpeechInputResult value) { 23402 void operator[]=(int index, SpeechInputResult value) {
21944 throw new UnsupportedError("Cannot assign element of immutable List."); 23403 throw new UnsupportedError("Cannot assign element of immutable List.");
21945 } 23404 }
21946 // -- start List<SpeechInputResult> mixins. 23405 // -- start List<SpeechInputResult> mixins.
21947 // SpeechInputResult is the element type. 23406 // SpeechInputResult is the element type.
21948 23407
21949 // From Iterable<SpeechInputResult>: 23408 // From Iterable<SpeechInputResult>:
21950 23409
21951 Iterator<SpeechInputResult> iterator() { 23410 Iterator<SpeechInputResult> get iterator {
21952 // Note: NodeLists are not fixed size. And most probably length shouldn't 23411 // Note: NodeLists are not fixed size. And most probably length shouldn't
21953 // be cached in both iterator _and_ forEach method. For now caching it 23412 // be cached in both iterator _and_ forEach method. For now caching it
21954 // for consistency. 23413 // for consistency.
21955 return new FixedSizeListIterator<SpeechInputResult>(this); 23414 return new FixedSizeListIterator<SpeechInputResult>(this);
21956 } 23415 }
21957 23416
21958 // From Collection<SpeechInputResult>:
21959
21960 void add(SpeechInputResult value) {
21961 throw new UnsupportedError("Cannot add to immutable List.");
21962 }
21963
21964 void addLast(SpeechInputResult value) {
21965 throw new UnsupportedError("Cannot add to immutable List.");
21966 }
21967
21968 void addAll(Collection<SpeechInputResult> collection) {
21969 throw new UnsupportedError("Cannot add to immutable List.");
21970 }
21971
21972 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechInputResul t)) { 23417 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechInputResul t)) {
21973 return Collections.reduce(this, initialValue, combine); 23418 return Collections.reduce(this, initialValue, combine);
21974 } 23419 }
21975 23420
21976 bool contains(SpeechInputResult element) => Collections.contains(this, element ); 23421 bool contains(SpeechInputResult element) => Collections.contains(this, element );
21977 23422
21978 void forEach(void f(SpeechInputResult element)) => Collections.forEach(this, f ); 23423 void forEach(void f(SpeechInputResult element)) => Collections.forEach(this, f );
21979 23424
21980 Collection map(f(SpeechInputResult element)) => Collections.map(this, [], f); 23425 String join([String separator]) => Collections.joinList(this, separator);
21981 23426
21982 Collection<SpeechInputResult> filter(bool f(SpeechInputResult element)) => 23427 List mappedBy(f(SpeechInputResult element)) => new MappedList<SpeechInputResul t, dynamic>(this, f);
21983 Collections.filter(this, <SpeechInputResult>[], f); 23428
23429 Iterable<SpeechInputResult> where(bool f(SpeechInputResult element)) => new Wh ereIterable<SpeechInputResult>(this, f);
21984 23430
21985 bool every(bool f(SpeechInputResult element)) => Collections.every(this, f); 23431 bool every(bool f(SpeechInputResult element)) => Collections.every(this, f);
21986 23432
21987 bool some(bool f(SpeechInputResult element)) => Collections.some(this, f); 23433 bool any(bool f(SpeechInputResult element)) => Collections.any(this, f);
21988 23434
21989 bool get isEmpty => this.length == 0; 23435 bool get isEmpty => this.length == 0;
21990 23436
23437 List<SpeechInputResult> take(int n) => new ListView<SpeechInputResult>(this, 0 , n);
23438
23439 Iterable<SpeechInputResult> takeWhile(bool test(SpeechInputResult value)) {
23440 return new TakeWhileIterable<SpeechInputResult>(this, test);
23441 }
23442
23443 List<SpeechInputResult> skip(int n) => new ListView<SpeechInputResult>(this, n , null);
23444
23445 Iterable<SpeechInputResult> skipWhile(bool test(SpeechInputResult value)) {
23446 return new SkipWhileIterable<SpeechInputResult>(this, test);
23447 }
23448
23449 SpeechInputResult firstMatching(bool test(SpeechInputResult value), { SpeechIn putResult orElse() }) {
23450 return Collections.firstMatching(this, test, orElse);
23451 }
23452
23453 SpeechInputResult lastMatching(bool test(SpeechInputResult value), {SpeechInpu tResult orElse()}) {
23454 return Collections.lastMatchingInList(this, test, orElse);
23455 }
23456
23457 SpeechInputResult singleMatching(bool test(SpeechInputResult value)) {
23458 return Collections.singleMatching(this, test);
23459 }
23460
23461 SpeechInputResult elementAt(int index) {
23462 return this[index];
23463 }
23464
23465 // From Collection<SpeechInputResult>:
23466
23467 void add(SpeechInputResult value) {
23468 throw new UnsupportedError("Cannot add to immutable List.");
23469 }
23470
23471 void addLast(SpeechInputResult value) {
23472 throw new UnsupportedError("Cannot add to immutable List.");
23473 }
23474
23475 void addAll(Iterable<SpeechInputResult> iterable) {
23476 throw new UnsupportedError("Cannot add to immutable List.");
23477 }
23478
21991 // From List<SpeechInputResult>: 23479 // From List<SpeechInputResult>:
21992 void set length(int value) { 23480 void set length(int value) {
21993 throw new UnsupportedError("Cannot resize immutable List."); 23481 throw new UnsupportedError("Cannot resize immutable List.");
21994 } 23482 }
21995 23483
21996 void clear() { 23484 void clear() {
21997 throw new UnsupportedError("Cannot clear immutable List."); 23485 throw new UnsupportedError("Cannot clear immutable List.");
21998 } 23486 }
21999 23487
22000 void sort([int compare(SpeechInputResult a, SpeechInputResult b)]) { 23488 void sort([int compare(SpeechInputResult a, SpeechInputResult b)]) {
22001 throw new UnsupportedError("Cannot sort immutable List."); 23489 throw new UnsupportedError("Cannot sort immutable List.");
22002 } 23490 }
22003 23491
22004 int indexOf(SpeechInputResult element, [int start = 0]) => 23492 int indexOf(SpeechInputResult element, [int start = 0]) =>
22005 Lists.indexOf(this, element, start, this.length); 23493 Lists.indexOf(this, element, start, this.length);
22006 23494
22007 int lastIndexOf(SpeechInputResult element, [int start]) { 23495 int lastIndexOf(SpeechInputResult element, [int start]) {
22008 if (start == null) start = length - 1; 23496 if (start == null) start = length - 1;
22009 return Lists.lastIndexOf(this, element, start); 23497 return Lists.lastIndexOf(this, element, start);
22010 } 23498 }
22011 23499
22012 SpeechInputResult get first => this[0]; 23500 SpeechInputResult get first {
23501 if (this.length > 0) return this[0];
23502 throw new StateError("No elements");
23503 }
22013 23504
22014 SpeechInputResult get last => this[length - 1]; 23505 SpeechInputResult get last {
23506 if (this.length > 0) return this[this.length - 1];
23507 throw new StateError("No elements");
23508 }
23509
23510 SpeechInputResult get single {
23511 if (length == 1) return this[0];
23512 if (length == 0) throw new StateError("No elements");
23513 throw new StateError("More than one element");
23514 }
23515
23516 SpeechInputResult min([int compare(SpeechInputResult a, SpeechInputResult b)]) => _Collections.minInList(this, compare);
23517
23518 SpeechInputResult max([int compare(SpeechInputResult a, SpeechInputResult b)]) => _Collections.maxInList(this, compare);
22015 23519
22016 SpeechInputResult removeAt(int pos) { 23520 SpeechInputResult removeAt(int pos) {
22017 throw new UnsupportedError("Cannot removeAt on immutable List."); 23521 throw new UnsupportedError("Cannot removeAt on immutable List.");
22018 } 23522 }
22019 23523
22020 SpeechInputResult removeLast() { 23524 SpeechInputResult removeLast() {
22021 throw new UnsupportedError("Cannot removeLast on immutable List."); 23525 throw new UnsupportedError("Cannot removeLast on immutable List.");
22022 } 23526 }
22023 23527
22024 void setRange(int start, int rangeLength, List<SpeechInputResult> from, [int s tartFrom]) { 23528 void setRange(int start, int rangeLength, List<SpeechInputResult> from, [int s tartFrom]) {
(...skipping 30 matching lines...) Expand all
22055 SpeechRecognitionResult operator[](int index) => JS("SpeechRecognitionResult", "#[#]", this, index); 23559 SpeechRecognitionResult operator[](int index) => JS("SpeechRecognitionResult", "#[#]", this, index);
22056 23560
22057 void operator[]=(int index, SpeechRecognitionResult value) { 23561 void operator[]=(int index, SpeechRecognitionResult value) {
22058 throw new UnsupportedError("Cannot assign element of immutable List."); 23562 throw new UnsupportedError("Cannot assign element of immutable List.");
22059 } 23563 }
22060 // -- start List<SpeechRecognitionResult> mixins. 23564 // -- start List<SpeechRecognitionResult> mixins.
22061 // SpeechRecognitionResult is the element type. 23565 // SpeechRecognitionResult is the element type.
22062 23566
22063 // From Iterable<SpeechRecognitionResult>: 23567 // From Iterable<SpeechRecognitionResult>:
22064 23568
22065 Iterator<SpeechRecognitionResult> iterator() { 23569 Iterator<SpeechRecognitionResult> get iterator {
22066 // Note: NodeLists are not fixed size. And most probably length shouldn't 23570 // Note: NodeLists are not fixed size. And most probably length shouldn't
22067 // be cached in both iterator _and_ forEach method. For now caching it 23571 // be cached in both iterator _and_ forEach method. For now caching it
22068 // for consistency. 23572 // for consistency.
22069 return new FixedSizeListIterator<SpeechRecognitionResult>(this); 23573 return new FixedSizeListIterator<SpeechRecognitionResult>(this);
22070 } 23574 }
22071 23575
22072 // From Collection<SpeechRecognitionResult>:
22073
22074 void add(SpeechRecognitionResult value) {
22075 throw new UnsupportedError("Cannot add to immutable List.");
22076 }
22077
22078 void addLast(SpeechRecognitionResult value) {
22079 throw new UnsupportedError("Cannot add to immutable List.");
22080 }
22081
22082 void addAll(Collection<SpeechRecognitionResult> collection) {
22083 throw new UnsupportedError("Cannot add to immutable List.");
22084 }
22085
22086 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechRecognitio nResult)) { 23576 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechRecognitio nResult)) {
22087 return Collections.reduce(this, initialValue, combine); 23577 return Collections.reduce(this, initialValue, combine);
22088 } 23578 }
22089 23579
22090 bool contains(SpeechRecognitionResult element) => Collections.contains(this, e lement); 23580 bool contains(SpeechRecognitionResult element) => Collections.contains(this, e lement);
22091 23581
22092 void forEach(void f(SpeechRecognitionResult element)) => Collections.forEach(t his, f); 23582 void forEach(void f(SpeechRecognitionResult element)) => Collections.forEach(t his, f);
22093 23583
22094 Collection map(f(SpeechRecognitionResult element)) => Collections.map(this, [] , f); 23584 String join([String separator]) => Collections.joinList(this, separator);
22095 23585
22096 Collection<SpeechRecognitionResult> filter(bool f(SpeechRecognitionResult elem ent)) => 23586 List mappedBy(f(SpeechRecognitionResult element)) => new MappedList<SpeechReco gnitionResult, dynamic>(this, f);
22097 Collections.filter(this, <SpeechRecognitionResult>[], f); 23587
23588 Iterable<SpeechRecognitionResult> where(bool f(SpeechRecognitionResult element )) => new WhereIterable<SpeechRecognitionResult>(this, f);
22098 23589
22099 bool every(bool f(SpeechRecognitionResult element)) => Collections.every(this, f); 23590 bool every(bool f(SpeechRecognitionResult element)) => Collections.every(this, f);
22100 23591
22101 bool some(bool f(SpeechRecognitionResult element)) => Collections.some(this, f ); 23592 bool any(bool f(SpeechRecognitionResult element)) => Collections.any(this, f);
22102 23593
22103 bool get isEmpty => this.length == 0; 23594 bool get isEmpty => this.length == 0;
22104 23595
23596 List<SpeechRecognitionResult> take(int n) => new ListView<SpeechRecognitionRes ult>(this, 0, n);
23597
23598 Iterable<SpeechRecognitionResult> takeWhile(bool test(SpeechRecognitionResult value)) {
23599 return new TakeWhileIterable<SpeechRecognitionResult>(this, test);
23600 }
23601
23602 List<SpeechRecognitionResult> skip(int n) => new ListView<SpeechRecognitionRes ult>(this, n, null);
23603
23604 Iterable<SpeechRecognitionResult> skipWhile(bool test(SpeechRecognitionResult value)) {
23605 return new SkipWhileIterable<SpeechRecognitionResult>(this, test);
23606 }
23607
23608 SpeechRecognitionResult firstMatching(bool test(SpeechRecognitionResult value) , { SpeechRecognitionResult orElse() }) {
23609 return Collections.firstMatching(this, test, orElse);
23610 }
23611
23612 SpeechRecognitionResult lastMatching(bool test(SpeechRecognitionResult value), {SpeechRecognitionResult orElse()}) {
23613 return Collections.lastMatchingInList(this, test, orElse);
23614 }
23615
23616 SpeechRecognitionResult singleMatching(bool test(SpeechRecognitionResult value )) {
23617 return Collections.singleMatching(this, test);
23618 }
23619
23620 SpeechRecognitionResult elementAt(int index) {
23621 return this[index];
23622 }
23623
23624 // From Collection<SpeechRecognitionResult>:
23625
23626 void add(SpeechRecognitionResult value) {
23627 throw new UnsupportedError("Cannot add to immutable List.");
23628 }
23629
23630 void addLast(SpeechRecognitionResult value) {
23631 throw new UnsupportedError("Cannot add to immutable List.");
23632 }
23633
23634 void addAll(Iterable<SpeechRecognitionResult> iterable) {
23635 throw new UnsupportedError("Cannot add to immutable List.");
23636 }
23637
22105 // From List<SpeechRecognitionResult>: 23638 // From List<SpeechRecognitionResult>:
22106 void set length(int value) { 23639 void set length(int value) {
22107 throw new UnsupportedError("Cannot resize immutable List."); 23640 throw new UnsupportedError("Cannot resize immutable List.");
22108 } 23641 }
22109 23642
22110 void clear() { 23643 void clear() {
22111 throw new UnsupportedError("Cannot clear immutable List."); 23644 throw new UnsupportedError("Cannot clear immutable List.");
22112 } 23645 }
22113 23646
22114 void sort([int compare(SpeechRecognitionResult a, SpeechRecognitionResult b)]) { 23647 void sort([int compare(SpeechRecognitionResult a, SpeechRecognitionResult b)]) {
22115 throw new UnsupportedError("Cannot sort immutable List."); 23648 throw new UnsupportedError("Cannot sort immutable List.");
22116 } 23649 }
22117 23650
22118 int indexOf(SpeechRecognitionResult element, [int start = 0]) => 23651 int indexOf(SpeechRecognitionResult element, [int start = 0]) =>
22119 Lists.indexOf(this, element, start, this.length); 23652 Lists.indexOf(this, element, start, this.length);
22120 23653
22121 int lastIndexOf(SpeechRecognitionResult element, [int start]) { 23654 int lastIndexOf(SpeechRecognitionResult element, [int start]) {
22122 if (start == null) start = length - 1; 23655 if (start == null) start = length - 1;
22123 return Lists.lastIndexOf(this, element, start); 23656 return Lists.lastIndexOf(this, element, start);
22124 } 23657 }
22125 23658
22126 SpeechRecognitionResult get first => this[0]; 23659 SpeechRecognitionResult get first {
23660 if (this.length > 0) return this[0];
23661 throw new StateError("No elements");
23662 }
22127 23663
22128 SpeechRecognitionResult get last => this[length - 1]; 23664 SpeechRecognitionResult get last {
23665 if (this.length > 0) return this[this.length - 1];
23666 throw new StateError("No elements");
23667 }
23668
23669 SpeechRecognitionResult get single {
23670 if (length == 1) return this[0];
23671 if (length == 0) throw new StateError("No elements");
23672 throw new StateError("More than one element");
23673 }
23674
23675 SpeechRecognitionResult min([int compare(SpeechRecognitionResult a, SpeechReco gnitionResult b)]) => _Collections.minInList(this, compare);
23676
23677 SpeechRecognitionResult max([int compare(SpeechRecognitionResult a, SpeechReco gnitionResult b)]) => _Collections.maxInList(this, compare);
22129 23678
22130 SpeechRecognitionResult removeAt(int pos) { 23679 SpeechRecognitionResult removeAt(int pos) {
22131 throw new UnsupportedError("Cannot removeAt on immutable List."); 23680 throw new UnsupportedError("Cannot removeAt on immutable List.");
22132 } 23681 }
22133 23682
22134 SpeechRecognitionResult removeLast() { 23683 SpeechRecognitionResult removeLast() {
22135 throw new UnsupportedError("Cannot removeLast on immutable List."); 23684 throw new UnsupportedError("Cannot removeLast on immutable List.");
22136 } 23685 }
22137 23686
22138 void setRange(int start, int rangeLength, List<SpeechRecognitionResult> from, [int startFrom]) { 23687 void setRange(int start, int rangeLength, List<SpeechRecognitionResult> from, [int startFrom]) {
(...skipping 30 matching lines...) Expand all
22169 StyleSheet operator[](int index) => JS("StyleSheet", "#[#]", this, index); 23718 StyleSheet operator[](int index) => JS("StyleSheet", "#[#]", this, index);
22170 23719
22171 void operator[]=(int index, StyleSheet value) { 23720 void operator[]=(int index, StyleSheet value) {
22172 throw new UnsupportedError("Cannot assign element of immutable List."); 23721 throw new UnsupportedError("Cannot assign element of immutable List.");
22173 } 23722 }
22174 // -- start List<StyleSheet> mixins. 23723 // -- start List<StyleSheet> mixins.
22175 // StyleSheet is the element type. 23724 // StyleSheet is the element type.
22176 23725
22177 // From Iterable<StyleSheet>: 23726 // From Iterable<StyleSheet>:
22178 23727
22179 Iterator<StyleSheet> iterator() { 23728 Iterator<StyleSheet> get iterator {
22180 // Note: NodeLists are not fixed size. And most probably length shouldn't 23729 // Note: NodeLists are not fixed size. And most probably length shouldn't
22181 // be cached in both iterator _and_ forEach method. For now caching it 23730 // be cached in both iterator _and_ forEach method. For now caching it
22182 // for consistency. 23731 // for consistency.
22183 return new FixedSizeListIterator<StyleSheet>(this); 23732 return new FixedSizeListIterator<StyleSheet>(this);
22184 } 23733 }
22185 23734
22186 // From Collection<StyleSheet>:
22187
22188 void add(StyleSheet value) {
22189 throw new UnsupportedError("Cannot add to immutable List.");
22190 }
22191
22192 void addLast(StyleSheet value) {
22193 throw new UnsupportedError("Cannot add to immutable List.");
22194 }
22195
22196 void addAll(Collection<StyleSheet> collection) {
22197 throw new UnsupportedError("Cannot add to immutable List.");
22198 }
22199
22200 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, StyleSheet)) { 23735 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, StyleSheet)) {
22201 return Collections.reduce(this, initialValue, combine); 23736 return Collections.reduce(this, initialValue, combine);
22202 } 23737 }
22203 23738
22204 bool contains(StyleSheet element) => Collections.contains(this, element); 23739 bool contains(StyleSheet element) => Collections.contains(this, element);
22205 23740
22206 void forEach(void f(StyleSheet element)) => Collections.forEach(this, f); 23741 void forEach(void f(StyleSheet element)) => Collections.forEach(this, f);
22207 23742
22208 Collection map(f(StyleSheet element)) => Collections.map(this, [], f); 23743 String join([String separator]) => Collections.joinList(this, separator);
22209 23744
22210 Collection<StyleSheet> filter(bool f(StyleSheet element)) => 23745 List mappedBy(f(StyleSheet element)) => new MappedList<StyleSheet, dynamic>(th is, f);
22211 Collections.filter(this, <StyleSheet>[], f); 23746
23747 Iterable<StyleSheet> where(bool f(StyleSheet element)) => new WhereIterable<St yleSheet>(this, f);
22212 23748
22213 bool every(bool f(StyleSheet element)) => Collections.every(this, f); 23749 bool every(bool f(StyleSheet element)) => Collections.every(this, f);
22214 23750
22215 bool some(bool f(StyleSheet element)) => Collections.some(this, f); 23751 bool any(bool f(StyleSheet element)) => Collections.any(this, f);
22216 23752
22217 bool get isEmpty => this.length == 0; 23753 bool get isEmpty => this.length == 0;
22218 23754
23755 List<StyleSheet> take(int n) => new ListView<StyleSheet>(this, 0, n);
23756
23757 Iterable<StyleSheet> takeWhile(bool test(StyleSheet value)) {
23758 return new TakeWhileIterable<StyleSheet>(this, test);
23759 }
23760
23761 List<StyleSheet> skip(int n) => new ListView<StyleSheet>(this, n, null);
23762
23763 Iterable<StyleSheet> skipWhile(bool test(StyleSheet value)) {
23764 return new SkipWhileIterable<StyleSheet>(this, test);
23765 }
23766
23767 StyleSheet firstMatching(bool test(StyleSheet value), { StyleSheet orElse() }) {
23768 return Collections.firstMatching(this, test, orElse);
23769 }
23770
23771 StyleSheet lastMatching(bool test(StyleSheet value), {StyleSheet orElse()}) {
23772 return Collections.lastMatchingInList(this, test, orElse);
23773 }
23774
23775 StyleSheet singleMatching(bool test(StyleSheet value)) {
23776 return Collections.singleMatching(this, test);
23777 }
23778
23779 StyleSheet elementAt(int index) {
23780 return this[index];
23781 }
23782
23783 // From Collection<StyleSheet>:
23784
23785 void add(StyleSheet value) {
23786 throw new UnsupportedError("Cannot add to immutable List.");
23787 }
23788
23789 void addLast(StyleSheet value) {
23790 throw new UnsupportedError("Cannot add to immutable List.");
23791 }
23792
23793 void addAll(Iterable<StyleSheet> iterable) {
23794 throw new UnsupportedError("Cannot add to immutable List.");
23795 }
23796
22219 // From List<StyleSheet>: 23797 // From List<StyleSheet>:
22220 void set length(int value) { 23798 void set length(int value) {
22221 throw new UnsupportedError("Cannot resize immutable List."); 23799 throw new UnsupportedError("Cannot resize immutable List.");
22222 } 23800 }
22223 23801
22224 void clear() { 23802 void clear() {
22225 throw new UnsupportedError("Cannot clear immutable List."); 23803 throw new UnsupportedError("Cannot clear immutable List.");
22226 } 23804 }
22227 23805
22228 void sort([int compare(StyleSheet a, StyleSheet b)]) { 23806 void sort([int compare(StyleSheet a, StyleSheet b)]) {
22229 throw new UnsupportedError("Cannot sort immutable List."); 23807 throw new UnsupportedError("Cannot sort immutable List.");
22230 } 23808 }
22231 23809
22232 int indexOf(StyleSheet element, [int start = 0]) => 23810 int indexOf(StyleSheet element, [int start = 0]) =>
22233 Lists.indexOf(this, element, start, this.length); 23811 Lists.indexOf(this, element, start, this.length);
22234 23812
22235 int lastIndexOf(StyleSheet element, [int start]) { 23813 int lastIndexOf(StyleSheet element, [int start]) {
22236 if (start == null) start = length - 1; 23814 if (start == null) start = length - 1;
22237 return Lists.lastIndexOf(this, element, start); 23815 return Lists.lastIndexOf(this, element, start);
22238 } 23816 }
22239 23817
22240 StyleSheet get first => this[0]; 23818 StyleSheet get first {
23819 if (this.length > 0) return this[0];
23820 throw new StateError("No elements");
23821 }
22241 23822
22242 StyleSheet get last => this[length - 1]; 23823 StyleSheet get last {
23824 if (this.length > 0) return this[this.length - 1];
23825 throw new StateError("No elements");
23826 }
23827
23828 StyleSheet get single {
23829 if (length == 1) return this[0];
23830 if (length == 0) throw new StateError("No elements");
23831 throw new StateError("More than one element");
23832 }
23833
23834 StyleSheet min([int compare(StyleSheet a, StyleSheet b)]) => _Collections.minI nList(this, compare);
23835
23836 StyleSheet max([int compare(StyleSheet a, StyleSheet b)]) => _Collections.maxI nList(this, compare);
22243 23837
22244 StyleSheet removeAt(int pos) { 23838 StyleSheet removeAt(int pos) {
22245 throw new UnsupportedError("Cannot removeAt on immutable List."); 23839 throw new UnsupportedError("Cannot removeAt on immutable List.");
22246 } 23840 }
22247 23841
22248 StyleSheet removeLast() { 23842 StyleSheet removeLast() {
22249 throw new UnsupportedError("Cannot removeLast on immutable List."); 23843 throw new UnsupportedError("Cannot removeLast on immutable List.");
22250 } 23844 }
22251 23845
22252 void setRange(int start, int rangeLength, List<StyleSheet> from, [int startFro m]) { 23846 void setRange(int start, int rangeLength, List<StyleSheet> from, [int startFro m]) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
22424 */ 24018 */
22425 class _DataAttributeMap implements Map<String, String> { 24019 class _DataAttributeMap implements Map<String, String> {
22426 24020
22427 final Map<String, String> $dom_attributes; 24021 final Map<String, String> $dom_attributes;
22428 24022
22429 _DataAttributeMap(this.$dom_attributes); 24023 _DataAttributeMap(this.$dom_attributes);
22430 24024
22431 // interface Map 24025 // interface Map
22432 24026
22433 // TODO: Use lazy iterator when it is available on Map. 24027 // TODO: Use lazy iterator when it is available on Map.
22434 bool containsValue(String value) => values.some((v) => v == value); 24028 bool containsValue(String value) => values.any((v) => v == value);
22435 24029
22436 bool containsKey(String key) => $dom_attributes.containsKey(_attr(key)); 24030 bool containsKey(String key) => $dom_attributes.containsKey(_attr(key));
22437 24031
22438 String operator [](String key) => $dom_attributes[_attr(key)]; 24032 String operator [](String key) => $dom_attributes[_attr(key)];
22439 24033
22440 void operator []=(String key, value) { 24034 void operator []=(String key, value) {
22441 $dom_attributes[_attr(key)] = '$value'; 24035 $dom_attributes[_attr(key)] = '$value';
22442 } 24036 }
22443 24037
22444 String putIfAbsent(String key, String ifAbsent()) => 24038 String putIfAbsent(String key, String ifAbsent()) =>
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
22647 return result; 24241 return result;
22648 } 24242 }
22649 24243
22650 /** 24244 /**
22651 * Returns [:true:] if classes cannot be added or removed from this 24245 * Returns [:true:] if classes cannot be added or removed from this
22652 * [:CssClassSet:]. 24246 * [:CssClassSet:].
22653 */ 24247 */
22654 bool get frozen => false; 24248 bool get frozen => false;
22655 24249
22656 // interface Iterable - BEGIN 24250 // interface Iterable - BEGIN
22657 Iterator<String> iterator() => readClasses().iterator(); 24251 Iterator<String> get iterator => readClasses().iterator;
22658 // interface Iterable - END 24252 // interface Iterable - END
22659 24253
22660 // interface Collection - BEGIN 24254 // interface Collection - BEGIN
22661 void forEach(void f(String element)) { 24255 void forEach(void f(String element)) {
22662 readClasses().forEach(f); 24256 readClasses().forEach(f);
22663 } 24257 }
22664 24258
22665 Collection map(f(String element)) => readClasses().map(f); 24259 String join([String separator]) => readClasses().join(separator);
22666 24260
22667 Collection<String> filter(bool f(String element)) => readClasses().filter(f); 24261 Iterable mappedBy(f(String element)) => readClasses().mappedBy(f);
24262
24263 Iterable<String> where(bool f(String element)) => readClasses().where(f);
22668 24264
22669 bool every(bool f(String element)) => readClasses().every(f); 24265 bool every(bool f(String element)) => readClasses().every(f);
22670 24266
22671 bool some(bool f(String element)) => readClasses().some(f); 24267 bool any(bool f(String element)) => readClasses().any(f);
22672 24268
22673 bool get isEmpty => readClasses().isEmpty; 24269 bool get isEmpty => readClasses().isEmpty;
22674 24270
22675 int get length =>readClasses().length; 24271 int get length =>readClasses().length;
22676 24272
22677 dynamic reduce(dynamic initialValue, 24273 dynamic reduce(dynamic initialValue,
22678 dynamic combine(dynamic previousValue, String element)) { 24274 dynamic combine(dynamic previousValue, String element)) {
22679 return readClasses().reduce(initialValue, combine); 24275 return readClasses().reduce(initialValue, combine);
22680 } 24276 }
22681 // interface Collection - END 24277 // interface Collection - END
22682 24278
22683 // interface Set - BEGIN 24279 // interface Set - BEGIN
22684 bool contains(String value) => readClasses().contains(value); 24280 bool contains(String value) => readClasses().contains(value);
22685 24281
22686 void add(String value) { 24282 void add(String value) {
22687 // TODO - figure out if we need to do any validation here 24283 // TODO - figure out if we need to do any validation here
22688 // or if the browser natively does enough 24284 // or if the browser natively does enough
22689 _modify((s) => s.add(value)); 24285 _modify((s) => s.add(value));
22690 } 24286 }
22691 24287
22692 bool remove(String value) { 24288 bool remove(String value) {
22693 Set<String> s = readClasses(); 24289 Set<String> s = readClasses();
22694 bool result = s.remove(value); 24290 bool result = s.remove(value);
22695 writeClasses(s); 24291 writeClasses(s);
22696 return result; 24292 return result;
22697 } 24293 }
22698 24294
22699 void addAll(Collection<String> collection) { 24295 void addAll(Iterable<String> iterable) {
22700 // TODO - see comment above about validation 24296 // TODO - see comment above about validation
22701 _modify((s) => s.addAll(collection)); 24297 _modify((s) => s.addAll(iterable));
22702 } 24298 }
22703 24299
22704 void removeAll(Collection<String> collection) { 24300 void removeAll(Iterable<String> iterable) {
22705 _modify((s) => s.removeAll(collection)); 24301 _modify((s) => s.removeAll(iterable));
22706 } 24302 }
22707 24303
22708 bool isSubsetOf(Collection<String> collection) => 24304 bool isSubsetOf(Collection<String> collection) =>
22709 readClasses().isSubsetOf(collection); 24305 readClasses().isSubsetOf(collection);
22710 24306
22711 bool containsAll(Collection<String> collection) => 24307 bool containsAll(Collection<String> collection) =>
22712 readClasses().containsAll(collection); 24308 readClasses().containsAll(collection);
22713 24309
22714 Set<String> intersection(Collection<String> other) => 24310 Set<String> intersection(Collection<String> other) =>
22715 readClasses().intersection(other); 24311 readClasses().intersection(other);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
22934 if (_callbacks.length == 0) { 24530 if (_callbacks.length == 0) {
22935 // If we have no listeners, don't bother keeping track of keypresses. 24531 // If we have no listeners, don't bother keeping track of keypresses.
22936 _target.on.keyDown.remove(_keyDown); 24532 _target.on.keyDown.remove(_keyDown);
22937 _target.on.keyPress.remove(_keyPress); 24533 _target.on.keyPress.remove(_keyPress);
22938 _target.on.keyUp.remove(_keyUp); 24534 _target.on.keyUp.remove(_keyUp);
22939 } 24535 }
22940 } 24536 }
22941 24537
22942 /** Determine if caps lock is one of the currently depressed keys. */ 24538 /** Determine if caps lock is one of the currently depressed keys. */
22943 bool get _capsLockOn => 24539 bool get _capsLockOn =>
22944 _keyDownList.some((var element) => element.keyCode == KeyCode.CAPS_LOCK); 24540 _keyDownList.any((var element) => element.keyCode == KeyCode.CAPS_LOCK);
22945 24541
22946 /** 24542 /**
22947 * Given the previously recorded keydown key codes, see if we can determine 24543 * Given the previously recorded keydown key codes, see if we can determine
22948 * the keycode of this keypress [event]. (Generally browsers only provide 24544 * the keycode of this keypress [event]. (Generally browsers only provide
22949 * charCode information for keypress events, but with a little 24545 * charCode information for keypress events, but with a little
22950 * reverse-engineering, we can also determine the keyCode.) Returns 24546 * reverse-engineering, we can also determine the keyCode.) Returns
22951 * KeyCode.UNKNOWN if the keycode could not be determined. 24547 * KeyCode.UNKNOWN if the keycode could not be determined.
22952 */ 24548 */
22953 int _determineKeyCodeForKeypress(KeyboardEvent event) { 24549 int _determineKeyCodeForKeypress(KeyboardEvent event) {
22954 // Note: This function is a work in progress. We'll expand this function 24550 // Note: This function is a work in progress. We'll expand this function
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
23163 // pressed, given previous keydown information. 24759 // pressed, given previous keydown information.
23164 e._shadowKeyCode = _determineKeyCodeForKeypress(e); 24760 e._shadowKeyCode = _determineKeyCodeForKeypress(e);
23165 24761
23166 // Correct the key value for certain browser-specific quirks. 24762 // Correct the key value for certain browser-specific quirks.
23167 if (e._shadowKeyIdentifier != null && 24763 if (e._shadowKeyIdentifier != null &&
23168 _keyIdentifier.containsKey(e._shadowKeyIdentifier)) { 24764 _keyIdentifier.containsKey(e._shadowKeyIdentifier)) {
23169 // This is needed for Safari Windows because it currently doesn't give a 24765 // This is needed for Safari Windows because it currently doesn't give a
23170 // keyCode/which for non printable keys. 24766 // keyCode/which for non printable keys.
23171 e._shadowKeyCode = _keyIdentifier[e._shadowKeyIdentifier]; 24767 e._shadowKeyCode = _keyIdentifier[e._shadowKeyIdentifier];
23172 } 24768 }
23173 e._shadowAltKey = _keyDownList.some((var element) => element.altKey); 24769 e._shadowAltKey = _keyDownList.any((var element) => element.altKey);
23174 _dispatch(e); 24770 _dispatch(e);
23175 } 24771 }
23176 24772
23177 /** Handle keyup events. */ 24773 /** Handle keyup events. */
23178 void processKeyUp(KeyboardEvent event) { 24774 void processKeyUp(KeyboardEvent event) {
23179 var e = new KeyEvent(event); 24775 var e = new KeyEvent(event);
23180 KeyboardEvent toRemove = null; 24776 KeyboardEvent toRemove = null;
23181 for (var key in _keyDownList) { 24777 for (var key in _keyDownList) {
23182 if (key.keyCode == e.keyCode) { 24778 if (key.keyCode == e.keyCode) {
23183 toRemove = key; 24779 toRemove = key;
23184 } 24780 }
23185 } 24781 }
23186 if (toRemove != null) { 24782 if (toRemove != null) {
23187 _keyDownList = _keyDownList.filter((element) => element != toRemove); 24783 _keyDownList =
24784 _keyDownList.where((element) => element != toRemove).toList();
23188 } else if (_keyDownList.length > 0) { 24785 } else if (_keyDownList.length > 0) {
23189 // This happens when we've reached some international keyboard case we 24786 // This happens when we've reached some international keyboard case we
23190 // haven't accounted for or we haven't correctly eliminated all browser 24787 // haven't accounted for or we haven't correctly eliminated all browser
23191 // inconsistencies. Filing bugs on when this is reached is welcome! 24788 // inconsistencies. Filing bugs on when this is reached is welcome!
23192 _keyDownList.removeLast(); 24789 _keyDownList.removeLast();
23193 } 24790 }
23194 _dispatch(e); 24791 _dispatch(e);
23195 } 24792 }
23196 } 24793 }
23197 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 24794 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
24133 return _deserialize(result); 25730 return _deserialize(result);
24134 } 25731 }
24135 25732
24136 static _call(int isolateId, int portId, var message) { 25733 static _call(int isolateId, int portId, var message) {
24137 var target = 'dart-port-$isolateId-$portId'; 25734 var target = 'dart-port-$isolateId-$portId';
24138 // TODO(vsm): Make this re-entrant. 25735 // TODO(vsm): Make this re-entrant.
24139 // TODO(vsm): Set this up set once, on the first call. 25736 // TODO(vsm): Set this up set once, on the first call.
24140 var source = '$target-result'; 25737 var source = '$target-result';
24141 var result = null; 25738 var result = null;
24142 var listener = (Event e) { 25739 var listener = (Event e) {
24143 result = JSON.parse(_getPortSyncEventData(e)); 25740 result = json.parse(_getPortSyncEventData(e));
24144 }; 25741 };
24145 window.on[source].add(listener); 25742 window.on[source].add(listener);
24146 _dispatchEvent(target, [source, message]); 25743 _dispatchEvent(target, [source, message]);
24147 window.on[source].remove(listener); 25744 window.on[source].remove(listener);
24148 return result; 25745 return result;
24149 } 25746 }
24150 } 25747 }
24151 25748
24152 // The receiver is in the same Dart isolate, compiled to JS. 25749 // The receiver is in the same Dart isolate, compiled to JS.
24153 class _LocalSendPortSync implements SendPortSync { 25750 class _LocalSendPortSync implements SendPortSync {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
24205 } 25802 }
24206 25803
24207 static String _getListenerName(isolateId, portId) => 25804 static String _getListenerName(isolateId, portId) =>
24208 'dart-port-$isolateId-$portId'; 25805 'dart-port-$isolateId-$portId';
24209 String get _listenerName => _getListenerName(_isolateId, _portId); 25806 String get _listenerName => _getListenerName(_isolateId, _portId);
24210 25807
24211 void receive(callback(var message)) { 25808 void receive(callback(var message)) {
24212 _callback = callback; 25809 _callback = callback;
24213 if (_listener == null) { 25810 if (_listener == null) {
24214 _listener = (Event e) { 25811 _listener = (Event e) {
24215 var data = JSON.parse(_getPortSyncEventData(e)); 25812 var data = json.parse(_getPortSyncEventData(e));
24216 var replyTo = data[0]; 25813 var replyTo = data[0];
24217 var message = _deserialize(data[1]); 25814 var message = _deserialize(data[1]);
24218 var result = _callback(message); 25815 var result = _callback(message);
24219 _dispatchEvent(replyTo, _serialize(result)); 25816 _dispatchEvent(replyTo, _serialize(result));
24220 }; 25817 };
24221 window.on[_listenerName].add(_listener); 25818 window.on[_listenerName].add(_listener);
24222 } 25819 }
24223 } 25820 }
24224 25821
24225 void close() { 25822 void close() {
(...skipping 10 matching lines...) Expand all
24236 return _portMap[portId].toSendPort(); 25833 return _portMap[portId].toSendPort();
24237 } else { 25834 } else {
24238 return new _RemoteSendPortSync(isolateId, portId); 25835 return new _RemoteSendPortSync(isolateId, portId);
24239 } 25836 }
24240 } 25837 }
24241 } 25838 }
24242 25839
24243 get _isolateId => ReceivePortSync._isolateId; 25840 get _isolateId => ReceivePortSync._isolateId;
24244 25841
24245 void _dispatchEvent(String receiver, var message) { 25842 void _dispatchEvent(String receiver, var message) {
24246 var event = new CustomEvent(receiver, false, false, JSON.stringify(message)); 25843 var event = new CustomEvent(receiver, false, false, json.stringify(message));
24247 window.$dom_dispatchEvent(event); 25844 window.$dom_dispatchEvent(event);
24248 } 25845 }
24249 25846
24250 String _getPortSyncEventData(CustomEvent event) => event.detail; 25847 String _getPortSyncEventData(CustomEvent event) => event.detail;
24251 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 25848 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
24252 // for details. All rights reserved. Use of this source code is governed by a 25849 // for details. All rights reserved. Use of this source code is governed by a
24253 // BSD-style license that can be found in the LICENSE file. 25850 // BSD-style license that can be found in the LICENSE file.
24254 25851
24255 25852
24256 typedef Object ComputeValue(); 25853 typedef Object ComputeValue();
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
24531 // TODO(floitsch): we are losing the generic type. 26128 // TODO(floitsch): we are losing the generic type.
24532 return ['list', id, jsArray]; 26129 return ['list', id, jsArray];
24533 } 26130 }
24534 26131
24535 visitMap(Map map) { 26132 visitMap(Map map) {
24536 int copyId = _visited[map]; 26133 int copyId = _visited[map];
24537 if (copyId != null) return ['ref', copyId]; 26134 if (copyId != null) return ['ref', copyId];
24538 26135
24539 int id = _nextFreeRefId++; 26136 int id = _nextFreeRefId++;
24540 _visited[map] = id; 26137 _visited[map] = id;
24541 var keys = _serializeList(map.keys); 26138 var keys = _serializeList(map.keys.toList());
24542 var values = _serializeList(map.values); 26139 var values = _serializeList(map.values.toList());
24543 // TODO(floitsch): we are losing the generic type. 26140 // TODO(floitsch): we are losing the generic type.
24544 return ['map', id, keys, values]; 26141 return ['map', id, keys, values];
24545 } 26142 }
24546 26143
24547 _serializeList(List list) { 26144 _serializeList(List list) {
24548 int len = list.length; 26145 int len = list.length;
24549 var result = new List(len); 26146 var result = new List.fixedLength(len);
24550 for (int i = 0; i < len; i++) { 26147 for (int i = 0; i < len; i++) {
24551 result[i] = _dispatch(list[i]); 26148 result[i] = _dispatch(list[i]);
24552 } 26149 }
24553 return result; 26150 return result;
24554 } 26151 }
24555 } 26152 }
24556 26153
24557 /** Deserializes arrays created with [_Serializer]. */ 26154 /** Deserializes arrays created with [_Serializer]. */
24558 abstract class _Deserializer { 26155 abstract class _Deserializer {
24559 Map<int, dynamic> _deserialized; 26156 Map<int, dynamic> _deserialized;
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
25267 target.$dom_removeEventListener(type, listener, useCapture); 26864 target.$dom_removeEventListener(type, listener, useCapture);
25268 } 26865 }
25269 26866
25270 } 26867 }
25271 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 26868 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
25272 // for details. All rights reserved. Use of this source code is governed by a 26869 // for details. All rights reserved. Use of this source code is governed by a
25273 // BSD-style license that can be found in the LICENSE file. 26870 // BSD-style license that can be found in the LICENSE file.
25274 26871
25275 26872
25276 // Iterator for arrays with fixed size. 26873 // Iterator for arrays with fixed size.
25277 class FixedSizeListIterator<T> extends _VariableSizeListIterator<T> { 26874 class FixedSizeListIterator<T> implements Iterator<T> {
26875 final List<T> _array;
26876 final int _length; // Cache array length for faster access.
26877 int _position;
26878 T _current;
26879
25278 FixedSizeListIterator(List<T> array) 26880 FixedSizeListIterator(List<T> array)
25279 : super(array), 26881 : _array = array,
26882 _position = -1,
25280 _length = array.length; 26883 _length = array.length;
25281 26884
25282 bool get hasNext => _length > _pos; 26885 bool moveNext() {
26886 int nextPosition = _position + 1;
26887 if (nextPosition < _length) {
26888 _current = _array[nextPosition];
26889 _position = nextPosition;
26890 return true;
26891 }
26892 _current = null;
26893 _position = _length;
26894 return false;
26895 }
25283 26896
25284 final int _length; // Cache array length for faster access. 26897 T get current => _current;
25285 } 26898 }
25286 26899
25287 // Iterator for arrays with variable size. 26900 // Iterator for arrays with variable size.
25288 class _VariableSizeListIterator<T> implements Iterator<T> { 26901 class _VariableSizeListIterator<T> implements Iterator<T> {
26902 final List<T> _array;
26903 int _position;
26904 T _current;
26905
25289 _VariableSizeListIterator(List<T> array) 26906 _VariableSizeListIterator(List<T> array)
25290 : _array = array, 26907 : _array = array,
25291 _pos = 0; 26908 _position = -1;
25292 26909
25293 bool get hasNext => _array.length > _pos; 26910 bool moveNext() {
25294 26911 int nextPosition = _position + 1;
25295 T next() { 26912 if (nextPosition < _array.length) {
25296 if (!hasNext) { 26913 _current = _array[nextPosition];
25297 throw new StateError("No more elements"); 26914 _position = nextPosition;
26915 return true;
25298 } 26916 }
25299 return _array[_pos++]; 26917 _current = null;
26918 _position = _array.length;
26919 return false;
25300 } 26920 }
25301 26921
25302 final List<T> _array; 26922 T get current => _current;
25303 int _pos;
25304 } 26923 }
OLDNEW
« no previous file with comments | « sdk/lib/crypto/sha256.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698