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

Side by Side Diff: sdk/lib/html/dartium/html_dartium.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
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:nativewrappers'; 9 import 'dart:nativewrappers';
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 29 matching lines...) Expand all
47 List<Element> queryAll(String selector) => document.queryAll(selector); 48 List<Element> queryAll(String selector) => document.queryAll(selector);
48 49
49 int _getNewIsolateId() => _Utils._getNewIsolateId(); 50 int _getNewIsolateId() => _Utils._getNewIsolateId();
50 51
51 bool _callPortInitialized = false; 52 bool _callPortInitialized = false;
52 var _callPortLastResult = null; 53 var _callPortLastResult = null;
53 54
54 _callPortSync(num id, var message) { 55 _callPortSync(num id, var message) {
55 if (!_callPortInitialized) { 56 if (!_callPortInitialized) {
56 window.on['js-result'].add((event) { 57 window.on['js-result'].add((event) {
57 _callPortLastResult = JSON.parse(_getPortSyncEventData(event)); 58 _callPortLastResult = json.parse(_getPortSyncEventData(event));
58 }, false); 59 }, false);
59 _callPortInitialized = true; 60 _callPortInitialized = true;
60 } 61 }
61 assert(_callPortLastResult == null); 62 assert(_callPortLastResult == null);
62 _dispatchEvent('js-sync-message', {'id': id, 'message': message}); 63 _dispatchEvent('js-sync-message', {'id': id, 'message': message});
63 var result = _callPortLastResult; 64 var result = _callPortLastResult;
64 _callPortLastResult = null; 65 _callPortLastResult = null;
65 return result; 66 return result;
66 } 67 }
67 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 68 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
(...skipping 6988 matching lines...) Expand 10 before | Expand all | Expand 10 after
7056 * var items = document.queryAll('.itemClassName'); 7057 * var items = document.queryAll('.itemClassName');
7057 * 7058 *
7058 * For details about CSS selector syntax, see the 7059 * For details about CSS selector syntax, see the
7059 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/). 7060 * [CSS selector specification](http://www.w3.org/TR/css3-selectors/).
7060 */ 7061 */
7061 List<Element> queryAll(String selectors) { 7062 List<Element> queryAll(String selectors) {
7062 if (new RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) { 7063 if (new RegExp("""^\\[name=["'][^'"]+['"]\\]\$""").hasMatch(selectors)) {
7063 final mutableMatches = $dom_getElementsByName( 7064 final mutableMatches = $dom_getElementsByName(
7064 selectors.substring(7,selectors.length - 2)); 7065 selectors.substring(7,selectors.length - 2));
7065 int len = mutableMatches.length; 7066 int len = mutableMatches.length;
7066 final copyOfMatches = new List<Element>(len); 7067 final copyOfMatches = new List<Element>.fixedLength(len);
7067 for (int i = 0; i < len; ++i) { 7068 for (int i = 0; i < len; ++i) {
7068 copyOfMatches[i] = mutableMatches[i]; 7069 copyOfMatches[i] = mutableMatches[i];
7069 } 7070 }
7070 return new _FrozenElementList._wrap(copyOfMatches); 7071 return new _FrozenElementList._wrap(copyOfMatches);
7071 } else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) { 7072 } else if (new RegExp("^[*a-zA-Z0-9]+\$").hasMatch(selectors)) {
7072 final mutableMatches = $dom_getElementsByTagName(selectors); 7073 final mutableMatches = $dom_getElementsByTagName(selectors);
7073 int len = mutableMatches.length; 7074 int len = mutableMatches.length;
7074 final copyOfMatches = new List<Element>(len); 7075 final copyOfMatches = new List<Element>.fixedLength(len);
7075 for (int i = 0; i < len; ++i) { 7076 for (int i = 0; i < len; ++i) {
7076 copyOfMatches[i] = mutableMatches[i]; 7077 copyOfMatches[i] = mutableMatches[i];
7077 } 7078 }
7078 return new _FrozenElementList._wrap(copyOfMatches); 7079 return new _FrozenElementList._wrap(copyOfMatches);
7079 } else { 7080 } else {
7080 return new _FrozenElementList._wrap($dom_querySelectorAll(selectors)); 7081 return new _FrozenElementList._wrap($dom_querySelectorAll(selectors));
7081 } 7082 }
7082 } 7083 }
7083 } 7084 }
7084 7085
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
7591 DomMimeType operator[](int index) native "DOMMimeTypeArray_item_Callback"; 7592 DomMimeType operator[](int index) native "DOMMimeTypeArray_item_Callback";
7592 7593
7593 void operator[]=(int index, DomMimeType value) { 7594 void operator[]=(int index, DomMimeType value) {
7594 throw new UnsupportedError("Cannot assign element of immutable List."); 7595 throw new UnsupportedError("Cannot assign element of immutable List.");
7595 } 7596 }
7596 // -- start List<DomMimeType> mixins. 7597 // -- start List<DomMimeType> mixins.
7597 // DomMimeType is the element type. 7598 // DomMimeType is the element type.
7598 7599
7599 // From Iterable<DomMimeType>: 7600 // From Iterable<DomMimeType>:
7600 7601
7601 Iterator<DomMimeType> iterator() { 7602 Iterator<DomMimeType> get iterator {
7602 // Note: NodeLists are not fixed size. And most probably length shouldn't 7603 // Note: NodeLists are not fixed size. And most probably length shouldn't
7603 // be cached in both iterator _and_ forEach method. For now caching it 7604 // be cached in both iterator _and_ forEach method. For now caching it
7604 // for consistency. 7605 // for consistency.
7605 return new FixedSizeListIterator<DomMimeType>(this); 7606 return new FixedSizeListIterator<DomMimeType>(this);
7606 } 7607 }
7607 7608
7608 // From Collection<DomMimeType>:
7609
7610 void add(DomMimeType value) {
7611 throw new UnsupportedError("Cannot add to immutable List.");
7612 }
7613
7614 void addLast(DomMimeType value) {
7615 throw new UnsupportedError("Cannot add to immutable List.");
7616 }
7617
7618 void addAll(Collection<DomMimeType> collection) {
7619 throw new UnsupportedError("Cannot add to immutable List.");
7620 }
7621
7622 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomMimeType)) { 7609 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomMimeType)) {
7623 return Collections.reduce(this, initialValue, combine); 7610 return Collections.reduce(this, initialValue, combine);
7624 } 7611 }
7625 7612
7626 bool contains(DomMimeType element) => Collections.contains(this, element); 7613 bool contains(DomMimeType element) => Collections.contains(this, element);
7627 7614
7628 void forEach(void f(DomMimeType element)) => Collections.forEach(this, f); 7615 void forEach(void f(DomMimeType element)) => Collections.forEach(this, f);
7629 7616
7630 Collection map(f(DomMimeType element)) => Collections.map(this, [], f); 7617 String join([String separator]) => Collections.joinList(this, separator);
7631 7618
7632 Collection<DomMimeType> filter(bool f(DomMimeType element)) => 7619 List mappedBy(f(DomMimeType element)) => new MappedList<DomMimeType, dynamic>( this, f);
7633 Collections.filter(this, <DomMimeType>[], f); 7620
7621 Iterable<DomMimeType> where(bool f(DomMimeType element)) => new WhereIterable< DomMimeType>(this, f);
7634 7622
7635 bool every(bool f(DomMimeType element)) => Collections.every(this, f); 7623 bool every(bool f(DomMimeType element)) => Collections.every(this, f);
7636 7624
7637 bool some(bool f(DomMimeType element)) => Collections.some(this, f); 7625 bool any(bool f(DomMimeType element)) => Collections.any(this, f);
7638 7626
7639 bool get isEmpty => this.length == 0; 7627 bool get isEmpty => this.length == 0;
7640 7628
7629 List<DomMimeType> take(int n) => new ListView<DomMimeType>(this, 0, n);
7630
7631 Iterable<DomMimeType> takeWhile(bool test(DomMimeType value)) {
7632 return new TakeWhileIterable<DomMimeType>(this, test);
7633 }
7634
7635 List<DomMimeType> skip(int n) => new ListView<DomMimeType>(this, n, null);
7636
7637 Iterable<DomMimeType> skipWhile(bool test(DomMimeType value)) {
7638 return new SkipWhileIterable<DomMimeType>(this, test);
7639 }
7640
7641 DomMimeType firstMatching(bool test(DomMimeType value), { DomMimeType orElse() }) {
7642 return Collections.firstMatching(this, test, orElse);
7643 }
7644
7645 DomMimeType lastMatching(bool test(DomMimeType value), {DomMimeType orElse()}) {
7646 return Collections.lastMatchingInList(this, test, orElse);
7647 }
7648
7649 DomMimeType singleMatching(bool test(DomMimeType value)) {
7650 return Collections.singleMatching(this, test);
7651 }
7652
7653 DomMimeType elementAt(int index) {
7654 return this[index];
7655 }
7656
7657 // From Collection<DomMimeType>:
7658
7659 void add(DomMimeType value) {
7660 throw new UnsupportedError("Cannot add to immutable List.");
7661 }
7662
7663 void addLast(DomMimeType value) {
7664 throw new UnsupportedError("Cannot add to immutable List.");
7665 }
7666
7667 void addAll(Iterable<DomMimeType> iterable) {
7668 throw new UnsupportedError("Cannot add to immutable List.");
7669 }
7670
7641 // From List<DomMimeType>: 7671 // From List<DomMimeType>:
7642 void set length(int value) { 7672 void set length(int value) {
7643 throw new UnsupportedError("Cannot resize immutable List."); 7673 throw new UnsupportedError("Cannot resize immutable List.");
7644 } 7674 }
7645 7675
7646 void clear() { 7676 void clear() {
7647 throw new UnsupportedError("Cannot clear immutable List."); 7677 throw new UnsupportedError("Cannot clear immutable List.");
7648 } 7678 }
7649 7679
7650 void sort([int compare(DomMimeType a, DomMimeType b)]) { 7680 void sort([int compare(DomMimeType a, DomMimeType b)]) {
7651 throw new UnsupportedError("Cannot sort immutable List."); 7681 throw new UnsupportedError("Cannot sort immutable List.");
7652 } 7682 }
7653 7683
7654 int indexOf(DomMimeType element, [int start = 0]) => 7684 int indexOf(DomMimeType element, [int start = 0]) =>
7655 Lists.indexOf(this, element, start, this.length); 7685 Lists.indexOf(this, element, start, this.length);
7656 7686
7657 int lastIndexOf(DomMimeType element, [int start]) { 7687 int lastIndexOf(DomMimeType element, [int start]) {
7658 if (start == null) start = length - 1; 7688 if (start == null) start = length - 1;
7659 return Lists.lastIndexOf(this, element, start); 7689 return Lists.lastIndexOf(this, element, start);
7660 } 7690 }
7661 7691
7662 DomMimeType get first => this[0]; 7692 DomMimeType get first {
7693 if (this.length > 0) return this[0];
7694 throw new StateError("No elements");
7695 }
7663 7696
7664 DomMimeType get last => this[length - 1]; 7697 DomMimeType get last {
7698 if (this.length > 0) return this[this.length - 1];
7699 throw new StateError("No elements");
7700 }
7701
7702 DomMimeType get single {
7703 if (length == 1) return this[0];
7704 if (length == 0) throw new StateError("No elements");
7705 throw new StateError("More than one element");
7706 }
7707
7708 DomMimeType min([int compare(DomMimeType a, DomMimeType b)]) => _Collections.m inInList(this, compare);
7709
7710 DomMimeType max([int compare(DomMimeType a, DomMimeType b)]) => _Collections.m axInList(this, compare);
7665 7711
7666 DomMimeType removeAt(int pos) { 7712 DomMimeType removeAt(int pos) {
7667 throw new UnsupportedError("Cannot removeAt on immutable List."); 7713 throw new UnsupportedError("Cannot removeAt on immutable List.");
7668 } 7714 }
7669 7715
7670 DomMimeType removeLast() { 7716 DomMimeType removeLast() {
7671 throw new UnsupportedError("Cannot removeLast on immutable List."); 7717 throw new UnsupportedError("Cannot removeLast on immutable List.");
7672 } 7718 }
7673 7719
7674 void setRange(int start, int rangeLength, List<DomMimeType> from, [int startFr om]) { 7720 void setRange(int start, int rangeLength, List<DomMimeType> from, [int startFr om]) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
7771 DomPlugin operator[](int index) native "DOMPluginArray_item_Callback"; 7817 DomPlugin operator[](int index) native "DOMPluginArray_item_Callback";
7772 7818
7773 void operator[]=(int index, DomPlugin value) { 7819 void operator[]=(int index, DomPlugin value) {
7774 throw new UnsupportedError("Cannot assign element of immutable List."); 7820 throw new UnsupportedError("Cannot assign element of immutable List.");
7775 } 7821 }
7776 // -- start List<DomPlugin> mixins. 7822 // -- start List<DomPlugin> mixins.
7777 // DomPlugin is the element type. 7823 // DomPlugin is the element type.
7778 7824
7779 // From Iterable<DomPlugin>: 7825 // From Iterable<DomPlugin>:
7780 7826
7781 Iterator<DomPlugin> iterator() { 7827 Iterator<DomPlugin> get iterator {
7782 // Note: NodeLists are not fixed size. And most probably length shouldn't 7828 // Note: NodeLists are not fixed size. And most probably length shouldn't
7783 // be cached in both iterator _and_ forEach method. For now caching it 7829 // be cached in both iterator _and_ forEach method. For now caching it
7784 // for consistency. 7830 // for consistency.
7785 return new FixedSizeListIterator<DomPlugin>(this); 7831 return new FixedSizeListIterator<DomPlugin>(this);
7786 } 7832 }
7787 7833
7788 // From Collection<DomPlugin>:
7789
7790 void add(DomPlugin value) {
7791 throw new UnsupportedError("Cannot add to immutable List.");
7792 }
7793
7794 void addLast(DomPlugin value) {
7795 throw new UnsupportedError("Cannot add to immutable List.");
7796 }
7797
7798 void addAll(Collection<DomPlugin> collection) {
7799 throw new UnsupportedError("Cannot add to immutable List.");
7800 }
7801
7802 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomPlugin)) { 7834 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, DomPlugin)) {
7803 return Collections.reduce(this, initialValue, combine); 7835 return Collections.reduce(this, initialValue, combine);
7804 } 7836 }
7805 7837
7806 bool contains(DomPlugin element) => Collections.contains(this, element); 7838 bool contains(DomPlugin element) => Collections.contains(this, element);
7807 7839
7808 void forEach(void f(DomPlugin element)) => Collections.forEach(this, f); 7840 void forEach(void f(DomPlugin element)) => Collections.forEach(this, f);
7809 7841
7810 Collection map(f(DomPlugin element)) => Collections.map(this, [], f); 7842 String join([String separator]) => Collections.joinList(this, separator);
7811 7843
7812 Collection<DomPlugin> filter(bool f(DomPlugin element)) => 7844 List mappedBy(f(DomPlugin element)) => new MappedList<DomPlugin, dynamic>(this , f);
7813 Collections.filter(this, <DomPlugin>[], f); 7845
7846 Iterable<DomPlugin> where(bool f(DomPlugin element)) => new WhereIterable<DomP lugin>(this, f);
7814 7847
7815 bool every(bool f(DomPlugin element)) => Collections.every(this, f); 7848 bool every(bool f(DomPlugin element)) => Collections.every(this, f);
7816 7849
7817 bool some(bool f(DomPlugin element)) => Collections.some(this, f); 7850 bool any(bool f(DomPlugin element)) => Collections.any(this, f);
7818 7851
7819 bool get isEmpty => this.length == 0; 7852 bool get isEmpty => this.length == 0;
7820 7853
7854 List<DomPlugin> take(int n) => new ListView<DomPlugin>(this, 0, n);
7855
7856 Iterable<DomPlugin> takeWhile(bool test(DomPlugin value)) {
7857 return new TakeWhileIterable<DomPlugin>(this, test);
7858 }
7859
7860 List<DomPlugin> skip(int n) => new ListView<DomPlugin>(this, n, null);
7861
7862 Iterable<DomPlugin> skipWhile(bool test(DomPlugin value)) {
7863 return new SkipWhileIterable<DomPlugin>(this, test);
7864 }
7865
7866 DomPlugin firstMatching(bool test(DomPlugin value), { DomPlugin orElse() }) {
7867 return Collections.firstMatching(this, test, orElse);
7868 }
7869
7870 DomPlugin lastMatching(bool test(DomPlugin value), {DomPlugin orElse()}) {
7871 return Collections.lastMatchingInList(this, test, orElse);
7872 }
7873
7874 DomPlugin singleMatching(bool test(DomPlugin value)) {
7875 return Collections.singleMatching(this, test);
7876 }
7877
7878 DomPlugin elementAt(int index) {
7879 return this[index];
7880 }
7881
7882 // From Collection<DomPlugin>:
7883
7884 void add(DomPlugin value) {
7885 throw new UnsupportedError("Cannot add to immutable List.");
7886 }
7887
7888 void addLast(DomPlugin value) {
7889 throw new UnsupportedError("Cannot add to immutable List.");
7890 }
7891
7892 void addAll(Iterable<DomPlugin> iterable) {
7893 throw new UnsupportedError("Cannot add to immutable List.");
7894 }
7895
7821 // From List<DomPlugin>: 7896 // From List<DomPlugin>:
7822 void set length(int value) { 7897 void set length(int value) {
7823 throw new UnsupportedError("Cannot resize immutable List."); 7898 throw new UnsupportedError("Cannot resize immutable List.");
7824 } 7899 }
7825 7900
7826 void clear() { 7901 void clear() {
7827 throw new UnsupportedError("Cannot clear immutable List."); 7902 throw new UnsupportedError("Cannot clear immutable List.");
7828 } 7903 }
7829 7904
7830 void sort([int compare(DomPlugin a, DomPlugin b)]) { 7905 void sort([int compare(DomPlugin a, DomPlugin b)]) {
7831 throw new UnsupportedError("Cannot sort immutable List."); 7906 throw new UnsupportedError("Cannot sort immutable List.");
7832 } 7907 }
7833 7908
7834 int indexOf(DomPlugin element, [int start = 0]) => 7909 int indexOf(DomPlugin element, [int start = 0]) =>
7835 Lists.indexOf(this, element, start, this.length); 7910 Lists.indexOf(this, element, start, this.length);
7836 7911
7837 int lastIndexOf(DomPlugin element, [int start]) { 7912 int lastIndexOf(DomPlugin element, [int start]) {
7838 if (start == null) start = length - 1; 7913 if (start == null) start = length - 1;
7839 return Lists.lastIndexOf(this, element, start); 7914 return Lists.lastIndexOf(this, element, start);
7840 } 7915 }
7841 7916
7842 DomPlugin get first => this[0]; 7917 DomPlugin get first {
7918 if (this.length > 0) return this[0];
7919 throw new StateError("No elements");
7920 }
7843 7921
7844 DomPlugin get last => this[length - 1]; 7922 DomPlugin get last {
7923 if (this.length > 0) return this[this.length - 1];
7924 throw new StateError("No elements");
7925 }
7926
7927 DomPlugin get single {
7928 if (length == 1) return this[0];
7929 if (length == 0) throw new StateError("No elements");
7930 throw new StateError("More than one element");
7931 }
7932
7933 DomPlugin min([int compare(DomPlugin a, DomPlugin b)]) => _Collections.minInLi st(this, compare);
7934
7935 DomPlugin max([int compare(DomPlugin a, DomPlugin b)]) => _Collections.maxInLi st(this, compare);
7845 7936
7846 DomPlugin removeAt(int pos) { 7937 DomPlugin removeAt(int pos) {
7847 throw new UnsupportedError("Cannot removeAt on immutable List."); 7938 throw new UnsupportedError("Cannot removeAt on immutable List.");
7848 } 7939 }
7849 7940
7850 DomPlugin removeLast() { 7941 DomPlugin removeLast() {
7851 throw new UnsupportedError("Cannot removeLast on immutable List."); 7942 throw new UnsupportedError("Cannot removeLast on immutable List.");
7852 } 7943 }
7853 7944
7854 void setRange(int start, int rangeLength, List<DomPlugin> from, [int startFrom ]) { 7945 void setRange(int start, int rangeLength, List<DomPlugin> from, [int startFrom ]) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
8035 String operator[](int index) native "DOMStringList_item_Callback"; 8126 String operator[](int index) native "DOMStringList_item_Callback";
8036 8127
8037 void operator[]=(int index, String value) { 8128 void operator[]=(int index, String value) {
8038 throw new UnsupportedError("Cannot assign element of immutable List."); 8129 throw new UnsupportedError("Cannot assign element of immutable List.");
8039 } 8130 }
8040 // -- start List<String> mixins. 8131 // -- start List<String> mixins.
8041 // String is the element type. 8132 // String is the element type.
8042 8133
8043 // From Iterable<String>: 8134 // From Iterable<String>:
8044 8135
8045 Iterator<String> iterator() { 8136 Iterator<String> get iterator {
8046 // Note: NodeLists are not fixed size. And most probably length shouldn't 8137 // Note: NodeLists are not fixed size. And most probably length shouldn't
8047 // be cached in both iterator _and_ forEach method. For now caching it 8138 // be cached in both iterator _and_ forEach method. For now caching it
8048 // for consistency. 8139 // for consistency.
8049 return new FixedSizeListIterator<String>(this); 8140 return new FixedSizeListIterator<String>(this);
8050 } 8141 }
8051 8142
8052 // From Collection<String>:
8053
8054 void add(String value) {
8055 throw new UnsupportedError("Cannot add to immutable List.");
8056 }
8057
8058 void addLast(String value) {
8059 throw new UnsupportedError("Cannot add to immutable List.");
8060 }
8061
8062 void addAll(Collection<String> collection) {
8063 throw new UnsupportedError("Cannot add to immutable List.");
8064 }
8065
8066 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) { 8143 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, String)) {
8067 return Collections.reduce(this, initialValue, combine); 8144 return Collections.reduce(this, initialValue, combine);
8068 } 8145 }
8069 8146
8070 // contains() defined by IDL. 8147 // contains() defined by IDL.
8071 8148
8072 void forEach(void f(String element)) => Collections.forEach(this, f); 8149 void forEach(void f(String element)) => Collections.forEach(this, f);
8073 8150
8074 Collection map(f(String element)) => Collections.map(this, [], f); 8151 String join([String separator]) => Collections.joinList(this, separator);
8075 8152
8076 Collection<String> filter(bool f(String element)) => 8153 List mappedBy(f(String element)) => new MappedList<String, dynamic>(this, f);
8077 Collections.filter(this, <String>[], f); 8154
8155 Iterable<String> where(bool f(String element)) => new WhereIterable<String>(th is, f);
8078 8156
8079 bool every(bool f(String element)) => Collections.every(this, f); 8157 bool every(bool f(String element)) => Collections.every(this, f);
8080 8158
8081 bool some(bool f(String element)) => Collections.some(this, f); 8159 bool any(bool f(String element)) => Collections.any(this, f);
8082 8160
8083 bool get isEmpty => this.length == 0; 8161 bool get isEmpty => this.length == 0;
8084 8162
8163 List<String> take(int n) => new ListView<String>(this, 0, n);
8164
8165 Iterable<String> takeWhile(bool test(String value)) {
8166 return new TakeWhileIterable<String>(this, test);
8167 }
8168
8169 List<String> skip(int n) => new ListView<String>(this, n, null);
8170
8171 Iterable<String> skipWhile(bool test(String value)) {
8172 return new SkipWhileIterable<String>(this, test);
8173 }
8174
8175 String firstMatching(bool test(String value), { String orElse() }) {
8176 return Collections.firstMatching(this, test, orElse);
8177 }
8178
8179 String lastMatching(bool test(String value), {String orElse()}) {
8180 return Collections.lastMatchingInList(this, test, orElse);
8181 }
8182
8183 String singleMatching(bool test(String value)) {
8184 return Collections.singleMatching(this, test);
8185 }
8186
8187 String elementAt(int index) {
8188 return this[index];
8189 }
8190
8191 // From Collection<String>:
8192
8193 void add(String value) {
8194 throw new UnsupportedError("Cannot add to immutable List.");
8195 }
8196
8197 void addLast(String value) {
8198 throw new UnsupportedError("Cannot add to immutable List.");
8199 }
8200
8201 void addAll(Iterable<String> iterable) {
8202 throw new UnsupportedError("Cannot add to immutable List.");
8203 }
8204
8085 // From List<String>: 8205 // From List<String>:
8086 void set length(int value) { 8206 void set length(int value) {
8087 throw new UnsupportedError("Cannot resize immutable List."); 8207 throw new UnsupportedError("Cannot resize immutable List.");
8088 } 8208 }
8089 8209
8090 void clear() { 8210 void clear() {
8091 throw new UnsupportedError("Cannot clear immutable List."); 8211 throw new UnsupportedError("Cannot clear immutable List.");
8092 } 8212 }
8093 8213
8094 void sort([int compare(String a, String b)]) { 8214 void sort([int compare(String a, String b)]) {
8095 throw new UnsupportedError("Cannot sort immutable List."); 8215 throw new UnsupportedError("Cannot sort immutable List.");
8096 } 8216 }
8097 8217
8098 int indexOf(String element, [int start = 0]) => 8218 int indexOf(String element, [int start = 0]) =>
8099 Lists.indexOf(this, element, start, this.length); 8219 Lists.indexOf(this, element, start, this.length);
8100 8220
8101 int lastIndexOf(String element, [int start]) { 8221 int lastIndexOf(String element, [int start]) {
8102 if (start == null) start = length - 1; 8222 if (start == null) start = length - 1;
8103 return Lists.lastIndexOf(this, element, start); 8223 return Lists.lastIndexOf(this, element, start);
8104 } 8224 }
8105 8225
8106 String get first => this[0]; 8226 String get first {
8227 if (this.length > 0) return this[0];
8228 throw new StateError("No elements");
8229 }
8107 8230
8108 String get last => this[length - 1]; 8231 String get last {
8232 if (this.length > 0) return this[this.length - 1];
8233 throw new StateError("No elements");
8234 }
8235
8236 String get single {
8237 if (length == 1) return this[0];
8238 if (length == 0) throw new StateError("No elements");
8239 throw new StateError("More than one element");
8240 }
8241
8242 String min([int compare(String a, String b)]) => _Collections.minInList(this, compare);
8243
8244 String max([int compare(String a, String b)]) => _Collections.maxInList(this, compare);
8109 8245
8110 String removeAt(int pos) { 8246 String removeAt(int pos) {
8111 throw new UnsupportedError("Cannot removeAt on immutable List."); 8247 throw new UnsupportedError("Cannot removeAt on immutable List.");
8112 } 8248 }
8113 8249
8114 String removeLast() { 8250 String removeLast() {
8115 throw new UnsupportedError("Cannot removeLast on immutable List."); 8251 throw new UnsupportedError("Cannot removeLast on immutable List.");
8116 } 8252 }
8117 8253
8118 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) { 8254 void setRange(int start, int rangeLength, List<String> from, [int startFrom]) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
8205 // functionality. 8341 // functionality.
8206 class _ChildrenElementList implements List { 8342 class _ChildrenElementList implements List {
8207 // Raw Element. 8343 // Raw Element.
8208 final Element _element; 8344 final Element _element;
8209 final HtmlCollection _childElements; 8345 final HtmlCollection _childElements;
8210 8346
8211 _ChildrenElementList._wrap(Element element) 8347 _ChildrenElementList._wrap(Element element)
8212 : _childElements = element.$dom_children, 8348 : _childElements = element.$dom_children,
8213 _element = element; 8349 _element = element;
8214 8350
8215 List<Element> _toList() { 8351 List<Element> toList() {
8216 final output = new List(_childElements.length); 8352 final output = new List<Element>.fixedLength(_childElements.length);
8217 for (int i = 0, len = _childElements.length; i < len; i++) { 8353 for (int i = 0, len = _childElements.length; i < len; i++) {
8218 output[i] = _childElements[i]; 8354 output[i] = _childElements[i];
8219 } 8355 }
8220 return output; 8356 return output;
8221 } 8357 }
8222 8358
8359 Set<Element> toSet() {
8360 final output = new Set<Element>(_childElements.length);
8361 for (int i = 0, len = _childElements.length; i < len; i++) {
8362 output.add(_childElements[i]);
8363 }
8364 return output;
8365 }
8366
8223 bool contains(Element element) => _childElements.contains(element); 8367 bool contains(Element element) => _childElements.contains(element);
8224 8368
8225 void forEach(void f(Element element)) { 8369 void forEach(void f(Element element)) {
8226 for (Element element in _childElements) { 8370 for (Element element in _childElements) {
8227 f(element); 8371 f(element);
8228 } 8372 }
8229 } 8373 }
8230 8374
8231 List<Element> filter(bool f(Element element)) {
8232 final output = [];
8233 forEach((Element element) {
8234 if (f(element)) {
8235 output.add(element);
8236 }
8237 });
8238 return new _FrozenElementList._wrap(output);
8239 }
8240
8241 bool every(bool f(Element element)) { 8375 bool every(bool f(Element element)) {
8242 for (Element element in this) { 8376 for (Element element in this) {
8243 if (!f(element)) { 8377 if (!f(element)) {
8244 return false; 8378 return false;
8245 } 8379 }
8246 }; 8380 }
8247 return true; 8381 return true;
8248 } 8382 }
8249 8383
8250 bool some(bool f(Element element)) { 8384 bool any(bool f(Element element)) {
8251 for (Element element in this) { 8385 for (Element element in this) {
8252 if (f(element)) { 8386 if (f(element)) {
8253 return true; 8387 return true;
8254 } 8388 }
8255 }; 8389 }
8256 return false; 8390 return false;
8257 } 8391 }
8258 8392
8259 Collection map(f(Element element)) { 8393 String join([String separator]) {
8260 final out = []; 8394 return Collections.joinList(this, separator);
8261 for (Element el in this) {
8262 out.add(f(el));
8263 }
8264 return out;
8265 } 8395 }
8266 8396
8397 List mappedBy(f(Element element)) {
8398 return new MappedList<Element, dynamic>(this, f);
8399 }
8400
8401 Iterable<Element> where(bool f(Element element))
8402 => new WhereIterable<Element>(this, f);
8403
8267 bool get isEmpty { 8404 bool get isEmpty {
8268 return _element.$dom_firstElementChild == null; 8405 return _element.$dom_firstElementChild == null;
8269 } 8406 }
8270 8407
8408 List<Element> take(int n) {
8409 return new ListView<Element>(this, 0, n);
8410 }
8411
8412 Iterable<Element> takeWhile(bool test(Element value)) {
8413 return new TakeWhileIterable<Element>(this, test);
8414 }
8415
8416 List<Element> skip(int n) {
8417 return new ListView<Element>(this, n, null);
8418 }
8419
8420 Iterable<Element> skipWhile(bool test(Element value)) {
8421 return new SkipWhileIterable<Element>(this, test);
8422 }
8423
8424 Element firstMatching(bool test(Element value), {Element orElse()}) {
8425 return Collections.firstMatching(this, test, orElse);
8426 }
8427
8428 Element lastMatching(bool test(Element value), {Element orElse()}) {
8429 return Collections.lastMatchingInList(this, test, orElse);
8430 }
8431
8432 Element singleMatching(bool test(Element value)) {
8433 return Collections.singleMatching(this, test);
8434 }
8435
8436 Element elementAt(int index) {
8437 return this[index];
8438 }
8439
8271 int get length { 8440 int get length {
8272 return _childElements.length; 8441 return _childElements.length;
8273 } 8442 }
8274 8443
8275 Element operator [](int index) { 8444 Element operator [](int index) {
8276 return _childElements[index]; 8445 return _childElements[index];
8277 } 8446 }
8278 8447
8279 void operator []=(int index, Element value) { 8448 void operator []=(int index, Element value) {
8280 _element.$dom_replaceChild(value, _childElements[index]); 8449 _element.$dom_replaceChild(value, _childElements[index]);
8281 } 8450 }
8282 8451
8283 void set length(int newLength) { 8452 void set length(int newLength) {
8284 // TODO(jacobr): remove children when length is reduced. 8453 // TODO(jacobr): remove children when length is reduced.
8285 throw new UnsupportedError(''); 8454 throw new UnsupportedError('');
8286 } 8455 }
8287 8456
8288 Element add(Element value) { 8457 Element add(Element value) {
8289 _element.$dom_appendChild(value); 8458 _element.$dom_appendChild(value);
8290 return value; 8459 return value;
8291 } 8460 }
8292 8461
8293 Element addLast(Element value) => add(value); 8462 Element addLast(Element value) => add(value);
8294 8463
8295 Iterator<Element> iterator() => _toList().iterator(); 8464 Iterator<Element> get iterator => toList().iterator;
8296 8465
8297 void addAll(Collection<Element> collection) { 8466 void addAll(Iterable<Element> iterable) {
8298 for (Element element in collection) { 8467 for (Element element in iterable) {
8299 _element.$dom_appendChild(element); 8468 _element.$dom_appendChild(element);
8300 } 8469 }
8301 } 8470 }
8302 8471
8303 void sort([int compare(Element a, Element b)]) { 8472 void sort([int compare(Element a, Element b)]) {
8304 throw new UnsupportedError('TODO(jacobr): should we impl?'); 8473 throw new UnsupportedError('TODO(jacobr): should we impl?');
8305 } 8474 }
8306 8475
8307 dynamic reduce(dynamic initialValue, 8476 dynamic reduce(dynamic initialValue,
8308 dynamic combine(dynamic previousValue, Element element)) { 8477 dynamic combine(dynamic previousValue, Element element)) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
8349 8518
8350 Element removeLast() { 8519 Element removeLast() {
8351 final result = this.last; 8520 final result = this.last;
8352 if (result != null) { 8521 if (result != null) {
8353 _element.$dom_removeChild(result); 8522 _element.$dom_removeChild(result);
8354 } 8523 }
8355 return result; 8524 return result;
8356 } 8525 }
8357 8526
8358 Element get first { 8527 Element get first {
8359 return _element.$dom_firstElementChild; 8528 Element result = _element.$dom_firstElementChild;
8529 if (result == null) throw new StateError("No elements");
8530 return result;
8360 } 8531 }
8361 8532
8362 8533
8363 Element get last { 8534 Element get last {
8364 return _element.$dom_lastElementChild; 8535 Element result = _element.$dom_lastElementChild;
8536 if (result == null) throw new StateError("No elements");
8537 return result;
8538 }
8539
8540 Element get single {
8541 if (length > 1) throw new StateError("More than one element");
8542 return first;
8543 }
8544
8545 Element min([int compare(Element a, Element b)]) {
8546 return _Collections.minInList(this, compare);
8547 }
8548
8549 Element max([int compare(Element a, Element b)]) {
8550 return _Collections.maxInList(this, compare);
8365 } 8551 }
8366 } 8552 }
8367 8553
8368 // TODO(jacobr): this is an inefficient implementation but it is hard to see 8554 // TODO(jacobr): this is an inefficient implementation but it is hard to see
8369 // a better option given that we cannot quite force NodeList to be an 8555 // a better option given that we cannot quite force NodeList to be an
8370 // ElementList as there are valid cases where a NodeList JavaScript object 8556 // ElementList as there are valid cases where a NodeList JavaScript object
8371 // contains Node objects that are not Elements. 8557 // contains Node objects that are not Elements.
8372 class _FrozenElementList implements List { 8558 class _FrozenElementList implements List {
8373 final List<Node> _nodeList; 8559 final List<Node> _nodeList;
8374 8560
8375 _FrozenElementList._wrap(this._nodeList); 8561 _FrozenElementList._wrap(this._nodeList);
8376 8562
8377 bool contains(Element element) { 8563 bool contains(Element element) {
8378 for (Element el in this) { 8564 for (Element el in this) {
8379 if (el == element) return true; 8565 if (el == element) return true;
8380 } 8566 }
8381 return false; 8567 return false;
8382 } 8568 }
8383 8569
8384 void forEach(void f(Element element)) { 8570 void forEach(void f(Element element)) {
8385 for (Element el in this) { 8571 for (Element el in this) {
8386 f(el); 8572 f(el);
8387 } 8573 }
8388 } 8574 }
8389 8575
8390 Collection map(f(Element element)) { 8576 String join([String separator]) {
8391 final out = []; 8577 return Collections.joinList(this, separator);
8392 for (Element el in this) {
8393 out.add(f(el));
8394 }
8395 return out;
8396 } 8578 }
8397 8579
8398 List<Element> filter(bool f(Element element)) { 8580 List mappedBy(f(Element element)) {
8399 final out = []; 8581 return new MappedList<Element, dynamic>(this, f);
8400 for (Element el in this) {
8401 if (f(el)) out.add(el);
8402 }
8403 return out;
8404 } 8582 }
8405 8583
8584 Iterable<Element> where(bool f(Element element))
8585 => new WhereIterable<Element>(this, f);
8586
8406 bool every(bool f(Element element)) { 8587 bool every(bool f(Element element)) {
8407 for(Element element in this) { 8588 for(Element element in this) {
8408 if (!f(element)) { 8589 if (!f(element)) {
8409 return false; 8590 return false;
8410 } 8591 }
8411 }; 8592 };
8412 return true; 8593 return true;
8413 } 8594 }
8414 8595
8415 bool some(bool f(Element element)) { 8596 bool any(bool f(Element element)) {
8416 for(Element element in this) { 8597 for(Element element in this) {
8417 if (f(element)) { 8598 if (f(element)) {
8418 return true; 8599 return true;
8419 } 8600 }
8420 }; 8601 };
8421 return false; 8602 return false;
8422 } 8603 }
8423 8604
8605 List<Element> take(int n) {
8606 return new ListView<Element>(this, 0, n);
8607 }
8608
8609 Iterable<Element> takeWhile(bool test(T value)) {
8610 return new TakeWhileIterable<Element>(this, test);
8611 }
8612
8613 List<Element> skip(int n) {
8614 return new ListView<Element>(this, n, null);
8615 }
8616
8617 Iterable<Element> skipWhile(bool test(T value)) {
8618 return new SkipWhileIterable<Element>(this, test);
8619 }
8620
8621 Element firstMatching(bool test(Element value), {Element orElse()}) {
8622 return Collections.firstMatching(this, test, orElse);
8623 }
8624
8625 Element lastMatching(bool test(Element value), {Element orElse()}) {
8626 return Collections.lastMatchingInList(this, test, orElse);
8627 }
8628
8629 Element singleMatching(bool test(Element value)) {
8630 return Collections.singleMatching(this, test);
8631 }
8632
8633 Element elementAt(int index) {
8634 return this[index];
8635 }
8636
8424 bool get isEmpty => _nodeList.isEmpty; 8637 bool get isEmpty => _nodeList.isEmpty;
8425 8638
8426 int get length => _nodeList.length; 8639 int get length => _nodeList.length;
8427 8640
8428 Element operator [](int index) => _nodeList[index]; 8641 Element operator [](int index) => _nodeList[index];
8429 8642
8430 void operator []=(int index, Element value) { 8643 void operator []=(int index, Element value) {
8431 throw new UnsupportedError(''); 8644 throw new UnsupportedError('');
8432 } 8645 }
8433 8646
8434 void set length(int newLength) { 8647 void set length(int newLength) {
8435 _nodeList.length = newLength; 8648 _nodeList.length = newLength;
8436 } 8649 }
8437 8650
8438 void add(Element value) { 8651 void add(Element value) {
8439 throw new UnsupportedError(''); 8652 throw new UnsupportedError('');
8440 } 8653 }
8441 8654
8442 void addLast(Element value) { 8655 void addLast(Element value) {
8443 throw new UnsupportedError(''); 8656 throw new UnsupportedError('');
8444 } 8657 }
8445 8658
8446 Iterator<Element> iterator() => new _FrozenElementListIterator(this); 8659 Iterator<Element> get iterator => new _FrozenElementListIterator(this);
8447 8660
8448 void addAll(Collection<Element> collection) { 8661 void addAll(Iterable<Element> iterable) {
8449 throw new UnsupportedError(''); 8662 throw new UnsupportedError('');
8450 } 8663 }
8451 8664
8452 void sort([int compare(Element a, Element b)]) { 8665 void sort([int compare(Element a, Element b)]) {
8453 throw new UnsupportedError(''); 8666 throw new UnsupportedError('');
8454 } 8667 }
8455 8668
8456 dynamic reduce(dynamic initialValue, 8669 dynamic reduce(dynamic initialValue,
8457 dynamic combine(dynamic previousValue, Element element)) { 8670 dynamic combine(dynamic previousValue, Element element)) {
8458 return Collections.reduce(this, initialValue, combine); 8671 return Collections.reduce(this, initialValue, combine);
(...skipping 28 matching lines...) Expand all
8487 throw new UnsupportedError(''); 8700 throw new UnsupportedError('');
8488 } 8701 }
8489 8702
8490 Element removeLast() { 8703 Element removeLast() {
8491 throw new UnsupportedError(''); 8704 throw new UnsupportedError('');
8492 } 8705 }
8493 8706
8494 Element get first => _nodeList.first; 8707 Element get first => _nodeList.first;
8495 8708
8496 Element get last => _nodeList.last; 8709 Element get last => _nodeList.last;
8710
8711 Element get single => _nodeList.single;
8712
8713 Element min([int compare(Element a, Element b)]) {
8714 return _Collections.minInList(this, compare);
8715 }
8716
8717 Element max([int compare(Element a, Element b)]) {
8718 return _Collections.maxInList(this, compare);
8719 }
8497 } 8720 }
8498 8721
8499 class _FrozenElementListIterator implements Iterator<Element> { 8722 class _FrozenElementListIterator implements Iterator<Element> {
8500 final _FrozenElementList _list; 8723 final _FrozenElementList _list;
8501 int _index = 0; 8724 int _index = 0;
8502 8725
8503 _FrozenElementListIterator(this._list); 8726 _FrozenElementListIterator(this._list);
8504 8727
8505 /** 8728 /**
8506 * Gets the next element in the iteration. Throws a 8729 * Moves to the next element. Returns true if the iterator is positioned
8507 * [StateError("No more elements")] if no element is left. 8730 * at an element. Returns false if it is positioned after the last element.
8508 */ 8731 */
8509 Element next() { 8732 bool moveNext() {
8510 if (!hasNext) { 8733 int nextIndex = _index + 1;
8511 throw new StateError("No more elements"); 8734 if (nextIndex < _list.length) {
8735 _current = _list[nextIndex];
8736 _index = nextIndex;
8737 return true;
8512 } 8738 }
8513 8739 _index = _list.length;
8514 return _list[_index++]; 8740 _current = null;
8741 return false;
8515 } 8742 }
8516 8743
8517 /** 8744 /**
8518 * Returns whether the [Iterator] has elements left. 8745 * Returns the element the [Iterator] is positioned at.
8746 *
8747 * Return [:null:] if the iterator is positioned before the first, or
8748 * after the last element.
8519 */ 8749 */
8520 bool get hasNext => _index < _list.length; 8750 E get current => _current;
8521 } 8751 }
8522 8752
8523 class _ElementCssClassSet extends CssClassSet { 8753 class _ElementCssClassSet extends CssClassSet {
8524 8754
8525 final Element _element; 8755 final Element _element;
8526 8756
8527 _ElementCssClassSet(this._element); 8757 _ElementCssClassSet(this._element);
8528 8758
8529 Set<String> readClasses() { 8759 Set<String> readClasses() {
8530 var s = new Set<String>(); 8760 var s = new Set<String>();
8531 var classname = _element.$dom_className; 8761 var classname = _element.$dom_className;
8532 8762
8533 for (String name in classname.split(' ')) { 8763 for (String name in classname.split(' ')) {
8534 String trimmed = name.trim(); 8764 String trimmed = name.trim();
8535 if (!trimmed.isEmpty) { 8765 if (!trimmed.isEmpty) {
8536 s.add(trimmed); 8766 s.add(trimmed);
8537 } 8767 }
8538 } 8768 }
8539 return s; 8769 return s;
8540 } 8770 }
8541 8771
8542 void writeClasses(Set<String> s) { 8772 void writeClasses(Set<String> s) {
8543 List list = new List.from(s); 8773 List list = new List.from(s);
8544 _element.$dom_className = Strings.join(list, ' '); 8774 _element.$dom_className = s.join(' ');
8545 } 8775 }
8546 } 8776 }
8547 8777
8548 /** 8778 /**
8549 * An abstract class, which all HTML elements extend. 8779 * An abstract class, which all HTML elements extend.
8550 */ 8780 */
8551 abstract class Element extends Node implements ElementTraversal { 8781 abstract class Element extends Node implements ElementTraversal {
8552 8782
8553 /** 8783 /**
8554 * Creates an HTML element from a valid fragment of HTML. 8784 * Creates an HTML element from a valid fragment of HTML.
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
10201 File operator[](int index) native "FileList_item_Callback"; 10431 File operator[](int index) native "FileList_item_Callback";
10202 10432
10203 void operator[]=(int index, File value) { 10433 void operator[]=(int index, File value) {
10204 throw new UnsupportedError("Cannot assign element of immutable List."); 10434 throw new UnsupportedError("Cannot assign element of immutable List.");
10205 } 10435 }
10206 // -- start List<File> mixins. 10436 // -- start List<File> mixins.
10207 // File is the element type. 10437 // File is the element type.
10208 10438
10209 // From Iterable<File>: 10439 // From Iterable<File>:
10210 10440
10211 Iterator<File> iterator() { 10441 Iterator<File> get iterator {
10212 // Note: NodeLists are not fixed size. And most probably length shouldn't 10442 // Note: NodeLists are not fixed size. And most probably length shouldn't
10213 // be cached in both iterator _and_ forEach method. For now caching it 10443 // be cached in both iterator _and_ forEach method. For now caching it
10214 // for consistency. 10444 // for consistency.
10215 return new FixedSizeListIterator<File>(this); 10445 return new FixedSizeListIterator<File>(this);
10216 } 10446 }
10217 10447
10218 // From Collection<File>:
10219
10220 void add(File value) {
10221 throw new UnsupportedError("Cannot add to immutable List.");
10222 }
10223
10224 void addLast(File value) {
10225 throw new UnsupportedError("Cannot add to immutable List.");
10226 }
10227
10228 void addAll(Collection<File> collection) {
10229 throw new UnsupportedError("Cannot add to immutable List.");
10230 }
10231
10232 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, File)) { 10448 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, File)) {
10233 return Collections.reduce(this, initialValue, combine); 10449 return Collections.reduce(this, initialValue, combine);
10234 } 10450 }
10235 10451
10236 bool contains(File element) => Collections.contains(this, element); 10452 bool contains(File element) => Collections.contains(this, element);
10237 10453
10238 void forEach(void f(File element)) => Collections.forEach(this, f); 10454 void forEach(void f(File element)) => Collections.forEach(this, f);
10239 10455
10240 Collection map(f(File element)) => Collections.map(this, [], f); 10456 String join([String separator]) => Collections.joinList(this, separator);
10241 10457
10242 Collection<File> filter(bool f(File element)) => 10458 List mappedBy(f(File element)) => new MappedList<File, dynamic>(this, f);
10243 Collections.filter(this, <File>[], f); 10459
10460 Iterable<File> where(bool f(File element)) => new WhereIterable<File>(this, f) ;
10244 10461
10245 bool every(bool f(File element)) => Collections.every(this, f); 10462 bool every(bool f(File element)) => Collections.every(this, f);
10246 10463
10247 bool some(bool f(File element)) => Collections.some(this, f); 10464 bool any(bool f(File element)) => Collections.any(this, f);
10248 10465
10249 bool get isEmpty => this.length == 0; 10466 bool get isEmpty => this.length == 0;
10250 10467
10468 List<File> take(int n) => new ListView<File>(this, 0, n);
10469
10470 Iterable<File> takeWhile(bool test(File value)) {
10471 return new TakeWhileIterable<File>(this, test);
10472 }
10473
10474 List<File> skip(int n) => new ListView<File>(this, n, null);
10475
10476 Iterable<File> skipWhile(bool test(File value)) {
10477 return new SkipWhileIterable<File>(this, test);
10478 }
10479
10480 File firstMatching(bool test(File value), { File orElse() }) {
10481 return Collections.firstMatching(this, test, orElse);
10482 }
10483
10484 File lastMatching(bool test(File value), {File orElse()}) {
10485 return Collections.lastMatchingInList(this, test, orElse);
10486 }
10487
10488 File singleMatching(bool test(File value)) {
10489 return Collections.singleMatching(this, test);
10490 }
10491
10492 File elementAt(int index) {
10493 return this[index];
10494 }
10495
10496 // From Collection<File>:
10497
10498 void add(File value) {
10499 throw new UnsupportedError("Cannot add to immutable List.");
10500 }
10501
10502 void addLast(File value) {
10503 throw new UnsupportedError("Cannot add to immutable List.");
10504 }
10505
10506 void addAll(Iterable<File> iterable) {
10507 throw new UnsupportedError("Cannot add to immutable List.");
10508 }
10509
10251 // From List<File>: 10510 // From List<File>:
10252 void set length(int value) { 10511 void set length(int value) {
10253 throw new UnsupportedError("Cannot resize immutable List."); 10512 throw new UnsupportedError("Cannot resize immutable List.");
10254 } 10513 }
10255 10514
10256 void clear() { 10515 void clear() {
10257 throw new UnsupportedError("Cannot clear immutable List."); 10516 throw new UnsupportedError("Cannot clear immutable List.");
10258 } 10517 }
10259 10518
10260 void sort([int compare(File a, File b)]) { 10519 void sort([int compare(File a, File b)]) {
10261 throw new UnsupportedError("Cannot sort immutable List."); 10520 throw new UnsupportedError("Cannot sort immutable List.");
10262 } 10521 }
10263 10522
10264 int indexOf(File element, [int start = 0]) => 10523 int indexOf(File element, [int start = 0]) =>
10265 Lists.indexOf(this, element, start, this.length); 10524 Lists.indexOf(this, element, start, this.length);
10266 10525
10267 int lastIndexOf(File element, [int start]) { 10526 int lastIndexOf(File element, [int start]) {
10268 if (start == null) start = length - 1; 10527 if (start == null) start = length - 1;
10269 return Lists.lastIndexOf(this, element, start); 10528 return Lists.lastIndexOf(this, element, start);
10270 } 10529 }
10271 10530
10272 File get first => this[0]; 10531 File get first {
10532 if (this.length > 0) return this[0];
10533 throw new StateError("No elements");
10534 }
10273 10535
10274 File get last => this[length - 1]; 10536 File get last {
10537 if (this.length > 0) return this[this.length - 1];
10538 throw new StateError("No elements");
10539 }
10540
10541 File get single {
10542 if (length == 1) return this[0];
10543 if (length == 0) throw new StateError("No elements");
10544 throw new StateError("More than one element");
10545 }
10546
10547 File min([int compare(File a, File b)]) => _Collections.minInList(this, compar e);
10548
10549 File max([int compare(File a, File b)]) => _Collections.maxInList(this, compar e);
10275 10550
10276 File removeAt(int pos) { 10551 File removeAt(int pos) {
10277 throw new UnsupportedError("Cannot removeAt on immutable List."); 10552 throw new UnsupportedError("Cannot removeAt on immutable List.");
10278 } 10553 }
10279 10554
10280 File removeLast() { 10555 File removeLast() {
10281 throw new UnsupportedError("Cannot removeLast on immutable List."); 10556 throw new UnsupportedError("Cannot removeLast on immutable List.");
10282 } 10557 }
10283 10558
10284 void setRange(int start, int rangeLength, List<File> from, [int startFrom]) { 10559 void setRange(int start, int rangeLength, List<File> from, [int startFrom]) {
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
10661 num operator[](int index) native "Float32Array_numericIndexGetter_Callback"; 10936 num operator[](int index) native "Float32Array_numericIndexGetter_Callback";
10662 10937
10663 10938
10664 /** @domName Float32Array.numericIndexSetter */ 10939 /** @domName Float32Array.numericIndexSetter */
10665 void operator[]=(int index, num value) native "Float32Array_numericIndexSetter _Callback"; 10940 void operator[]=(int index, num value) native "Float32Array_numericIndexSetter _Callback";
10666 // -- start List<num> mixins. 10941 // -- start List<num> mixins.
10667 // num is the element type. 10942 // num is the element type.
10668 10943
10669 // From Iterable<num>: 10944 // From Iterable<num>:
10670 10945
10671 Iterator<num> iterator() { 10946 Iterator<num> get iterator {
10672 // Note: NodeLists are not fixed size. And most probably length shouldn't 10947 // Note: NodeLists are not fixed size. And most probably length shouldn't
10673 // be cached in both iterator _and_ forEach method. For now caching it 10948 // be cached in both iterator _and_ forEach method. For now caching it
10674 // for consistency. 10949 // for consistency.
10675 return new FixedSizeListIterator<num>(this); 10950 return new FixedSizeListIterator<num>(this);
10676 } 10951 }
10677 10952
10678 // From Collection<num>:
10679
10680 void add(num value) {
10681 throw new UnsupportedError("Cannot add to immutable List.");
10682 }
10683
10684 void addLast(num value) {
10685 throw new UnsupportedError("Cannot add to immutable List.");
10686 }
10687
10688 void addAll(Collection<num> collection) {
10689 throw new UnsupportedError("Cannot add to immutable List.");
10690 }
10691
10692 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) { 10953 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) {
10693 return Collections.reduce(this, initialValue, combine); 10954 return Collections.reduce(this, initialValue, combine);
10694 } 10955 }
10695 10956
10696 bool contains(num element) => Collections.contains(this, element); 10957 bool contains(num element) => Collections.contains(this, element);
10697 10958
10698 void forEach(void f(num element)) => Collections.forEach(this, f); 10959 void forEach(void f(num element)) => Collections.forEach(this, f);
10699 10960
10700 Collection map(f(num element)) => Collections.map(this, [], f); 10961 String join([String separator]) => Collections.joinList(this, separator);
10701 10962
10702 Collection<num> filter(bool f(num element)) => 10963 List mappedBy(f(num element)) => new MappedList<num, dynamic>(this, f);
10703 Collections.filter(this, <num>[], f); 10964
10965 Iterable<num> where(bool f(num element)) => new WhereIterable<num>(this, f);
10704 10966
10705 bool every(bool f(num element)) => Collections.every(this, f); 10967 bool every(bool f(num element)) => Collections.every(this, f);
10706 10968
10707 bool some(bool f(num element)) => Collections.some(this, f); 10969 bool any(bool f(num element)) => Collections.any(this, f);
10708 10970
10709 bool get isEmpty => this.length == 0; 10971 bool get isEmpty => this.length == 0;
10710 10972
10973 List<num> take(int n) => new ListView<num>(this, 0, n);
10974
10975 Iterable<num> takeWhile(bool test(num value)) {
10976 return new TakeWhileIterable<num>(this, test);
10977 }
10978
10979 List<num> skip(int n) => new ListView<num>(this, n, null);
10980
10981 Iterable<num> skipWhile(bool test(num value)) {
10982 return new SkipWhileIterable<num>(this, test);
10983 }
10984
10985 num firstMatching(bool test(num value), { num orElse() }) {
10986 return Collections.firstMatching(this, test, orElse);
10987 }
10988
10989 num lastMatching(bool test(num value), {num orElse()}) {
10990 return Collections.lastMatchingInList(this, test, orElse);
10991 }
10992
10993 num singleMatching(bool test(num value)) {
10994 return Collections.singleMatching(this, test);
10995 }
10996
10997 num elementAt(int index) {
10998 return this[index];
10999 }
11000
11001 // From Collection<num>:
11002
11003 void add(num value) {
11004 throw new UnsupportedError("Cannot add to immutable List.");
11005 }
11006
11007 void addLast(num value) {
11008 throw new UnsupportedError("Cannot add to immutable List.");
11009 }
11010
11011 void addAll(Iterable<num> iterable) {
11012 throw new UnsupportedError("Cannot add to immutable List.");
11013 }
11014
10711 // From List<num>: 11015 // From List<num>:
10712 void set length(int value) { 11016 void set length(int value) {
10713 throw new UnsupportedError("Cannot resize immutable List."); 11017 throw new UnsupportedError("Cannot resize immutable List.");
10714 } 11018 }
10715 11019
10716 void clear() { 11020 void clear() {
10717 throw new UnsupportedError("Cannot clear immutable List."); 11021 throw new UnsupportedError("Cannot clear immutable List.");
10718 } 11022 }
10719 11023
10720 void sort([int compare(num a, num b)]) { 11024 void sort([int compare(num a, num b)]) {
10721 throw new UnsupportedError("Cannot sort immutable List."); 11025 throw new UnsupportedError("Cannot sort immutable List.");
10722 } 11026 }
10723 11027
10724 int indexOf(num element, [int start = 0]) => 11028 int indexOf(num element, [int start = 0]) =>
10725 Lists.indexOf(this, element, start, this.length); 11029 Lists.indexOf(this, element, start, this.length);
10726 11030
10727 int lastIndexOf(num element, [int start]) { 11031 int lastIndexOf(num element, [int start]) {
10728 if (start == null) start = length - 1; 11032 if (start == null) start = length - 1;
10729 return Lists.lastIndexOf(this, element, start); 11033 return Lists.lastIndexOf(this, element, start);
10730 } 11034 }
10731 11035
10732 num get first => this[0]; 11036 num get first {
11037 if (this.length > 0) return this[0];
11038 throw new StateError("No elements");
11039 }
10733 11040
10734 num get last => this[length - 1]; 11041 num get last {
11042 if (this.length > 0) return this[this.length - 1];
11043 throw new StateError("No elements");
11044 }
11045
11046 num get single {
11047 if (length == 1) return this[0];
11048 if (length == 0) throw new StateError("No elements");
11049 throw new StateError("More than one element");
11050 }
11051
11052 num min([int compare(num a, num b)]) => _Collections.minInList(this, compare);
11053
11054 num max([int compare(num a, num b)]) => _Collections.maxInList(this, compare);
10735 11055
10736 num removeAt(int pos) { 11056 num removeAt(int pos) {
10737 throw new UnsupportedError("Cannot removeAt on immutable List."); 11057 throw new UnsupportedError("Cannot removeAt on immutable List.");
10738 } 11058 }
10739 11059
10740 num removeLast() { 11060 num removeLast() {
10741 throw new UnsupportedError("Cannot removeLast on immutable List."); 11061 throw new UnsupportedError("Cannot removeLast on immutable List.");
10742 } 11062 }
10743 11063
10744 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) { 11064 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
10809 num operator[](int index) native "Float64Array_numericIndexGetter_Callback"; 11129 num operator[](int index) native "Float64Array_numericIndexGetter_Callback";
10810 11130
10811 11131
10812 /** @domName Float64Array.numericIndexSetter */ 11132 /** @domName Float64Array.numericIndexSetter */
10813 void operator[]=(int index, num value) native "Float64Array_numericIndexSetter _Callback"; 11133 void operator[]=(int index, num value) native "Float64Array_numericIndexSetter _Callback";
10814 // -- start List<num> mixins. 11134 // -- start List<num> mixins.
10815 // num is the element type. 11135 // num is the element type.
10816 11136
10817 // From Iterable<num>: 11137 // From Iterable<num>:
10818 11138
10819 Iterator<num> iterator() { 11139 Iterator<num> get iterator {
10820 // Note: NodeLists are not fixed size. And most probably length shouldn't 11140 // Note: NodeLists are not fixed size. And most probably length shouldn't
10821 // be cached in both iterator _and_ forEach method. For now caching it 11141 // be cached in both iterator _and_ forEach method. For now caching it
10822 // for consistency. 11142 // for consistency.
10823 return new FixedSizeListIterator<num>(this); 11143 return new FixedSizeListIterator<num>(this);
10824 } 11144 }
10825 11145
10826 // From Collection<num>:
10827
10828 void add(num value) {
10829 throw new UnsupportedError("Cannot add to immutable List.");
10830 }
10831
10832 void addLast(num value) {
10833 throw new UnsupportedError("Cannot add to immutable List.");
10834 }
10835
10836 void addAll(Collection<num> collection) {
10837 throw new UnsupportedError("Cannot add to immutable List.");
10838 }
10839
10840 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) { 11146 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, num)) {
10841 return Collections.reduce(this, initialValue, combine); 11147 return Collections.reduce(this, initialValue, combine);
10842 } 11148 }
10843 11149
10844 bool contains(num element) => Collections.contains(this, element); 11150 bool contains(num element) => Collections.contains(this, element);
10845 11151
10846 void forEach(void f(num element)) => Collections.forEach(this, f); 11152 void forEach(void f(num element)) => Collections.forEach(this, f);
10847 11153
10848 Collection map(f(num element)) => Collections.map(this, [], f); 11154 String join([String separator]) => Collections.joinList(this, separator);
10849 11155
10850 Collection<num> filter(bool f(num element)) => 11156 List mappedBy(f(num element)) => new MappedList<num, dynamic>(this, f);
10851 Collections.filter(this, <num>[], f); 11157
11158 Iterable<num> where(bool f(num element)) => new WhereIterable<num>(this, f);
10852 11159
10853 bool every(bool f(num element)) => Collections.every(this, f); 11160 bool every(bool f(num element)) => Collections.every(this, f);
10854 11161
10855 bool some(bool f(num element)) => Collections.some(this, f); 11162 bool any(bool f(num element)) => Collections.any(this, f);
10856 11163
10857 bool get isEmpty => this.length == 0; 11164 bool get isEmpty => this.length == 0;
10858 11165
11166 List<num> take(int n) => new ListView<num>(this, 0, n);
11167
11168 Iterable<num> takeWhile(bool test(num value)) {
11169 return new TakeWhileIterable<num>(this, test);
11170 }
11171
11172 List<num> skip(int n) => new ListView<num>(this, n, null);
11173
11174 Iterable<num> skipWhile(bool test(num value)) {
11175 return new SkipWhileIterable<num>(this, test);
11176 }
11177
11178 num firstMatching(bool test(num value), { num orElse() }) {
11179 return Collections.firstMatching(this, test, orElse);
11180 }
11181
11182 num lastMatching(bool test(num value), {num orElse()}) {
11183 return Collections.lastMatchingInList(this, test, orElse);
11184 }
11185
11186 num singleMatching(bool test(num value)) {
11187 return Collections.singleMatching(this, test);
11188 }
11189
11190 num elementAt(int index) {
11191 return this[index];
11192 }
11193
11194 // From Collection<num>:
11195
11196 void add(num value) {
11197 throw new UnsupportedError("Cannot add to immutable List.");
11198 }
11199
11200 void addLast(num value) {
11201 throw new UnsupportedError("Cannot add to immutable List.");
11202 }
11203
11204 void addAll(Iterable<num> iterable) {
11205 throw new UnsupportedError("Cannot add to immutable List.");
11206 }
11207
10859 // From List<num>: 11208 // From List<num>:
10860 void set length(int value) { 11209 void set length(int value) {
10861 throw new UnsupportedError("Cannot resize immutable List."); 11210 throw new UnsupportedError("Cannot resize immutable List.");
10862 } 11211 }
10863 11212
10864 void clear() { 11213 void clear() {
10865 throw new UnsupportedError("Cannot clear immutable List."); 11214 throw new UnsupportedError("Cannot clear immutable List.");
10866 } 11215 }
10867 11216
10868 void sort([int compare(num a, num b)]) { 11217 void sort([int compare(num a, num b)]) {
10869 throw new UnsupportedError("Cannot sort immutable List."); 11218 throw new UnsupportedError("Cannot sort immutable List.");
10870 } 11219 }
10871 11220
10872 int indexOf(num element, [int start = 0]) => 11221 int indexOf(num element, [int start = 0]) =>
10873 Lists.indexOf(this, element, start, this.length); 11222 Lists.indexOf(this, element, start, this.length);
10874 11223
10875 int lastIndexOf(num element, [int start]) { 11224 int lastIndexOf(num element, [int start]) {
10876 if (start == null) start = length - 1; 11225 if (start == null) start = length - 1;
10877 return Lists.lastIndexOf(this, element, start); 11226 return Lists.lastIndexOf(this, element, start);
10878 } 11227 }
10879 11228
10880 num get first => this[0]; 11229 num get first {
11230 if (this.length > 0) return this[0];
11231 throw new StateError("No elements");
11232 }
10881 11233
10882 num get last => this[length - 1]; 11234 num get last {
11235 if (this.length > 0) return this[this.length - 1];
11236 throw new StateError("No elements");
11237 }
11238
11239 num get single {
11240 if (length == 1) return this[0];
11241 if (length == 0) throw new StateError("No elements");
11242 throw new StateError("More than one element");
11243 }
11244
11245 num min([int compare(num a, num b)]) => _Collections.minInList(this, compare);
11246
11247 num max([int compare(num a, num b)]) => _Collections.maxInList(this, compare);
10883 11248
10884 num removeAt(int pos) { 11249 num removeAt(int pos) {
10885 throw new UnsupportedError("Cannot removeAt on immutable List."); 11250 throw new UnsupportedError("Cannot removeAt on immutable List.");
10886 } 11251 }
10887 11252
10888 num removeLast() { 11253 num removeLast() {
10889 throw new UnsupportedError("Cannot removeLast on immutable List."); 11254 throw new UnsupportedError("Cannot removeLast on immutable List.");
10890 } 11255 }
10891 11256
10892 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) { 11257 void setRange(int start, int rangeLength, List<num> from, [int startFrom]) {
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
11497 Node operator[](int index) native "HTMLAllCollection_item_Callback"; 11862 Node operator[](int index) native "HTMLAllCollection_item_Callback";
11498 11863
11499 void operator[]=(int index, Node value) { 11864 void operator[]=(int index, Node value) {
11500 throw new UnsupportedError("Cannot assign element of immutable List."); 11865 throw new UnsupportedError("Cannot assign element of immutable List.");
11501 } 11866 }
11502 // -- start List<Node> mixins. 11867 // -- start List<Node> mixins.
11503 // Node is the element type. 11868 // Node is the element type.
11504 11869
11505 // From Iterable<Node>: 11870 // From Iterable<Node>:
11506 11871
11507 Iterator<Node> iterator() { 11872 Iterator<Node> get iterator {
11508 // Note: NodeLists are not fixed size. And most probably length shouldn't 11873 // Note: NodeLists are not fixed size. And most probably length shouldn't
11509 // be cached in both iterator _and_ forEach method. For now caching it 11874 // be cached in both iterator _and_ forEach method. For now caching it
11510 // for consistency. 11875 // for consistency.
11511 return new FixedSizeListIterator<Node>(this); 11876 return new FixedSizeListIterator<Node>(this);
11512 } 11877 }
11513 11878
11514 // From Collection<Node>:
11515
11516 void add(Node value) {
11517 throw new UnsupportedError("Cannot add to immutable List.");
11518 }
11519
11520 void addLast(Node value) {
11521 throw new UnsupportedError("Cannot add to immutable List.");
11522 }
11523
11524 void addAll(Collection<Node> collection) {
11525 throw new UnsupportedError("Cannot add to immutable List.");
11526 }
11527
11528 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 11879 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
11529 return Collections.reduce(this, initialValue, combine); 11880 return Collections.reduce(this, initialValue, combine);
11530 } 11881 }
11531 11882
11532 bool contains(Node element) => Collections.contains(this, element); 11883 bool contains(Node element) => Collections.contains(this, element);
11533 11884
11534 void forEach(void f(Node element)) => Collections.forEach(this, f); 11885 void forEach(void f(Node element)) => Collections.forEach(this, f);
11535 11886
11536 Collection map(f(Node element)) => Collections.map(this, [], f); 11887 String join([String separator]) => Collections.joinList(this, separator);
11537 11888
11538 Collection<Node> filter(bool f(Node element)) => 11889 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
11539 Collections.filter(this, <Node>[], f); 11890
11891 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
11540 11892
11541 bool every(bool f(Node element)) => Collections.every(this, f); 11893 bool every(bool f(Node element)) => Collections.every(this, f);
11542 11894
11543 bool some(bool f(Node element)) => Collections.some(this, f); 11895 bool any(bool f(Node element)) => Collections.any(this, f);
11544 11896
11545 bool get isEmpty => this.length == 0; 11897 bool get isEmpty => this.length == 0;
11546 11898
11899 List<Node> take(int n) => new ListView<Node>(this, 0, n);
11900
11901 Iterable<Node> takeWhile(bool test(Node value)) {
11902 return new TakeWhileIterable<Node>(this, test);
11903 }
11904
11905 List<Node> skip(int n) => new ListView<Node>(this, n, null);
11906
11907 Iterable<Node> skipWhile(bool test(Node value)) {
11908 return new SkipWhileIterable<Node>(this, test);
11909 }
11910
11911 Node firstMatching(bool test(Node value), { Node orElse() }) {
11912 return Collections.firstMatching(this, test, orElse);
11913 }
11914
11915 Node lastMatching(bool test(Node value), {Node orElse()}) {
11916 return Collections.lastMatchingInList(this, test, orElse);
11917 }
11918
11919 Node singleMatching(bool test(Node value)) {
11920 return Collections.singleMatching(this, test);
11921 }
11922
11923 Node elementAt(int index) {
11924 return this[index];
11925 }
11926
11927 // From Collection<Node>:
11928
11929 void add(Node value) {
11930 throw new UnsupportedError("Cannot add to immutable List.");
11931 }
11932
11933 void addLast(Node value) {
11934 throw new UnsupportedError("Cannot add to immutable List.");
11935 }
11936
11937 void addAll(Iterable<Node> iterable) {
11938 throw new UnsupportedError("Cannot add to immutable List.");
11939 }
11940
11547 // From List<Node>: 11941 // From List<Node>:
11548 void set length(int value) { 11942 void set length(int value) {
11549 throw new UnsupportedError("Cannot resize immutable List."); 11943 throw new UnsupportedError("Cannot resize immutable List.");
11550 } 11944 }
11551 11945
11552 void clear() { 11946 void clear() {
11553 throw new UnsupportedError("Cannot clear immutable List."); 11947 throw new UnsupportedError("Cannot clear immutable List.");
11554 } 11948 }
11555 11949
11556 void sort([int compare(Node a, Node b)]) { 11950 void sort([int compare(Node a, Node b)]) {
11557 throw new UnsupportedError("Cannot sort immutable List."); 11951 throw new UnsupportedError("Cannot sort immutable List.");
11558 } 11952 }
11559 11953
11560 int indexOf(Node element, [int start = 0]) => 11954 int indexOf(Node element, [int start = 0]) =>
11561 Lists.indexOf(this, element, start, this.length); 11955 Lists.indexOf(this, element, start, this.length);
11562 11956
11563 int lastIndexOf(Node element, [int start]) { 11957 int lastIndexOf(Node element, [int start]) {
11564 if (start == null) start = length - 1; 11958 if (start == null) start = length - 1;
11565 return Lists.lastIndexOf(this, element, start); 11959 return Lists.lastIndexOf(this, element, start);
11566 } 11960 }
11567 11961
11568 Node get first => this[0]; 11962 Node get first {
11963 if (this.length > 0) return this[0];
11964 throw new StateError("No elements");
11965 }
11569 11966
11570 Node get last => this[length - 1]; 11967 Node get last {
11968 if (this.length > 0) return this[this.length - 1];
11969 throw new StateError("No elements");
11970 }
11971
11972 Node get single {
11973 if (length == 1) return this[0];
11974 if (length == 0) throw new StateError("No elements");
11975 throw new StateError("More than one element");
11976 }
11977
11978 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
11979
11980 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
11571 11981
11572 Node removeAt(int pos) { 11982 Node removeAt(int pos) {
11573 throw new UnsupportedError("Cannot removeAt on immutable List."); 11983 throw new UnsupportedError("Cannot removeAt on immutable List.");
11574 } 11984 }
11575 11985
11576 Node removeLast() { 11986 Node removeLast() {
11577 throw new UnsupportedError("Cannot removeLast on immutable List."); 11987 throw new UnsupportedError("Cannot removeLast on immutable List.");
11578 } 11988 }
11579 11989
11580 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 11990 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
11625 Node operator[](int index) native "HTMLCollection_item_Callback"; 12035 Node operator[](int index) native "HTMLCollection_item_Callback";
11626 12036
11627 void operator[]=(int index, Node value) { 12037 void operator[]=(int index, Node value) {
11628 throw new UnsupportedError("Cannot assign element of immutable List."); 12038 throw new UnsupportedError("Cannot assign element of immutable List.");
11629 } 12039 }
11630 // -- start List<Node> mixins. 12040 // -- start List<Node> mixins.
11631 // Node is the element type. 12041 // Node is the element type.
11632 12042
11633 // From Iterable<Node>: 12043 // From Iterable<Node>:
11634 12044
11635 Iterator<Node> iterator() { 12045 Iterator<Node> get iterator {
11636 // Note: NodeLists are not fixed size. And most probably length shouldn't 12046 // Note: NodeLists are not fixed size. And most probably length shouldn't
11637 // be cached in both iterator _and_ forEach method. For now caching it 12047 // be cached in both iterator _and_ forEach method. For now caching it
11638 // for consistency. 12048 // for consistency.
11639 return new FixedSizeListIterator<Node>(this); 12049 return new FixedSizeListIterator<Node>(this);
11640 } 12050 }
11641 12051
11642 // From Collection<Node>:
11643
11644 void add(Node value) {
11645 throw new UnsupportedError("Cannot add to immutable List.");
11646 }
11647
11648 void addLast(Node value) {
11649 throw new UnsupportedError("Cannot add to immutable List.");
11650 }
11651
11652 void addAll(Collection<Node> collection) {
11653 throw new UnsupportedError("Cannot add to immutable List.");
11654 }
11655
11656 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 12052 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
11657 return Collections.reduce(this, initialValue, combine); 12053 return Collections.reduce(this, initialValue, combine);
11658 } 12054 }
11659 12055
11660 bool contains(Node element) => Collections.contains(this, element); 12056 bool contains(Node element) => Collections.contains(this, element);
11661 12057
11662 void forEach(void f(Node element)) => Collections.forEach(this, f); 12058 void forEach(void f(Node element)) => Collections.forEach(this, f);
11663 12059
11664 Collection map(f(Node element)) => Collections.map(this, [], f); 12060 String join([String separator]) => Collections.joinList(this, separator);
11665 12061
11666 Collection<Node> filter(bool f(Node element)) => 12062 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
11667 Collections.filter(this, <Node>[], f); 12063
12064 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
11668 12065
11669 bool every(bool f(Node element)) => Collections.every(this, f); 12066 bool every(bool f(Node element)) => Collections.every(this, f);
11670 12067
11671 bool some(bool f(Node element)) => Collections.some(this, f); 12068 bool any(bool f(Node element)) => Collections.any(this, f);
11672 12069
11673 bool get isEmpty => this.length == 0; 12070 bool get isEmpty => this.length == 0;
11674 12071
12072 List<Node> take(int n) => new ListView<Node>(this, 0, n);
12073
12074 Iterable<Node> takeWhile(bool test(Node value)) {
12075 return new TakeWhileIterable<Node>(this, test);
12076 }
12077
12078 List<Node> skip(int n) => new ListView<Node>(this, n, null);
12079
12080 Iterable<Node> skipWhile(bool test(Node value)) {
12081 return new SkipWhileIterable<Node>(this, test);
12082 }
12083
12084 Node firstMatching(bool test(Node value), { Node orElse() }) {
12085 return Collections.firstMatching(this, test, orElse);
12086 }
12087
12088 Node lastMatching(bool test(Node value), {Node orElse()}) {
12089 return Collections.lastMatchingInList(this, test, orElse);
12090 }
12091
12092 Node singleMatching(bool test(Node value)) {
12093 return Collections.singleMatching(this, test);
12094 }
12095
12096 Node elementAt(int index) {
12097 return this[index];
12098 }
12099
12100 // From Collection<Node>:
12101
12102 void add(Node value) {
12103 throw new UnsupportedError("Cannot add to immutable List.");
12104 }
12105
12106 void addLast(Node value) {
12107 throw new UnsupportedError("Cannot add to immutable List.");
12108 }
12109
12110 void addAll(Iterable<Node> iterable) {
12111 throw new UnsupportedError("Cannot add to immutable List.");
12112 }
12113
11675 // From List<Node>: 12114 // From List<Node>:
11676 void set length(int value) { 12115 void set length(int value) {
11677 throw new UnsupportedError("Cannot resize immutable List."); 12116 throw new UnsupportedError("Cannot resize immutable List.");
11678 } 12117 }
11679 12118
11680 void clear() { 12119 void clear() {
11681 throw new UnsupportedError("Cannot clear immutable List."); 12120 throw new UnsupportedError("Cannot clear immutable List.");
11682 } 12121 }
11683 12122
11684 void sort([int compare(Node a, Node b)]) { 12123 void sort([int compare(Node a, Node b)]) {
11685 throw new UnsupportedError("Cannot sort immutable List."); 12124 throw new UnsupportedError("Cannot sort immutable List.");
11686 } 12125 }
11687 12126
11688 int indexOf(Node element, [int start = 0]) => 12127 int indexOf(Node element, [int start = 0]) =>
11689 Lists.indexOf(this, element, start, this.length); 12128 Lists.indexOf(this, element, start, this.length);
11690 12129
11691 int lastIndexOf(Node element, [int start]) { 12130 int lastIndexOf(Node element, [int start]) {
11692 if (start == null) start = length - 1; 12131 if (start == null) start = length - 1;
11693 return Lists.lastIndexOf(this, element, start); 12132 return Lists.lastIndexOf(this, element, start);
11694 } 12133 }
11695 12134
11696 Node get first => this[0]; 12135 Node get first {
12136 if (this.length > 0) return this[0];
12137 throw new StateError("No elements");
12138 }
11697 12139
11698 Node get last => this[length - 1]; 12140 Node get last {
12141 if (this.length > 0) return this[this.length - 1];
12142 throw new StateError("No elements");
12143 }
12144
12145 Node get single {
12146 if (length == 1) return this[0];
12147 if (length == 0) throw new StateError("No elements");
12148 throw new StateError("More than one element");
12149 }
12150
12151 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
12152
12153 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
11699 12154
11700 Node removeAt(int pos) { 12155 Node removeAt(int pos) {
11701 throw new UnsupportedError("Cannot removeAt on immutable List."); 12156 throw new UnsupportedError("Cannot removeAt on immutable List.");
11702 } 12157 }
11703 12158
11704 Node removeLast() { 12159 Node removeLast() {
11705 throw new UnsupportedError("Cannot removeLast on immutable List."); 12160 throw new UnsupportedError("Cannot removeLast on immutable List.");
11706 } 12161 }
11707 12162
11708 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 12163 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after
13510 int operator[](int index) native "Int16Array_numericIndexGetter_Callback"; 13965 int operator[](int index) native "Int16Array_numericIndexGetter_Callback";
13511 13966
13512 13967
13513 /** @domName Int16Array.numericIndexSetter */ 13968 /** @domName Int16Array.numericIndexSetter */
13514 void operator[]=(int index, int value) native "Int16Array_numericIndexSetter_C allback"; 13969 void operator[]=(int index, int value) native "Int16Array_numericIndexSetter_C allback";
13515 // -- start List<int> mixins. 13970 // -- start List<int> mixins.
13516 // int is the element type. 13971 // int is the element type.
13517 13972
13518 // From Iterable<int>: 13973 // From Iterable<int>:
13519 13974
13520 Iterator<int> iterator() { 13975 Iterator<int> get iterator {
13521 // Note: NodeLists are not fixed size. And most probably length shouldn't 13976 // Note: NodeLists are not fixed size. And most probably length shouldn't
13522 // be cached in both iterator _and_ forEach method. For now caching it 13977 // be cached in both iterator _and_ forEach method. For now caching it
13523 // for consistency. 13978 // for consistency.
13524 return new FixedSizeListIterator<int>(this); 13979 return new FixedSizeListIterator<int>(this);
13525 } 13980 }
13526 13981
13527 // From Collection<int>:
13528
13529 void add(int value) {
13530 throw new UnsupportedError("Cannot add to immutable List.");
13531 }
13532
13533 void addLast(int value) {
13534 throw new UnsupportedError("Cannot add to immutable List.");
13535 }
13536
13537 void addAll(Collection<int> collection) {
13538 throw new UnsupportedError("Cannot add to immutable List.");
13539 }
13540
13541 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 13982 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
13542 return Collections.reduce(this, initialValue, combine); 13983 return Collections.reduce(this, initialValue, combine);
13543 } 13984 }
13544 13985
13545 bool contains(int element) => Collections.contains(this, element); 13986 bool contains(int element) => Collections.contains(this, element);
13546 13987
13547 void forEach(void f(int element)) => Collections.forEach(this, f); 13988 void forEach(void f(int element)) => Collections.forEach(this, f);
13548 13989
13549 Collection map(f(int element)) => Collections.map(this, [], f); 13990 String join([String separator]) => Collections.joinList(this, separator);
13550 13991
13551 Collection<int> filter(bool f(int element)) => 13992 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
13552 Collections.filter(this, <int>[], f); 13993
13994 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
13553 13995
13554 bool every(bool f(int element)) => Collections.every(this, f); 13996 bool every(bool f(int element)) => Collections.every(this, f);
13555 13997
13556 bool some(bool f(int element)) => Collections.some(this, f); 13998 bool any(bool f(int element)) => Collections.any(this, f);
13557 13999
13558 bool get isEmpty => this.length == 0; 14000 bool get isEmpty => this.length == 0;
13559 14001
14002 List<int> take(int n) => new ListView<int>(this, 0, n);
14003
14004 Iterable<int> takeWhile(bool test(int value)) {
14005 return new TakeWhileIterable<int>(this, test);
14006 }
14007
14008 List<int> skip(int n) => new ListView<int>(this, n, null);
14009
14010 Iterable<int> skipWhile(bool test(int value)) {
14011 return new SkipWhileIterable<int>(this, test);
14012 }
14013
14014 int firstMatching(bool test(int value), { int orElse() }) {
14015 return Collections.firstMatching(this, test, orElse);
14016 }
14017
14018 int lastMatching(bool test(int value), {int orElse()}) {
14019 return Collections.lastMatchingInList(this, test, orElse);
14020 }
14021
14022 int singleMatching(bool test(int value)) {
14023 return Collections.singleMatching(this, test);
14024 }
14025
14026 int elementAt(int index) {
14027 return this[index];
14028 }
14029
14030 // From Collection<int>:
14031
14032 void add(int value) {
14033 throw new UnsupportedError("Cannot add to immutable List.");
14034 }
14035
14036 void addLast(int value) {
14037 throw new UnsupportedError("Cannot add to immutable List.");
14038 }
14039
14040 void addAll(Iterable<int> iterable) {
14041 throw new UnsupportedError("Cannot add to immutable List.");
14042 }
14043
13560 // From List<int>: 14044 // From List<int>:
13561 void set length(int value) { 14045 void set length(int value) {
13562 throw new UnsupportedError("Cannot resize immutable List."); 14046 throw new UnsupportedError("Cannot resize immutable List.");
13563 } 14047 }
13564 14048
13565 void clear() { 14049 void clear() {
13566 throw new UnsupportedError("Cannot clear immutable List."); 14050 throw new UnsupportedError("Cannot clear immutable List.");
13567 } 14051 }
13568 14052
13569 void sort([int compare(int a, int b)]) { 14053 void sort([int compare(int a, int b)]) {
13570 throw new UnsupportedError("Cannot sort immutable List."); 14054 throw new UnsupportedError("Cannot sort immutable List.");
13571 } 14055 }
13572 14056
13573 int indexOf(int element, [int start = 0]) => 14057 int indexOf(int element, [int start = 0]) =>
13574 Lists.indexOf(this, element, start, this.length); 14058 Lists.indexOf(this, element, start, this.length);
13575 14059
13576 int lastIndexOf(int element, [int start]) { 14060 int lastIndexOf(int element, [int start]) {
13577 if (start == null) start = length - 1; 14061 if (start == null) start = length - 1;
13578 return Lists.lastIndexOf(this, element, start); 14062 return Lists.lastIndexOf(this, element, start);
13579 } 14063 }
13580 14064
13581 int get first => this[0]; 14065 int get first {
14066 if (this.length > 0) return this[0];
14067 throw new StateError("No elements");
14068 }
13582 14069
13583 int get last => this[length - 1]; 14070 int get last {
14071 if (this.length > 0) return this[this.length - 1];
14072 throw new StateError("No elements");
14073 }
14074
14075 int get single {
14076 if (length == 1) return this[0];
14077 if (length == 0) throw new StateError("No elements");
14078 throw new StateError("More than one element");
14079 }
14080
14081 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
14082
14083 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
13584 14084
13585 int removeAt(int pos) { 14085 int removeAt(int pos) {
13586 throw new UnsupportedError("Cannot removeAt on immutable List."); 14086 throw new UnsupportedError("Cannot removeAt on immutable List.");
13587 } 14087 }
13588 14088
13589 int removeLast() { 14089 int removeLast() {
13590 throw new UnsupportedError("Cannot removeLast on immutable List."); 14090 throw new UnsupportedError("Cannot removeLast on immutable List.");
13591 } 14091 }
13592 14092
13593 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 14093 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
13658 int operator[](int index) native "Int32Array_numericIndexGetter_Callback"; 14158 int operator[](int index) native "Int32Array_numericIndexGetter_Callback";
13659 14159
13660 14160
13661 /** @domName Int32Array.numericIndexSetter */ 14161 /** @domName Int32Array.numericIndexSetter */
13662 void operator[]=(int index, int value) native "Int32Array_numericIndexSetter_C allback"; 14162 void operator[]=(int index, int value) native "Int32Array_numericIndexSetter_C allback";
13663 // -- start List<int> mixins. 14163 // -- start List<int> mixins.
13664 // int is the element type. 14164 // int is the element type.
13665 14165
13666 // From Iterable<int>: 14166 // From Iterable<int>:
13667 14167
13668 Iterator<int> iterator() { 14168 Iterator<int> get iterator {
13669 // Note: NodeLists are not fixed size. And most probably length shouldn't 14169 // Note: NodeLists are not fixed size. And most probably length shouldn't
13670 // be cached in both iterator _and_ forEach method. For now caching it 14170 // be cached in both iterator _and_ forEach method. For now caching it
13671 // for consistency. 14171 // for consistency.
13672 return new FixedSizeListIterator<int>(this); 14172 return new FixedSizeListIterator<int>(this);
13673 } 14173 }
13674 14174
13675 // From Collection<int>:
13676
13677 void add(int value) {
13678 throw new UnsupportedError("Cannot add to immutable List.");
13679 }
13680
13681 void addLast(int value) {
13682 throw new UnsupportedError("Cannot add to immutable List.");
13683 }
13684
13685 void addAll(Collection<int> collection) {
13686 throw new UnsupportedError("Cannot add to immutable List.");
13687 }
13688
13689 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 14175 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
13690 return Collections.reduce(this, initialValue, combine); 14176 return Collections.reduce(this, initialValue, combine);
13691 } 14177 }
13692 14178
13693 bool contains(int element) => Collections.contains(this, element); 14179 bool contains(int element) => Collections.contains(this, element);
13694 14180
13695 void forEach(void f(int element)) => Collections.forEach(this, f); 14181 void forEach(void f(int element)) => Collections.forEach(this, f);
13696 14182
13697 Collection map(f(int element)) => Collections.map(this, [], f); 14183 String join([String separator]) => Collections.joinList(this, separator);
13698 14184
13699 Collection<int> filter(bool f(int element)) => 14185 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
13700 Collections.filter(this, <int>[], f); 14186
14187 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
13701 14188
13702 bool every(bool f(int element)) => Collections.every(this, f); 14189 bool every(bool f(int element)) => Collections.every(this, f);
13703 14190
13704 bool some(bool f(int element)) => Collections.some(this, f); 14191 bool any(bool f(int element)) => Collections.any(this, f);
13705 14192
13706 bool get isEmpty => this.length == 0; 14193 bool get isEmpty => this.length == 0;
13707 14194
14195 List<int> take(int n) => new ListView<int>(this, 0, n);
14196
14197 Iterable<int> takeWhile(bool test(int value)) {
14198 return new TakeWhileIterable<int>(this, test);
14199 }
14200
14201 List<int> skip(int n) => new ListView<int>(this, n, null);
14202
14203 Iterable<int> skipWhile(bool test(int value)) {
14204 return new SkipWhileIterable<int>(this, test);
14205 }
14206
14207 int firstMatching(bool test(int value), { int orElse() }) {
14208 return Collections.firstMatching(this, test, orElse);
14209 }
14210
14211 int lastMatching(bool test(int value), {int orElse()}) {
14212 return Collections.lastMatchingInList(this, test, orElse);
14213 }
14214
14215 int singleMatching(bool test(int value)) {
14216 return Collections.singleMatching(this, test);
14217 }
14218
14219 int elementAt(int index) {
14220 return this[index];
14221 }
14222
14223 // From Collection<int>:
14224
14225 void add(int value) {
14226 throw new UnsupportedError("Cannot add to immutable List.");
14227 }
14228
14229 void addLast(int value) {
14230 throw new UnsupportedError("Cannot add to immutable List.");
14231 }
14232
14233 void addAll(Iterable<int> iterable) {
14234 throw new UnsupportedError("Cannot add to immutable List.");
14235 }
14236
13708 // From List<int>: 14237 // From List<int>:
13709 void set length(int value) { 14238 void set length(int value) {
13710 throw new UnsupportedError("Cannot resize immutable List."); 14239 throw new UnsupportedError("Cannot resize immutable List.");
13711 } 14240 }
13712 14241
13713 void clear() { 14242 void clear() {
13714 throw new UnsupportedError("Cannot clear immutable List."); 14243 throw new UnsupportedError("Cannot clear immutable List.");
13715 } 14244 }
13716 14245
13717 void sort([int compare(int a, int b)]) { 14246 void sort([int compare(int a, int b)]) {
13718 throw new UnsupportedError("Cannot sort immutable List."); 14247 throw new UnsupportedError("Cannot sort immutable List.");
13719 } 14248 }
13720 14249
13721 int indexOf(int element, [int start = 0]) => 14250 int indexOf(int element, [int start = 0]) =>
13722 Lists.indexOf(this, element, start, this.length); 14251 Lists.indexOf(this, element, start, this.length);
13723 14252
13724 int lastIndexOf(int element, [int start]) { 14253 int lastIndexOf(int element, [int start]) {
13725 if (start == null) start = length - 1; 14254 if (start == null) start = length - 1;
13726 return Lists.lastIndexOf(this, element, start); 14255 return Lists.lastIndexOf(this, element, start);
13727 } 14256 }
13728 14257
13729 int get first => this[0]; 14258 int get first {
14259 if (this.length > 0) return this[0];
14260 throw new StateError("No elements");
14261 }
13730 14262
13731 int get last => this[length - 1]; 14263 int get last {
14264 if (this.length > 0) return this[this.length - 1];
14265 throw new StateError("No elements");
14266 }
14267
14268 int get single {
14269 if (length == 1) return this[0];
14270 if (length == 0) throw new StateError("No elements");
14271 throw new StateError("More than one element");
14272 }
14273
14274 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
14275
14276 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
13732 14277
13733 int removeAt(int pos) { 14278 int removeAt(int pos) {
13734 throw new UnsupportedError("Cannot removeAt on immutable List."); 14279 throw new UnsupportedError("Cannot removeAt on immutable List.");
13735 } 14280 }
13736 14281
13737 int removeLast() { 14282 int removeLast() {
13738 throw new UnsupportedError("Cannot removeLast on immutable List."); 14283 throw new UnsupportedError("Cannot removeLast on immutable List.");
13739 } 14284 }
13740 14285
13741 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 14286 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
13806 int operator[](int index) native "Int8Array_numericIndexGetter_Callback"; 14351 int operator[](int index) native "Int8Array_numericIndexGetter_Callback";
13807 14352
13808 14353
13809 /** @domName Int8Array.numericIndexSetter */ 14354 /** @domName Int8Array.numericIndexSetter */
13810 void operator[]=(int index, int value) native "Int8Array_numericIndexSetter_Ca llback"; 14355 void operator[]=(int index, int value) native "Int8Array_numericIndexSetter_Ca llback";
13811 // -- start List<int> mixins. 14356 // -- start List<int> mixins.
13812 // int is the element type. 14357 // int is the element type.
13813 14358
13814 // From Iterable<int>: 14359 // From Iterable<int>:
13815 14360
13816 Iterator<int> iterator() { 14361 Iterator<int> get iterator {
13817 // Note: NodeLists are not fixed size. And most probably length shouldn't 14362 // Note: NodeLists are not fixed size. And most probably length shouldn't
13818 // be cached in both iterator _and_ forEach method. For now caching it 14363 // be cached in both iterator _and_ forEach method. For now caching it
13819 // for consistency. 14364 // for consistency.
13820 return new FixedSizeListIterator<int>(this); 14365 return new FixedSizeListIterator<int>(this);
13821 } 14366 }
13822 14367
13823 // From Collection<int>:
13824
13825 void add(int value) {
13826 throw new UnsupportedError("Cannot add to immutable List.");
13827 }
13828
13829 void addLast(int value) {
13830 throw new UnsupportedError("Cannot add to immutable List.");
13831 }
13832
13833 void addAll(Collection<int> collection) {
13834 throw new UnsupportedError("Cannot add to immutable List.");
13835 }
13836
13837 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 14368 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
13838 return Collections.reduce(this, initialValue, combine); 14369 return Collections.reduce(this, initialValue, combine);
13839 } 14370 }
13840 14371
13841 bool contains(int element) => Collections.contains(this, element); 14372 bool contains(int element) => Collections.contains(this, element);
13842 14373
13843 void forEach(void f(int element)) => Collections.forEach(this, f); 14374 void forEach(void f(int element)) => Collections.forEach(this, f);
13844 14375
13845 Collection map(f(int element)) => Collections.map(this, [], f); 14376 String join([String separator]) => Collections.joinList(this, separator);
13846 14377
13847 Collection<int> filter(bool f(int element)) => 14378 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
13848 Collections.filter(this, <int>[], f); 14379
14380 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
13849 14381
13850 bool every(bool f(int element)) => Collections.every(this, f); 14382 bool every(bool f(int element)) => Collections.every(this, f);
13851 14383
13852 bool some(bool f(int element)) => Collections.some(this, f); 14384 bool any(bool f(int element)) => Collections.any(this, f);
13853 14385
13854 bool get isEmpty => this.length == 0; 14386 bool get isEmpty => this.length == 0;
13855 14387
14388 List<int> take(int n) => new ListView<int>(this, 0, n);
14389
14390 Iterable<int> takeWhile(bool test(int value)) {
14391 return new TakeWhileIterable<int>(this, test);
14392 }
14393
14394 List<int> skip(int n) => new ListView<int>(this, n, null);
14395
14396 Iterable<int> skipWhile(bool test(int value)) {
14397 return new SkipWhileIterable<int>(this, test);
14398 }
14399
14400 int firstMatching(bool test(int value), { int orElse() }) {
14401 return Collections.firstMatching(this, test, orElse);
14402 }
14403
14404 int lastMatching(bool test(int value), {int orElse()}) {
14405 return Collections.lastMatchingInList(this, test, orElse);
14406 }
14407
14408 int singleMatching(bool test(int value)) {
14409 return Collections.singleMatching(this, test);
14410 }
14411
14412 int elementAt(int index) {
14413 return this[index];
14414 }
14415
14416 // From Collection<int>:
14417
14418 void add(int value) {
14419 throw new UnsupportedError("Cannot add to immutable List.");
14420 }
14421
14422 void addLast(int value) {
14423 throw new UnsupportedError("Cannot add to immutable List.");
14424 }
14425
14426 void addAll(Iterable<int> iterable) {
14427 throw new UnsupportedError("Cannot add to immutable List.");
14428 }
14429
13856 // From List<int>: 14430 // From List<int>:
13857 void set length(int value) { 14431 void set length(int value) {
13858 throw new UnsupportedError("Cannot resize immutable List."); 14432 throw new UnsupportedError("Cannot resize immutable List.");
13859 } 14433 }
13860 14434
13861 void clear() { 14435 void clear() {
13862 throw new UnsupportedError("Cannot clear immutable List."); 14436 throw new UnsupportedError("Cannot clear immutable List.");
13863 } 14437 }
13864 14438
13865 void sort([int compare(int a, int b)]) { 14439 void sort([int compare(int a, int b)]) {
13866 throw new UnsupportedError("Cannot sort immutable List."); 14440 throw new UnsupportedError("Cannot sort immutable List.");
13867 } 14441 }
13868 14442
13869 int indexOf(int element, [int start = 0]) => 14443 int indexOf(int element, [int start = 0]) =>
13870 Lists.indexOf(this, element, start, this.length); 14444 Lists.indexOf(this, element, start, this.length);
13871 14445
13872 int lastIndexOf(int element, [int start]) { 14446 int lastIndexOf(int element, [int start]) {
13873 if (start == null) start = length - 1; 14447 if (start == null) start = length - 1;
13874 return Lists.lastIndexOf(this, element, start); 14448 return Lists.lastIndexOf(this, element, start);
13875 } 14449 }
13876 14450
13877 int get first => this[0]; 14451 int get first {
14452 if (this.length > 0) return this[0];
14453 throw new StateError("No elements");
14454 }
13878 14455
13879 int get last => this[length - 1]; 14456 int get last {
14457 if (this.length > 0) return this[this.length - 1];
14458 throw new StateError("No elements");
14459 }
14460
14461 int get single {
14462 if (length == 1) return this[0];
14463 if (length == 0) throw new StateError("No elements");
14464 throw new StateError("More than one element");
14465 }
14466
14467 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
14468
14469 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
13880 14470
13881 int removeAt(int pos) { 14471 int removeAt(int pos) {
13882 throw new UnsupportedError("Cannot removeAt on immutable List."); 14472 throw new UnsupportedError("Cannot removeAt on immutable List.");
13883 } 14473 }
13884 14474
13885 int removeLast() { 14475 int removeLast() {
13886 throw new UnsupportedError("Cannot removeLast on immutable List."); 14476 throw new UnsupportedError("Cannot removeLast on immutable List.");
13887 } 14477 }
13888 14478
13889 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 14479 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
16132 Node operator[](int index) native "NamedNodeMap_item_Callback"; 16722 Node operator[](int index) native "NamedNodeMap_item_Callback";
16133 16723
16134 void operator[]=(int index, Node value) { 16724 void operator[]=(int index, Node value) {
16135 throw new UnsupportedError("Cannot assign element of immutable List."); 16725 throw new UnsupportedError("Cannot assign element of immutable List.");
16136 } 16726 }
16137 // -- start List<Node> mixins. 16727 // -- start List<Node> mixins.
16138 // Node is the element type. 16728 // Node is the element type.
16139 16729
16140 // From Iterable<Node>: 16730 // From Iterable<Node>:
16141 16731
16142 Iterator<Node> iterator() { 16732 Iterator<Node> get iterator {
16143 // Note: NodeLists are not fixed size. And most probably length shouldn't 16733 // Note: NodeLists are not fixed size. And most probably length shouldn't
16144 // be cached in both iterator _and_ forEach method. For now caching it 16734 // be cached in both iterator _and_ forEach method. For now caching it
16145 // for consistency. 16735 // for consistency.
16146 return new FixedSizeListIterator<Node>(this); 16736 return new FixedSizeListIterator<Node>(this);
16147 } 16737 }
16148 16738
16149 // From Collection<Node>:
16150
16151 void add(Node value) {
16152 throw new UnsupportedError("Cannot add to immutable List.");
16153 }
16154
16155 void addLast(Node value) {
16156 throw new UnsupportedError("Cannot add to immutable List.");
16157 }
16158
16159 void addAll(Collection<Node> collection) {
16160 throw new UnsupportedError("Cannot add to immutable List.");
16161 }
16162
16163 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 16739 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
16164 return Collections.reduce(this, initialValue, combine); 16740 return Collections.reduce(this, initialValue, combine);
16165 } 16741 }
16166 16742
16167 bool contains(Node element) => Collections.contains(this, element); 16743 bool contains(Node element) => Collections.contains(this, element);
16168 16744
16169 void forEach(void f(Node element)) => Collections.forEach(this, f); 16745 void forEach(void f(Node element)) => Collections.forEach(this, f);
16170 16746
16171 Collection map(f(Node element)) => Collections.map(this, [], f); 16747 String join([String separator]) => Collections.joinList(this, separator);
16172 16748
16173 Collection<Node> filter(bool f(Node element)) => 16749 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
16174 Collections.filter(this, <Node>[], f); 16750
16751 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
16175 16752
16176 bool every(bool f(Node element)) => Collections.every(this, f); 16753 bool every(bool f(Node element)) => Collections.every(this, f);
16177 16754
16178 bool some(bool f(Node element)) => Collections.some(this, f); 16755 bool any(bool f(Node element)) => Collections.any(this, f);
16179 16756
16180 bool get isEmpty => this.length == 0; 16757 bool get isEmpty => this.length == 0;
16181 16758
16759 List<Node> take(int n) => new ListView<Node>(this, 0, n);
16760
16761 Iterable<Node> takeWhile(bool test(Node value)) {
16762 return new TakeWhileIterable<Node>(this, test);
16763 }
16764
16765 List<Node> skip(int n) => new ListView<Node>(this, n, null);
16766
16767 Iterable<Node> skipWhile(bool test(Node value)) {
16768 return new SkipWhileIterable<Node>(this, test);
16769 }
16770
16771 Node firstMatching(bool test(Node value), { Node orElse() }) {
16772 return Collections.firstMatching(this, test, orElse);
16773 }
16774
16775 Node lastMatching(bool test(Node value), {Node orElse()}) {
16776 return Collections.lastMatchingInList(this, test, orElse);
16777 }
16778
16779 Node singleMatching(bool test(Node value)) {
16780 return Collections.singleMatching(this, test);
16781 }
16782
16783 Node elementAt(int index) {
16784 return this[index];
16785 }
16786
16787 // From Collection<Node>:
16788
16789 void add(Node value) {
16790 throw new UnsupportedError("Cannot add to immutable List.");
16791 }
16792
16793 void addLast(Node value) {
16794 throw new UnsupportedError("Cannot add to immutable List.");
16795 }
16796
16797 void addAll(Iterable<Node> iterable) {
16798 throw new UnsupportedError("Cannot add to immutable List.");
16799 }
16800
16182 // From List<Node>: 16801 // From List<Node>:
16183 void set length(int value) { 16802 void set length(int value) {
16184 throw new UnsupportedError("Cannot resize immutable List."); 16803 throw new UnsupportedError("Cannot resize immutable List.");
16185 } 16804 }
16186 16805
16187 void clear() { 16806 void clear() {
16188 throw new UnsupportedError("Cannot clear immutable List."); 16807 throw new UnsupportedError("Cannot clear immutable List.");
16189 } 16808 }
16190 16809
16191 void sort([int compare(Node a, Node b)]) { 16810 void sort([int compare(Node a, Node b)]) {
16192 throw new UnsupportedError("Cannot sort immutable List."); 16811 throw new UnsupportedError("Cannot sort immutable List.");
16193 } 16812 }
16194 16813
16195 int indexOf(Node element, [int start = 0]) => 16814 int indexOf(Node element, [int start = 0]) =>
16196 Lists.indexOf(this, element, start, this.length); 16815 Lists.indexOf(this, element, start, this.length);
16197 16816
16198 int lastIndexOf(Node element, [int start]) { 16817 int lastIndexOf(Node element, [int start]) {
16199 if (start == null) start = length - 1; 16818 if (start == null) start = length - 1;
16200 return Lists.lastIndexOf(this, element, start); 16819 return Lists.lastIndexOf(this, element, start);
16201 } 16820 }
16202 16821
16203 Node get first => this[0]; 16822 Node get first {
16823 if (this.length > 0) return this[0];
16824 throw new StateError("No elements");
16825 }
16204 16826
16205 Node get last => this[length - 1]; 16827 Node get last {
16828 if (this.length > 0) return this[this.length - 1];
16829 throw new StateError("No elements");
16830 }
16831
16832 Node get single {
16833 if (length == 1) return this[0];
16834 if (length == 0) throw new StateError("No elements");
16835 throw new StateError("More than one element");
16836 }
16837
16838 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
16839
16840 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
16206 16841
16207 Node removeAt(int pos) { 16842 Node removeAt(int pos) {
16208 throw new UnsupportedError("Cannot removeAt on immutable List."); 16843 throw new UnsupportedError("Cannot removeAt on immutable List.");
16209 } 16844 }
16210 16845
16211 Node removeLast() { 16846 Node removeLast() {
16212 throw new UnsupportedError("Cannot removeLast on immutable List."); 16847 throw new UnsupportedError("Cannot removeLast on immutable List.");
16213 } 16848 }
16214 16849
16215 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 16850 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
16393 * Lazy implementation of the child nodes of an element that does not request 17028 * Lazy implementation of the child nodes of an element that does not request
16394 * the actual child nodes of an element until strictly necessary greatly 17029 * the actual child nodes of an element until strictly necessary greatly
16395 * improving performance for the typical cases where it is not required. 17030 * improving performance for the typical cases where it is not required.
16396 */ 17031 */
16397 class _ChildNodeListLazy implements List { 17032 class _ChildNodeListLazy implements List {
16398 final Node _this; 17033 final Node _this;
16399 17034
16400 _ChildNodeListLazy(this._this); 17035 _ChildNodeListLazy(this._this);
16401 17036
16402 17037
16403 Node get first => _this.$dom_firstChild; 17038 Node get first {
16404 Node get last => _this.$dom_lastChild; 17039 Node result = _this.$dom_firstChild;
17040 if (result == null) throw new StateError("No elements");
17041 return result;
17042 }
17043 Node get last {
17044 Node result = _this.$dom_lastChild;
17045 if (result == null) throw new StateError("No elements");
17046 return result;
17047 }
17048 Node get single {
17049 int l = this.length;
17050 if (l == 0) throw new StateError("No elements");
17051 if (l > 1) throw new StateError("More than one element");
17052 return _this.$dom_firstChild;
17053 }
17054
17055 Node min([int compare(Node a, Node b)]) {
17056 return _Collections.minInList(this, compare);
17057 }
17058
17059 Node max([int compare(Node a, Node b)]) {
17060 return _Collections.maxInList(this, compare);
17061 }
16405 17062
16406 void add(Node value) { 17063 void add(Node value) {
16407 _this.$dom_appendChild(value); 17064 _this.$dom_appendChild(value);
16408 } 17065 }
16409 17066
16410 void addLast(Node value) { 17067 void addLast(Node value) {
16411 _this.$dom_appendChild(value); 17068 _this.$dom_appendChild(value);
16412 } 17069 }
16413 17070
16414 17071
16415 void addAll(Collection<Node> collection) { 17072 void addAll(Iterable<Node> iterable) {
16416 for (Node node in collection) { 17073 for (Node node in iterable) {
16417 _this.$dom_appendChild(node); 17074 _this.$dom_appendChild(node);
16418 } 17075 }
16419 } 17076 }
16420 17077
16421 Node removeLast() { 17078 Node removeLast() {
16422 final result = last; 17079 final result = last;
16423 if (result != null) { 17080 if (result != null) {
16424 _this.$dom_removeChild(result); 17081 _this.$dom_removeChild(result);
16425 } 17082 }
16426 return result; 17083 return result;
16427 } 17084 }
16428 17085
16429 Node removeAt(int index) { 17086 Node removeAt(int index) {
16430 var result = this[index]; 17087 var result = this[index];
16431 if (result != null) { 17088 if (result != null) {
16432 _this.$dom_removeChild(result); 17089 _this.$dom_removeChild(result);
16433 } 17090 }
16434 return result; 17091 return result;
16435 } 17092 }
16436 17093
16437 void clear() { 17094 void clear() {
16438 _this.text = ''; 17095 _this.text = '';
16439 } 17096 }
16440 17097
16441 void operator []=(int index, Node value) { 17098 void operator []=(int index, Node value) {
16442 _this.$dom_replaceChild(value, this[index]); 17099 _this.$dom_replaceChild(value, this[index]);
16443 } 17100 }
16444 17101
16445 Iterator<Node> iterator() => _this.$dom_childNodes.iterator(); 17102 Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
16446 17103
16447 // TODO(jacobr): We can implement these methods much more efficiently by 17104 // TODO(jacobr): We can implement these methods much more efficiently by
16448 // looking up the nodeList only once instead of once per iteration. 17105 // looking up the nodeList only once instead of once per iteration.
16449 bool contains(Node element) => Collections.contains(this, element); 17106 bool contains(Node element) => Collections.contains(this, element);
16450 17107
16451 void forEach(void f(Node element)) => Collections.forEach(this, f); 17108 void forEach(void f(Node element)) => Collections.forEach(this, f);
16452 17109
16453 dynamic reduce(dynamic initialValue, 17110 dynamic reduce(dynamic initialValue,
16454 dynamic combine(dynamic previousValue, Node element)) { 17111 dynamic combine(dynamic previousValue, Node element)) {
16455 return Collections.reduce(this, initialValue, combine); 17112 return Collections.reduce(this, initialValue, combine);
16456 } 17113 }
16457 17114
16458 Collection map(f(Node element)) => Collections.map(this, [], f); 17115 String join([String separator]) {
17116 return Collections.joinList(this, separator);
17117 }
16459 17118
16460 Collection<Node> filter(bool f(Node element)) => 17119 List mappedBy(f(Node element)) =>
16461 Collections.filter(this, <Node>[], f); 17120 new MappedList<Node, dynamic>(this, f);
17121
17122 Iterable<Node> where(bool f(Node element)) =>
17123 new WhereIterable<Node>(this, f);
16462 17124
16463 bool every(bool f(Node element)) => Collections.every(this, f); 17125 bool every(bool f(Node element)) => Collections.every(this, f);
16464 17126
16465 bool some(bool f(Node element)) => Collections.some(this, f); 17127 bool any(bool f(Node element)) => Collections.any(this, f);
16466 17128
16467 bool get isEmpty => this.length == 0; 17129 bool get isEmpty => this.length == 0;
16468 17130
16469 // From List<Node>: 17131 // From List<Node>:
16470 17132
17133 List<Node> take(int n) {
17134 return new ListView<Node>(this, 0, n);
17135 }
17136
17137 Iterable<Node> takeWhile(bool test(Node value)) {
17138 return new TakeWhileIterable<Node>(this, test);
17139 }
17140
17141 List<Node> skip(int n) {
17142 return new ListView<Node>(this, n, null);
17143 }
17144
17145 Iterable<Node> skipWhile(bool test(Node value)) {
17146 return new SkipWhileIterable<Node>(this, test);
17147 }
17148
17149 Node firstMatching(bool test(Node value), {Node orElse()}) {
17150 return Collections.firstMatching(this, test, orElse);
17151 }
17152
17153 Node lastMatching(bool test(Node value), {Node orElse()}) {
17154 return Collections.lastMatchingInList(this, test, orElse);
17155 }
17156
17157 Node singleMatching(bool test(Node value)) {
17158 return Collections.singleMatching(this, test);
17159 }
17160
17161 Node elementAt(int index) {
17162 return this[index];
17163 }
17164
16471 // TODO(jacobr): this could be implemented for child node lists. 17165 // TODO(jacobr): this could be implemented for child node lists.
16472 // The exception we throw here is misleading. 17166 // The exception we throw here is misleading.
16473 void sort([int compare(Node a, Node b)]) { 17167 void sort([int compare(Node a, Node b)]) {
16474 throw new UnsupportedError("Cannot sort immutable List."); 17168 throw new UnsupportedError("Cannot sort immutable List.");
16475 } 17169 }
16476 17170
16477 int indexOf(Node element, [int start = 0]) => 17171 int indexOf(Node element, [int start = 0]) =>
16478 Lists.indexOf(this, element, start, this.length); 17172 Lists.indexOf(this, element, start, this.length);
16479 17173
16480 int lastIndexOf(Node element, [int start = 0]) => 17174 int lastIndexOf(Node element, [int start = 0]) =>
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
16802 Node operator[](int index) native "NodeList_item_Callback"; 17496 Node operator[](int index) native "NodeList_item_Callback";
16803 17497
16804 void operator[]=(int index, Node value) { 17498 void operator[]=(int index, Node value) {
16805 throw new UnsupportedError("Cannot assign element of immutable List."); 17499 throw new UnsupportedError("Cannot assign element of immutable List.");
16806 } 17500 }
16807 // -- start List<Node> mixins. 17501 // -- start List<Node> mixins.
16808 // Node is the element type. 17502 // Node is the element type.
16809 17503
16810 // From Iterable<Node>: 17504 // From Iterable<Node>:
16811 17505
16812 Iterator<Node> iterator() { 17506 Iterator<Node> get iterator {
16813 // Note: NodeLists are not fixed size. And most probably length shouldn't 17507 // Note: NodeLists are not fixed size. And most probably length shouldn't
16814 // be cached in both iterator _and_ forEach method. For now caching it 17508 // be cached in both iterator _and_ forEach method. For now caching it
16815 // for consistency. 17509 // for consistency.
16816 return new FixedSizeListIterator<Node>(this); 17510 return new FixedSizeListIterator<Node>(this);
16817 } 17511 }
16818 17512
16819 // From Collection<Node>:
16820
16821 void add(Node value) {
16822 throw new UnsupportedError("Cannot add to immutable List.");
16823 }
16824
16825 void addLast(Node value) {
16826 throw new UnsupportedError("Cannot add to immutable List.");
16827 }
16828
16829 void addAll(Collection<Node> collection) {
16830 throw new UnsupportedError("Cannot add to immutable List.");
16831 }
16832
16833 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) { 17513 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Node)) {
16834 return Collections.reduce(this, initialValue, combine); 17514 return Collections.reduce(this, initialValue, combine);
16835 } 17515 }
16836 17516
16837 bool contains(Node element) => Collections.contains(this, element); 17517 bool contains(Node element) => Collections.contains(this, element);
16838 17518
16839 void forEach(void f(Node element)) => Collections.forEach(this, f); 17519 void forEach(void f(Node element)) => Collections.forEach(this, f);
16840 17520
16841 Collection map(f(Node element)) => Collections.map(this, [], f); 17521 String join([String separator]) => Collections.joinList(this, separator);
16842 17522
16843 Collection<Node> filter(bool f(Node element)) => 17523 List mappedBy(f(Node element)) => new MappedList<Node, dynamic>(this, f);
16844 Collections.filter(this, <Node>[], f); 17524
17525 Iterable<Node> where(bool f(Node element)) => new WhereIterable<Node>(this, f) ;
16845 17526
16846 bool every(bool f(Node element)) => Collections.every(this, f); 17527 bool every(bool f(Node element)) => Collections.every(this, f);
16847 17528
16848 bool some(bool f(Node element)) => Collections.some(this, f); 17529 bool any(bool f(Node element)) => Collections.any(this, f);
16849 17530
16850 bool get isEmpty => this.length == 0; 17531 bool get isEmpty => this.length == 0;
16851 17532
17533 List<Node> take(int n) => new ListView<Node>(this, 0, n);
17534
17535 Iterable<Node> takeWhile(bool test(Node value)) {
17536 return new TakeWhileIterable<Node>(this, test);
17537 }
17538
17539 List<Node> skip(int n) => new ListView<Node>(this, n, null);
17540
17541 Iterable<Node> skipWhile(bool test(Node value)) {
17542 return new SkipWhileIterable<Node>(this, test);
17543 }
17544
17545 Node firstMatching(bool test(Node value), { Node orElse() }) {
17546 return Collections.firstMatching(this, test, orElse);
17547 }
17548
17549 Node lastMatching(bool test(Node value), {Node orElse()}) {
17550 return Collections.lastMatchingInList(this, test, orElse);
17551 }
17552
17553 Node singleMatching(bool test(Node value)) {
17554 return Collections.singleMatching(this, test);
17555 }
17556
17557 Node elementAt(int index) {
17558 return this[index];
17559 }
17560
17561 // From Collection<Node>:
17562
17563 void add(Node value) {
17564 throw new UnsupportedError("Cannot add to immutable List.");
17565 }
17566
17567 void addLast(Node value) {
17568 throw new UnsupportedError("Cannot add to immutable List.");
17569 }
17570
17571 void addAll(Iterable<Node> iterable) {
17572 throw new UnsupportedError("Cannot add to immutable List.");
17573 }
17574
16852 // From List<Node>: 17575 // From List<Node>:
16853 void set length(int value) { 17576 void set length(int value) {
16854 throw new UnsupportedError("Cannot resize immutable List."); 17577 throw new UnsupportedError("Cannot resize immutable List.");
16855 } 17578 }
16856 17579
16857 void clear() { 17580 void clear() {
16858 throw new UnsupportedError("Cannot clear immutable List."); 17581 throw new UnsupportedError("Cannot clear immutable List.");
16859 } 17582 }
16860 17583
16861 void sort([int compare(Node a, Node b)]) { 17584 void sort([int compare(Node a, Node b)]) {
16862 throw new UnsupportedError("Cannot sort immutable List."); 17585 throw new UnsupportedError("Cannot sort immutable List.");
16863 } 17586 }
16864 17587
16865 int indexOf(Node element, [int start = 0]) => 17588 int indexOf(Node element, [int start = 0]) =>
16866 Lists.indexOf(this, element, start, this.length); 17589 Lists.indexOf(this, element, start, this.length);
16867 17590
16868 int lastIndexOf(Node element, [int start]) { 17591 int lastIndexOf(Node element, [int start]) {
16869 if (start == null) start = length - 1; 17592 if (start == null) start = length - 1;
16870 return Lists.lastIndexOf(this, element, start); 17593 return Lists.lastIndexOf(this, element, start);
16871 } 17594 }
16872 17595
16873 Node get first => this[0]; 17596 Node get first {
17597 if (this.length > 0) return this[0];
17598 throw new StateError("No elements");
17599 }
16874 17600
16875 Node get last => this[length - 1]; 17601 Node get last {
17602 if (this.length > 0) return this[this.length - 1];
17603 throw new StateError("No elements");
17604 }
17605
17606 Node get single {
17607 if (length == 1) return this[0];
17608 if (length == 0) throw new StateError("No elements");
17609 throw new StateError("More than one element");
17610 }
17611
17612 Node min([int compare(Node a, Node b)]) => _Collections.minInList(this, compar e);
17613
17614 Node max([int compare(Node a, Node b)]) => _Collections.maxInList(this, compar e);
16876 17615
16877 Node removeAt(int pos) { 17616 Node removeAt(int pos) {
16878 throw new UnsupportedError("Cannot removeAt on immutable List."); 17617 throw new UnsupportedError("Cannot removeAt on immutable List.");
16879 } 17618 }
16880 17619
16881 Node removeLast() { 17620 Node removeLast() {
16882 throw new UnsupportedError("Cannot removeLast on immutable List."); 17621 throw new UnsupportedError("Cannot removeLast on immutable List.");
16883 } 17622 }
16884 17623
16885 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) { 17624 void setRange(int start, int rangeLength, List<Node> from, [int startFrom]) {
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after
19017 Node namedItem(String name) native "HTMLSelectElement_namedItem_Callback"; 19756 Node namedItem(String name) native "HTMLSelectElement_namedItem_Callback";
19018 19757
19019 19758
19020 /** @domName HTMLSelectElement.setCustomValidity */ 19759 /** @domName HTMLSelectElement.setCustomValidity */
19021 void setCustomValidity(String error) native "HTMLSelectElement_setCustomValidi ty_Callback"; 19760 void setCustomValidity(String error) native "HTMLSelectElement_setCustomValidi ty_Callback";
19022 19761
19023 19762
19024 // Override default options, since IE returns SelectElement itself and it 19763 // Override default options, since IE returns SelectElement itself and it
19025 // does not operate as a List. 19764 // does not operate as a List.
19026 List<OptionElement> get options { 19765 List<OptionElement> get options {
19027 return this.children.filter((e) => e is OptionElement); 19766 return this.children.where((e) => e is OptionElement).toList();
19028 } 19767 }
19029 19768
19030 List<OptionElement> get selectedOptions { 19769 List<OptionElement> get selectedOptions {
19031 // IE does not change the selected flag for single-selection items. 19770 // IE does not change the selected flag for single-selection items.
19032 if (this.multiple) { 19771 if (this.multiple) {
19033 return this.options.filter((o) => o.selected); 19772 return this.options.where((o) => o.selected).toList();
19034 } else { 19773 } else {
19035 return [this.options[this.selectedIndex]]; 19774 return [this.options[this.selectedIndex]];
19036 } 19775 }
19037 } 19776 }
19038 } 19777 }
19039 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 19778 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
19040 // for details. All rights reserved. Use of this source code is governed by a 19779 // for details. All rights reserved. Use of this source code is governed by a
19041 // BSD-style license that can be found in the LICENSE file. 19780 // BSD-style license that can be found in the LICENSE file.
19042 19781
19043 // WARNING: Do not edit - generated code. 19782 // WARNING: Do not edit - generated code.
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
19234 SourceBuffer operator[](int index) native "SourceBufferList_item_Callback"; 19973 SourceBuffer operator[](int index) native "SourceBufferList_item_Callback";
19235 19974
19236 void operator[]=(int index, SourceBuffer value) { 19975 void operator[]=(int index, SourceBuffer value) {
19237 throw new UnsupportedError("Cannot assign element of immutable List."); 19976 throw new UnsupportedError("Cannot assign element of immutable List.");
19238 } 19977 }
19239 // -- start List<SourceBuffer> mixins. 19978 // -- start List<SourceBuffer> mixins.
19240 // SourceBuffer is the element type. 19979 // SourceBuffer is the element type.
19241 19980
19242 // From Iterable<SourceBuffer>: 19981 // From Iterable<SourceBuffer>:
19243 19982
19244 Iterator<SourceBuffer> iterator() { 19983 Iterator<SourceBuffer> get iterator {
19245 // Note: NodeLists are not fixed size. And most probably length shouldn't 19984 // Note: NodeLists are not fixed size. And most probably length shouldn't
19246 // be cached in both iterator _and_ forEach method. For now caching it 19985 // be cached in both iterator _and_ forEach method. For now caching it
19247 // for consistency. 19986 // for consistency.
19248 return new FixedSizeListIterator<SourceBuffer>(this); 19987 return new FixedSizeListIterator<SourceBuffer>(this);
19249 } 19988 }
19250 19989
19251 // From Collection<SourceBuffer>:
19252
19253 void add(SourceBuffer value) {
19254 throw new UnsupportedError("Cannot add to immutable List.");
19255 }
19256
19257 void addLast(SourceBuffer value) {
19258 throw new UnsupportedError("Cannot add to immutable List.");
19259 }
19260
19261 void addAll(Collection<SourceBuffer> collection) {
19262 throw new UnsupportedError("Cannot add to immutable List.");
19263 }
19264
19265 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SourceBuffer)) { 19990 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SourceBuffer)) {
19266 return Collections.reduce(this, initialValue, combine); 19991 return Collections.reduce(this, initialValue, combine);
19267 } 19992 }
19268 19993
19269 bool contains(SourceBuffer element) => Collections.contains(this, element); 19994 bool contains(SourceBuffer element) => Collections.contains(this, element);
19270 19995
19271 void forEach(void f(SourceBuffer element)) => Collections.forEach(this, f); 19996 void forEach(void f(SourceBuffer element)) => Collections.forEach(this, f);
19272 19997
19273 Collection map(f(SourceBuffer element)) => Collections.map(this, [], f); 19998 String join([String separator]) => Collections.joinList(this, separator);
19274 19999
19275 Collection<SourceBuffer> filter(bool f(SourceBuffer element)) => 20000 List mappedBy(f(SourceBuffer element)) => new MappedList<SourceBuffer, dynamic >(this, f);
19276 Collections.filter(this, <SourceBuffer>[], f); 20001
20002 Iterable<SourceBuffer> where(bool f(SourceBuffer element)) => new WhereIterabl e<SourceBuffer>(this, f);
19277 20003
19278 bool every(bool f(SourceBuffer element)) => Collections.every(this, f); 20004 bool every(bool f(SourceBuffer element)) => Collections.every(this, f);
19279 20005
19280 bool some(bool f(SourceBuffer element)) => Collections.some(this, f); 20006 bool any(bool f(SourceBuffer element)) => Collections.any(this, f);
19281 20007
19282 bool get isEmpty => this.length == 0; 20008 bool get isEmpty => this.length == 0;
19283 20009
20010 List<SourceBuffer> take(int n) => new ListView<SourceBuffer>(this, 0, n);
20011
20012 Iterable<SourceBuffer> takeWhile(bool test(SourceBuffer value)) {
20013 return new TakeWhileIterable<SourceBuffer>(this, test);
20014 }
20015
20016 List<SourceBuffer> skip(int n) => new ListView<SourceBuffer>(this, n, null);
20017
20018 Iterable<SourceBuffer> skipWhile(bool test(SourceBuffer value)) {
20019 return new SkipWhileIterable<SourceBuffer>(this, test);
20020 }
20021
20022 SourceBuffer firstMatching(bool test(SourceBuffer value), { SourceBuffer orEls e() }) {
20023 return Collections.firstMatching(this, test, orElse);
20024 }
20025
20026 SourceBuffer lastMatching(bool test(SourceBuffer value), {SourceBuffer orElse( )}) {
20027 return Collections.lastMatchingInList(this, test, orElse);
20028 }
20029
20030 SourceBuffer singleMatching(bool test(SourceBuffer value)) {
20031 return Collections.singleMatching(this, test);
20032 }
20033
20034 SourceBuffer elementAt(int index) {
20035 return this[index];
20036 }
20037
20038 // From Collection<SourceBuffer>:
20039
20040 void add(SourceBuffer value) {
20041 throw new UnsupportedError("Cannot add to immutable List.");
20042 }
20043
20044 void addLast(SourceBuffer value) {
20045 throw new UnsupportedError("Cannot add to immutable List.");
20046 }
20047
20048 void addAll(Iterable<SourceBuffer> iterable) {
20049 throw new UnsupportedError("Cannot add to immutable List.");
20050 }
20051
19284 // From List<SourceBuffer>: 20052 // From List<SourceBuffer>:
19285 void set length(int value) { 20053 void set length(int value) {
19286 throw new UnsupportedError("Cannot resize immutable List."); 20054 throw new UnsupportedError("Cannot resize immutable List.");
19287 } 20055 }
19288 20056
19289 void clear() { 20057 void clear() {
19290 throw new UnsupportedError("Cannot clear immutable List."); 20058 throw new UnsupportedError("Cannot clear immutable List.");
19291 } 20059 }
19292 20060
19293 void sort([int compare(SourceBuffer a, SourceBuffer b)]) { 20061 void sort([int compare(SourceBuffer a, SourceBuffer b)]) {
19294 throw new UnsupportedError("Cannot sort immutable List."); 20062 throw new UnsupportedError("Cannot sort immutable List.");
19295 } 20063 }
19296 20064
19297 int indexOf(SourceBuffer element, [int start = 0]) => 20065 int indexOf(SourceBuffer element, [int start = 0]) =>
19298 Lists.indexOf(this, element, start, this.length); 20066 Lists.indexOf(this, element, start, this.length);
19299 20067
19300 int lastIndexOf(SourceBuffer element, [int start]) { 20068 int lastIndexOf(SourceBuffer element, [int start]) {
19301 if (start == null) start = length - 1; 20069 if (start == null) start = length - 1;
19302 return Lists.lastIndexOf(this, element, start); 20070 return Lists.lastIndexOf(this, element, start);
19303 } 20071 }
19304 20072
19305 SourceBuffer get first => this[0]; 20073 SourceBuffer get first {
20074 if (this.length > 0) return this[0];
20075 throw new StateError("No elements");
20076 }
19306 20077
19307 SourceBuffer get last => this[length - 1]; 20078 SourceBuffer get last {
20079 if (this.length > 0) return this[this.length - 1];
20080 throw new StateError("No elements");
20081 }
20082
20083 SourceBuffer get single {
20084 if (length == 1) return this[0];
20085 if (length == 0) throw new StateError("No elements");
20086 throw new StateError("More than one element");
20087 }
20088
20089 SourceBuffer min([int compare(SourceBuffer a, SourceBuffer b)]) => _Collection s.minInList(this, compare);
20090
20091 SourceBuffer max([int compare(SourceBuffer a, SourceBuffer b)]) => _Collection s.maxInList(this, compare);
19308 20092
19309 SourceBuffer removeAt(int pos) { 20093 SourceBuffer removeAt(int pos) {
19310 throw new UnsupportedError("Cannot removeAt on immutable List."); 20094 throw new UnsupportedError("Cannot removeAt on immutable List.");
19311 } 20095 }
19312 20096
19313 SourceBuffer removeLast() { 20097 SourceBuffer removeLast() {
19314 throw new UnsupportedError("Cannot removeLast on immutable List."); 20098 throw new UnsupportedError("Cannot removeLast on immutable List.");
19315 } 20099 }
19316 20100
19317 void setRange(int start, int rangeLength, List<SourceBuffer> from, [int startF rom]) { 20101 void setRange(int start, int rangeLength, List<SourceBuffer> from, [int startF rom]) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
19456 SpeechGrammar operator[](int index) native "SpeechGrammarList_item_Callback"; 20240 SpeechGrammar operator[](int index) native "SpeechGrammarList_item_Callback";
19457 20241
19458 void operator[]=(int index, SpeechGrammar value) { 20242 void operator[]=(int index, SpeechGrammar value) {
19459 throw new UnsupportedError("Cannot assign element of immutable List."); 20243 throw new UnsupportedError("Cannot assign element of immutable List.");
19460 } 20244 }
19461 // -- start List<SpeechGrammar> mixins. 20245 // -- start List<SpeechGrammar> mixins.
19462 // SpeechGrammar is the element type. 20246 // SpeechGrammar is the element type.
19463 20247
19464 // From Iterable<SpeechGrammar>: 20248 // From Iterable<SpeechGrammar>:
19465 20249
19466 Iterator<SpeechGrammar> iterator() { 20250 Iterator<SpeechGrammar> get iterator {
19467 // Note: NodeLists are not fixed size. And most probably length shouldn't 20251 // Note: NodeLists are not fixed size. And most probably length shouldn't
19468 // be cached in both iterator _and_ forEach method. For now caching it 20252 // be cached in both iterator _and_ forEach method. For now caching it
19469 // for consistency. 20253 // for consistency.
19470 return new FixedSizeListIterator<SpeechGrammar>(this); 20254 return new FixedSizeListIterator<SpeechGrammar>(this);
19471 } 20255 }
19472 20256
20257 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechGrammar)) {
20258 return Collections.reduce(this, initialValue, combine);
20259 }
20260
20261 bool contains(SpeechGrammar element) => Collections.contains(this, element);
20262
20263 void forEach(void f(SpeechGrammar element)) => Collections.forEach(this, f);
20264
20265 String join([String separator]) => Collections.joinList(this, separator);
20266
20267 List mappedBy(f(SpeechGrammar element)) => new MappedList<SpeechGrammar, dynam ic>(this, f);
20268
20269 Iterable<SpeechGrammar> where(bool f(SpeechGrammar element)) => new WhereItera ble<SpeechGrammar>(this, f);
20270
20271 bool every(bool f(SpeechGrammar element)) => Collections.every(this, f);
20272
20273 bool any(bool f(SpeechGrammar element)) => Collections.any(this, f);
20274
20275 bool get isEmpty => this.length == 0;
20276
20277 List<SpeechGrammar> take(int n) => new ListView<SpeechGrammar>(this, 0, n);
20278
20279 Iterable<SpeechGrammar> takeWhile(bool test(SpeechGrammar value)) {
20280 return new TakeWhileIterable<SpeechGrammar>(this, test);
20281 }
20282
20283 List<SpeechGrammar> skip(int n) => new ListView<SpeechGrammar>(this, n, null);
20284
20285 Iterable<SpeechGrammar> skipWhile(bool test(SpeechGrammar value)) {
20286 return new SkipWhileIterable<SpeechGrammar>(this, test);
20287 }
20288
20289 SpeechGrammar firstMatching(bool test(SpeechGrammar value), { SpeechGrammar or Else() }) {
20290 return Collections.firstMatching(this, test, orElse);
20291 }
20292
20293 SpeechGrammar lastMatching(bool test(SpeechGrammar value), {SpeechGrammar orEl se()}) {
20294 return Collections.lastMatchingInList(this, test, orElse);
20295 }
20296
20297 SpeechGrammar singleMatching(bool test(SpeechGrammar value)) {
20298 return Collections.singleMatching(this, test);
20299 }
20300
20301 SpeechGrammar elementAt(int index) {
20302 return this[index];
20303 }
20304
19473 // From Collection<SpeechGrammar>: 20305 // From Collection<SpeechGrammar>:
19474 20306
19475 void add(SpeechGrammar value) { 20307 void add(SpeechGrammar value) {
19476 throw new UnsupportedError("Cannot add to immutable List."); 20308 throw new UnsupportedError("Cannot add to immutable List.");
19477 } 20309 }
19478 20310
19479 void addLast(SpeechGrammar value) { 20311 void addLast(SpeechGrammar value) {
19480 throw new UnsupportedError("Cannot add to immutable List."); 20312 throw new UnsupportedError("Cannot add to immutable List.");
19481 } 20313 }
19482 20314
19483 void addAll(Collection<SpeechGrammar> collection) { 20315 void addAll(Iterable<SpeechGrammar> iterable) {
19484 throw new UnsupportedError("Cannot add to immutable List."); 20316 throw new UnsupportedError("Cannot add to immutable List.");
19485 } 20317 }
19486 20318
19487 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechGrammar)) {
19488 return Collections.reduce(this, initialValue, combine);
19489 }
19490
19491 bool contains(SpeechGrammar element) => Collections.contains(this, element);
19492
19493 void forEach(void f(SpeechGrammar element)) => Collections.forEach(this, f);
19494
19495 Collection map(f(SpeechGrammar element)) => Collections.map(this, [], f);
19496
19497 Collection<SpeechGrammar> filter(bool f(SpeechGrammar element)) =>
19498 Collections.filter(this, <SpeechGrammar>[], f);
19499
19500 bool every(bool f(SpeechGrammar element)) => Collections.every(this, f);
19501
19502 bool some(bool f(SpeechGrammar element)) => Collections.some(this, f);
19503
19504 bool get isEmpty => this.length == 0;
19505
19506 // From List<SpeechGrammar>: 20319 // From List<SpeechGrammar>:
19507 void set length(int value) { 20320 void set length(int value) {
19508 throw new UnsupportedError("Cannot resize immutable List."); 20321 throw new UnsupportedError("Cannot resize immutable List.");
19509 } 20322 }
19510 20323
19511 void clear() { 20324 void clear() {
19512 throw new UnsupportedError("Cannot clear immutable List."); 20325 throw new UnsupportedError("Cannot clear immutable List.");
19513 } 20326 }
19514 20327
19515 void sort([int compare(SpeechGrammar a, SpeechGrammar b)]) { 20328 void sort([int compare(SpeechGrammar a, SpeechGrammar b)]) {
19516 throw new UnsupportedError("Cannot sort immutable List."); 20329 throw new UnsupportedError("Cannot sort immutable List.");
19517 } 20330 }
19518 20331
19519 int indexOf(SpeechGrammar element, [int start = 0]) => 20332 int indexOf(SpeechGrammar element, [int start = 0]) =>
19520 Lists.indexOf(this, element, start, this.length); 20333 Lists.indexOf(this, element, start, this.length);
19521 20334
19522 int lastIndexOf(SpeechGrammar element, [int start]) { 20335 int lastIndexOf(SpeechGrammar element, [int start]) {
19523 if (start == null) start = length - 1; 20336 if (start == null) start = length - 1;
19524 return Lists.lastIndexOf(this, element, start); 20337 return Lists.lastIndexOf(this, element, start);
19525 } 20338 }
19526 20339
19527 SpeechGrammar get first => this[0]; 20340 SpeechGrammar get first {
20341 if (this.length > 0) return this[0];
20342 throw new StateError("No elements");
20343 }
19528 20344
19529 SpeechGrammar get last => this[length - 1]; 20345 SpeechGrammar get last {
20346 if (this.length > 0) return this[this.length - 1];
20347 throw new StateError("No elements");
20348 }
20349
20350 SpeechGrammar get single {
20351 if (length == 1) return this[0];
20352 if (length == 0) throw new StateError("No elements");
20353 throw new StateError("More than one element");
20354 }
20355
20356 SpeechGrammar min([int compare(SpeechGrammar a, SpeechGrammar b)]) => _Collect ions.minInList(this, compare);
20357
20358 SpeechGrammar max([int compare(SpeechGrammar a, SpeechGrammar b)]) => _Collect ions.maxInList(this, compare);
19530 20359
19531 SpeechGrammar removeAt(int pos) { 20360 SpeechGrammar removeAt(int pos) {
19532 throw new UnsupportedError("Cannot removeAt on immutable List."); 20361 throw new UnsupportedError("Cannot removeAt on immutable List.");
19533 } 20362 }
19534 20363
19535 SpeechGrammar removeLast() { 20364 SpeechGrammar removeLast() {
19536 throw new UnsupportedError("Cannot removeLast on immutable List."); 20365 throw new UnsupportedError("Cannot removeLast on immutable List.");
19537 } 20366 }
19538 20367
19539 void setRange(int start, int rangeLength, List<SpeechGrammar> from, [int start From]) { 20368 void setRange(int start, int rangeLength, List<SpeechGrammar> from, [int start From]) {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
19955 Map operator[](int index) native "SQLResultSetRowList_item_Callback"; 20784 Map operator[](int index) native "SQLResultSetRowList_item_Callback";
19956 20785
19957 void operator[]=(int index, Map value) { 20786 void operator[]=(int index, Map value) {
19958 throw new UnsupportedError("Cannot assign element of immutable List."); 20787 throw new UnsupportedError("Cannot assign element of immutable List.");
19959 } 20788 }
19960 // -- start List<Map> mixins. 20789 // -- start List<Map> mixins.
19961 // Map is the element type. 20790 // Map is the element type.
19962 20791
19963 // From Iterable<Map>: 20792 // From Iterable<Map>:
19964 20793
19965 Iterator<Map> iterator() { 20794 Iterator<Map> get iterator {
19966 // Note: NodeLists are not fixed size. And most probably length shouldn't 20795 // Note: NodeLists are not fixed size. And most probably length shouldn't
19967 // be cached in both iterator _and_ forEach method. For now caching it 20796 // be cached in both iterator _and_ forEach method. For now caching it
19968 // for consistency. 20797 // for consistency.
19969 return new FixedSizeListIterator<Map>(this); 20798 return new FixedSizeListIterator<Map>(this);
19970 } 20799 }
19971 20800
19972 // From Collection<Map>:
19973
19974 void add(Map value) {
19975 throw new UnsupportedError("Cannot add to immutable List.");
19976 }
19977
19978 void addLast(Map value) {
19979 throw new UnsupportedError("Cannot add to immutable List.");
19980 }
19981
19982 void addAll(Collection<Map> collection) {
19983 throw new UnsupportedError("Cannot add to immutable List.");
19984 }
19985
19986 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Map)) { 20801 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Map)) {
19987 return Collections.reduce(this, initialValue, combine); 20802 return Collections.reduce(this, initialValue, combine);
19988 } 20803 }
19989 20804
19990 bool contains(Map element) => Collections.contains(this, element); 20805 bool contains(Map element) => Collections.contains(this, element);
19991 20806
19992 void forEach(void f(Map element)) => Collections.forEach(this, f); 20807 void forEach(void f(Map element)) => Collections.forEach(this, f);
19993 20808
19994 Collection map(f(Map element)) => Collections.map(this, [], f); 20809 String join([String separator]) => Collections.joinList(this, separator);
19995 20810
19996 Collection<Map> filter(bool f(Map element)) => 20811 List mappedBy(f(Map element)) => new MappedList<Map, dynamic>(this, f);
19997 Collections.filter(this, <Map>[], f); 20812
20813 Iterable<Map> where(bool f(Map element)) => new WhereIterable<Map>(this, f);
19998 20814
19999 bool every(bool f(Map element)) => Collections.every(this, f); 20815 bool every(bool f(Map element)) => Collections.every(this, f);
20000 20816
20001 bool some(bool f(Map element)) => Collections.some(this, f); 20817 bool any(bool f(Map element)) => Collections.any(this, f);
20002 20818
20003 bool get isEmpty => this.length == 0; 20819 bool get isEmpty => this.length == 0;
20004 20820
20821 List<Map> take(int n) => new ListView<Map>(this, 0, n);
20822
20823 Iterable<Map> takeWhile(bool test(Map value)) {
20824 return new TakeWhileIterable<Map>(this, test);
20825 }
20826
20827 List<Map> skip(int n) => new ListView<Map>(this, n, null);
20828
20829 Iterable<Map> skipWhile(bool test(Map value)) {
20830 return new SkipWhileIterable<Map>(this, test);
20831 }
20832
20833 Map firstMatching(bool test(Map value), { Map orElse() }) {
20834 return Collections.firstMatching(this, test, orElse);
20835 }
20836
20837 Map lastMatching(bool test(Map value), {Map orElse()}) {
20838 return Collections.lastMatchingInList(this, test, orElse);
20839 }
20840
20841 Map singleMatching(bool test(Map value)) {
20842 return Collections.singleMatching(this, test);
20843 }
20844
20845 Map elementAt(int index) {
20846 return this[index];
20847 }
20848
20849 // From Collection<Map>:
20850
20851 void add(Map value) {
20852 throw new UnsupportedError("Cannot add to immutable List.");
20853 }
20854
20855 void addLast(Map value) {
20856 throw new UnsupportedError("Cannot add to immutable List.");
20857 }
20858
20859 void addAll(Iterable<Map> iterable) {
20860 throw new UnsupportedError("Cannot add to immutable List.");
20861 }
20862
20005 // From List<Map>: 20863 // From List<Map>:
20006 void set length(int value) { 20864 void set length(int value) {
20007 throw new UnsupportedError("Cannot resize immutable List."); 20865 throw new UnsupportedError("Cannot resize immutable List.");
20008 } 20866 }
20009 20867
20010 void clear() { 20868 void clear() {
20011 throw new UnsupportedError("Cannot clear immutable List."); 20869 throw new UnsupportedError("Cannot clear immutable List.");
20012 } 20870 }
20013 20871
20014 void sort([int compare(Map a, Map b)]) { 20872 void sort([int compare(Map a, Map b)]) {
20015 throw new UnsupportedError("Cannot sort immutable List."); 20873 throw new UnsupportedError("Cannot sort immutable List.");
20016 } 20874 }
20017 20875
20018 int indexOf(Map element, [int start = 0]) => 20876 int indexOf(Map element, [int start = 0]) =>
20019 Lists.indexOf(this, element, start, this.length); 20877 Lists.indexOf(this, element, start, this.length);
20020 20878
20021 int lastIndexOf(Map element, [int start]) { 20879 int lastIndexOf(Map element, [int start]) {
20022 if (start == null) start = length - 1; 20880 if (start == null) start = length - 1;
20023 return Lists.lastIndexOf(this, element, start); 20881 return Lists.lastIndexOf(this, element, start);
20024 } 20882 }
20025 20883
20026 Map get first => this[0]; 20884 Map get first {
20885 if (this.length > 0) return this[0];
20886 throw new StateError("No elements");
20887 }
20027 20888
20028 Map get last => this[length - 1]; 20889 Map get last {
20890 if (this.length > 0) return this[this.length - 1];
20891 throw new StateError("No elements");
20892 }
20893
20894 Map get single {
20895 if (length == 1) return this[0];
20896 if (length == 0) throw new StateError("No elements");
20897 throw new StateError("More than one element");
20898 }
20899
20900 Map min([int compare(Map a, Map b)]) => _Collections.minInList(this, compare);
20901
20902 Map max([int compare(Map a, Map b)]) => _Collections.maxInList(this, compare);
20029 20903
20030 Map removeAt(int pos) { 20904 Map removeAt(int pos) {
20031 throw new UnsupportedError("Cannot removeAt on immutable List."); 20905 throw new UnsupportedError("Cannot removeAt on immutable List.");
20032 } 20906 }
20033 20907
20034 Map removeLast() { 20908 Map removeLast() {
20035 throw new UnsupportedError("Cannot removeLast on immutable List."); 20909 throw new UnsupportedError("Cannot removeLast on immutable List.");
20036 } 20910 }
20037 20911
20038 void setRange(int start, int rangeLength, List<Map> from, [int startFrom]) { 20912 void setRange(int start, int rangeLength, List<Map> from, [int startFrom]) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
20091 } 20965 }
20092 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 20966 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
20093 // for details. All rights reserved. Use of this source code is governed by a 20967 // for details. All rights reserved. Use of this source code is governed by a
20094 // BSD-style license that can be found in the LICENSE file. 20968 // BSD-style license that can be found in the LICENSE file.
20095 20969
20096 20970
20097 /// @domName Storage 20971 /// @domName Storage
20098 class Storage extends NativeFieldWrapperClass1 implements Map<String, String> { 20972 class Storage extends NativeFieldWrapperClass1 implements Map<String, String> {
20099 20973
20100 // TODO(nweiz): update this when maps support lazy iteration 20974 // TODO(nweiz): update this when maps support lazy iteration
20101 bool containsValue(String value) => values.some((e) => e == value); 20975 bool containsValue(String value) => values.any((e) => e == value);
20102 20976
20103 bool containsKey(String key) => $dom_getItem(key) != null; 20977 bool containsKey(String key) => $dom_getItem(key) != null;
20104 20978
20105 String operator [](String key) => $dom_getItem(key); 20979 String operator [](String key) => $dom_getItem(key);
20106 20980
20107 void operator []=(String key, String value) { $dom_setItem(key, value); } 20981 void operator []=(String key, String value) { $dom_setItem(key, value); }
20108 20982
20109 String putIfAbsent(String key, String ifAbsent()) { 20983 String putIfAbsent(String key, String ifAbsent()) {
20110 if (!containsKey(key)) this[key] = ifAbsent(); 20984 if (!containsKey(key)) this[key] = ifAbsent();
20111 return this[key]; 20985 return this[key];
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
21127 TextTrackCue operator[](int index) native "TextTrackCueList_item_Callback"; 22001 TextTrackCue operator[](int index) native "TextTrackCueList_item_Callback";
21128 22002
21129 void operator[]=(int index, TextTrackCue value) { 22003 void operator[]=(int index, TextTrackCue value) {
21130 throw new UnsupportedError("Cannot assign element of immutable List."); 22004 throw new UnsupportedError("Cannot assign element of immutable List.");
21131 } 22005 }
21132 // -- start List<TextTrackCue> mixins. 22006 // -- start List<TextTrackCue> mixins.
21133 // TextTrackCue is the element type. 22007 // TextTrackCue is the element type.
21134 22008
21135 // From Iterable<TextTrackCue>: 22009 // From Iterable<TextTrackCue>:
21136 22010
21137 Iterator<TextTrackCue> iterator() { 22011 Iterator<TextTrackCue> get iterator {
21138 // Note: NodeLists are not fixed size. And most probably length shouldn't 22012 // Note: NodeLists are not fixed size. And most probably length shouldn't
21139 // be cached in both iterator _and_ forEach method. For now caching it 22013 // be cached in both iterator _and_ forEach method. For now caching it
21140 // for consistency. 22014 // for consistency.
21141 return new FixedSizeListIterator<TextTrackCue>(this); 22015 return new FixedSizeListIterator<TextTrackCue>(this);
21142 } 22016 }
21143 22017
21144 // From Collection<TextTrackCue>:
21145
21146 void add(TextTrackCue value) {
21147 throw new UnsupportedError("Cannot add to immutable List.");
21148 }
21149
21150 void addLast(TextTrackCue value) {
21151 throw new UnsupportedError("Cannot add to immutable List.");
21152 }
21153
21154 void addAll(Collection<TextTrackCue> collection) {
21155 throw new UnsupportedError("Cannot add to immutable List.");
21156 }
21157
21158 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrackCue)) { 22018 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrackCue)) {
21159 return Collections.reduce(this, initialValue, combine); 22019 return Collections.reduce(this, initialValue, combine);
21160 } 22020 }
21161 22021
21162 bool contains(TextTrackCue element) => Collections.contains(this, element); 22022 bool contains(TextTrackCue element) => Collections.contains(this, element);
21163 22023
21164 void forEach(void f(TextTrackCue element)) => Collections.forEach(this, f); 22024 void forEach(void f(TextTrackCue element)) => Collections.forEach(this, f);
21165 22025
21166 Collection map(f(TextTrackCue element)) => Collections.map(this, [], f); 22026 String join([String separator]) => Collections.joinList(this, separator);
21167 22027
21168 Collection<TextTrackCue> filter(bool f(TextTrackCue element)) => 22028 List mappedBy(f(TextTrackCue element)) => new MappedList<TextTrackCue, dynamic >(this, f);
21169 Collections.filter(this, <TextTrackCue>[], f); 22029
22030 Iterable<TextTrackCue> where(bool f(TextTrackCue element)) => new WhereIterabl e<TextTrackCue>(this, f);
21170 22031
21171 bool every(bool f(TextTrackCue element)) => Collections.every(this, f); 22032 bool every(bool f(TextTrackCue element)) => Collections.every(this, f);
21172 22033
21173 bool some(bool f(TextTrackCue element)) => Collections.some(this, f); 22034 bool any(bool f(TextTrackCue element)) => Collections.any(this, f);
21174 22035
21175 bool get isEmpty => this.length == 0; 22036 bool get isEmpty => this.length == 0;
21176 22037
22038 List<TextTrackCue> take(int n) => new ListView<TextTrackCue>(this, 0, n);
22039
22040 Iterable<TextTrackCue> takeWhile(bool test(TextTrackCue value)) {
22041 return new TakeWhileIterable<TextTrackCue>(this, test);
22042 }
22043
22044 List<TextTrackCue> skip(int n) => new ListView<TextTrackCue>(this, n, null);
22045
22046 Iterable<TextTrackCue> skipWhile(bool test(TextTrackCue value)) {
22047 return new SkipWhileIterable<TextTrackCue>(this, test);
22048 }
22049
22050 TextTrackCue firstMatching(bool test(TextTrackCue value), { TextTrackCue orEls e() }) {
22051 return Collections.firstMatching(this, test, orElse);
22052 }
22053
22054 TextTrackCue lastMatching(bool test(TextTrackCue value), {TextTrackCue orElse( )}) {
22055 return Collections.lastMatchingInList(this, test, orElse);
22056 }
22057
22058 TextTrackCue singleMatching(bool test(TextTrackCue value)) {
22059 return Collections.singleMatching(this, test);
22060 }
22061
22062 TextTrackCue elementAt(int index) {
22063 return this[index];
22064 }
22065
22066 // From Collection<TextTrackCue>:
22067
22068 void add(TextTrackCue value) {
22069 throw new UnsupportedError("Cannot add to immutable List.");
22070 }
22071
22072 void addLast(TextTrackCue value) {
22073 throw new UnsupportedError("Cannot add to immutable List.");
22074 }
22075
22076 void addAll(Iterable<TextTrackCue> iterable) {
22077 throw new UnsupportedError("Cannot add to immutable List.");
22078 }
22079
21177 // From List<TextTrackCue>: 22080 // From List<TextTrackCue>:
21178 void set length(int value) { 22081 void set length(int value) {
21179 throw new UnsupportedError("Cannot resize immutable List."); 22082 throw new UnsupportedError("Cannot resize immutable List.");
21180 } 22083 }
21181 22084
21182 void clear() { 22085 void clear() {
21183 throw new UnsupportedError("Cannot clear immutable List."); 22086 throw new UnsupportedError("Cannot clear immutable List.");
21184 } 22087 }
21185 22088
21186 void sort([int compare(TextTrackCue a, TextTrackCue b)]) { 22089 void sort([int compare(TextTrackCue a, TextTrackCue b)]) {
21187 throw new UnsupportedError("Cannot sort immutable List."); 22090 throw new UnsupportedError("Cannot sort immutable List.");
21188 } 22091 }
21189 22092
21190 int indexOf(TextTrackCue element, [int start = 0]) => 22093 int indexOf(TextTrackCue element, [int start = 0]) =>
21191 Lists.indexOf(this, element, start, this.length); 22094 Lists.indexOf(this, element, start, this.length);
21192 22095
21193 int lastIndexOf(TextTrackCue element, [int start]) { 22096 int lastIndexOf(TextTrackCue element, [int start]) {
21194 if (start == null) start = length - 1; 22097 if (start == null) start = length - 1;
21195 return Lists.lastIndexOf(this, element, start); 22098 return Lists.lastIndexOf(this, element, start);
21196 } 22099 }
21197 22100
21198 TextTrackCue get first => this[0]; 22101 TextTrackCue get first {
22102 if (this.length > 0) return this[0];
22103 throw new StateError("No elements");
22104 }
21199 22105
21200 TextTrackCue get last => this[length - 1]; 22106 TextTrackCue get last {
22107 if (this.length > 0) return this[this.length - 1];
22108 throw new StateError("No elements");
22109 }
22110
22111 TextTrackCue get single {
22112 if (length == 1) return this[0];
22113 if (length == 0) throw new StateError("No elements");
22114 throw new StateError("More than one element");
22115 }
22116
22117 TextTrackCue min([int compare(TextTrackCue a, TextTrackCue b)]) => _Collection s.minInList(this, compare);
22118
22119 TextTrackCue max([int compare(TextTrackCue a, TextTrackCue b)]) => _Collection s.maxInList(this, compare);
21201 22120
21202 TextTrackCue removeAt(int pos) { 22121 TextTrackCue removeAt(int pos) {
21203 throw new UnsupportedError("Cannot removeAt on immutable List."); 22122 throw new UnsupportedError("Cannot removeAt on immutable List.");
21204 } 22123 }
21205 22124
21206 TextTrackCue removeLast() { 22125 TextTrackCue removeLast() {
21207 throw new UnsupportedError("Cannot removeLast on immutable List."); 22126 throw new UnsupportedError("Cannot removeLast on immutable List.");
21208 } 22127 }
21209 22128
21210 void setRange(int start, int rangeLength, List<TextTrackCue> from, [int startF rom]) { 22129 void setRange(int start, int rangeLength, List<TextTrackCue> from, [int startF rom]) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
21255 TextTrack operator[](int index) native "TextTrackList_item_Callback"; 22174 TextTrack operator[](int index) native "TextTrackList_item_Callback";
21256 22175
21257 void operator[]=(int index, TextTrack value) { 22176 void operator[]=(int index, TextTrack value) {
21258 throw new UnsupportedError("Cannot assign element of immutable List."); 22177 throw new UnsupportedError("Cannot assign element of immutable List.");
21259 } 22178 }
21260 // -- start List<TextTrack> mixins. 22179 // -- start List<TextTrack> mixins.
21261 // TextTrack is the element type. 22180 // TextTrack is the element type.
21262 22181
21263 // From Iterable<TextTrack>: 22182 // From Iterable<TextTrack>:
21264 22183
21265 Iterator<TextTrack> iterator() { 22184 Iterator<TextTrack> get iterator {
21266 // Note: NodeLists are not fixed size. And most probably length shouldn't 22185 // Note: NodeLists are not fixed size. And most probably length shouldn't
21267 // be cached in both iterator _and_ forEach method. For now caching it 22186 // be cached in both iterator _and_ forEach method. For now caching it
21268 // for consistency. 22187 // for consistency.
21269 return new FixedSizeListIterator<TextTrack>(this); 22188 return new FixedSizeListIterator<TextTrack>(this);
21270 } 22189 }
21271 22190
21272 // From Collection<TextTrack>:
21273
21274 void add(TextTrack value) {
21275 throw new UnsupportedError("Cannot add to immutable List.");
21276 }
21277
21278 void addLast(TextTrack value) {
21279 throw new UnsupportedError("Cannot add to immutable List.");
21280 }
21281
21282 void addAll(Collection<TextTrack> collection) {
21283 throw new UnsupportedError("Cannot add to immutable List.");
21284 }
21285
21286 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrack)) { 22191 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, TextTrack)) {
21287 return Collections.reduce(this, initialValue, combine); 22192 return Collections.reduce(this, initialValue, combine);
21288 } 22193 }
21289 22194
21290 bool contains(TextTrack element) => Collections.contains(this, element); 22195 bool contains(TextTrack element) => Collections.contains(this, element);
21291 22196
21292 void forEach(void f(TextTrack element)) => Collections.forEach(this, f); 22197 void forEach(void f(TextTrack element)) => Collections.forEach(this, f);
21293 22198
21294 Collection map(f(TextTrack element)) => Collections.map(this, [], f); 22199 String join([String separator]) => Collections.joinList(this, separator);
21295 22200
21296 Collection<TextTrack> filter(bool f(TextTrack element)) => 22201 List mappedBy(f(TextTrack element)) => new MappedList<TextTrack, dynamic>(this , f);
21297 Collections.filter(this, <TextTrack>[], f); 22202
22203 Iterable<TextTrack> where(bool f(TextTrack element)) => new WhereIterable<Text Track>(this, f);
21298 22204
21299 bool every(bool f(TextTrack element)) => Collections.every(this, f); 22205 bool every(bool f(TextTrack element)) => Collections.every(this, f);
21300 22206
21301 bool some(bool f(TextTrack element)) => Collections.some(this, f); 22207 bool any(bool f(TextTrack element)) => Collections.any(this, f);
21302 22208
21303 bool get isEmpty => this.length == 0; 22209 bool get isEmpty => this.length == 0;
21304 22210
22211 List<TextTrack> take(int n) => new ListView<TextTrack>(this, 0, n);
22212
22213 Iterable<TextTrack> takeWhile(bool test(TextTrack value)) {
22214 return new TakeWhileIterable<TextTrack>(this, test);
22215 }
22216
22217 List<TextTrack> skip(int n) => new ListView<TextTrack>(this, n, null);
22218
22219 Iterable<TextTrack> skipWhile(bool test(TextTrack value)) {
22220 return new SkipWhileIterable<TextTrack>(this, test);
22221 }
22222
22223 TextTrack firstMatching(bool test(TextTrack value), { TextTrack orElse() }) {
22224 return Collections.firstMatching(this, test, orElse);
22225 }
22226
22227 TextTrack lastMatching(bool test(TextTrack value), {TextTrack orElse()}) {
22228 return Collections.lastMatchingInList(this, test, orElse);
22229 }
22230
22231 TextTrack singleMatching(bool test(TextTrack value)) {
22232 return Collections.singleMatching(this, test);
22233 }
22234
22235 TextTrack elementAt(int index) {
22236 return this[index];
22237 }
22238
22239 // From Collection<TextTrack>:
22240
22241 void add(TextTrack value) {
22242 throw new UnsupportedError("Cannot add to immutable List.");
22243 }
22244
22245 void addLast(TextTrack value) {
22246 throw new UnsupportedError("Cannot add to immutable List.");
22247 }
22248
22249 void addAll(Iterable<TextTrack> iterable) {
22250 throw new UnsupportedError("Cannot add to immutable List.");
22251 }
22252
21305 // From List<TextTrack>: 22253 // From List<TextTrack>:
21306 void set length(int value) { 22254 void set length(int value) {
21307 throw new UnsupportedError("Cannot resize immutable List."); 22255 throw new UnsupportedError("Cannot resize immutable List.");
21308 } 22256 }
21309 22257
21310 void clear() { 22258 void clear() {
21311 throw new UnsupportedError("Cannot clear immutable List."); 22259 throw new UnsupportedError("Cannot clear immutable List.");
21312 } 22260 }
21313 22261
21314 void sort([int compare(TextTrack a, TextTrack b)]) { 22262 void sort([int compare(TextTrack a, TextTrack b)]) {
21315 throw new UnsupportedError("Cannot sort immutable List."); 22263 throw new UnsupportedError("Cannot sort immutable List.");
21316 } 22264 }
21317 22265
21318 int indexOf(TextTrack element, [int start = 0]) => 22266 int indexOf(TextTrack element, [int start = 0]) =>
21319 Lists.indexOf(this, element, start, this.length); 22267 Lists.indexOf(this, element, start, this.length);
21320 22268
21321 int lastIndexOf(TextTrack element, [int start]) { 22269 int lastIndexOf(TextTrack element, [int start]) {
21322 if (start == null) start = length - 1; 22270 if (start == null) start = length - 1;
21323 return Lists.lastIndexOf(this, element, start); 22271 return Lists.lastIndexOf(this, element, start);
21324 } 22272 }
21325 22273
21326 TextTrack get first => this[0]; 22274 TextTrack get first {
22275 if (this.length > 0) return this[0];
22276 throw new StateError("No elements");
22277 }
21327 22278
21328 TextTrack get last => this[length - 1]; 22279 TextTrack get last {
22280 if (this.length > 0) return this[this.length - 1];
22281 throw new StateError("No elements");
22282 }
22283
22284 TextTrack get single {
22285 if (length == 1) return this[0];
22286 if (length == 0) throw new StateError("No elements");
22287 throw new StateError("More than one element");
22288 }
22289
22290 TextTrack min([int compare(TextTrack a, TextTrack b)]) => _Collections.minInLi st(this, compare);
22291
22292 TextTrack max([int compare(TextTrack a, TextTrack b)]) => _Collections.maxInLi st(this, compare);
21329 22293
21330 TextTrack removeAt(int pos) { 22294 TextTrack removeAt(int pos) {
21331 throw new UnsupportedError("Cannot removeAt on immutable List."); 22295 throw new UnsupportedError("Cannot removeAt on immutable List.");
21332 } 22296 }
21333 22297
21334 TextTrack removeLast() { 22298 TextTrack removeLast() {
21335 throw new UnsupportedError("Cannot removeLast on immutable List."); 22299 throw new UnsupportedError("Cannot removeLast on immutable List.");
21336 } 22300 }
21337 22301
21338 void setRange(int start, int rangeLength, List<TextTrack> from, [int startFrom ]) { 22302 void setRange(int start, int rangeLength, List<TextTrack> from, [int startFrom ]) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
21547 Touch operator[](int index) native "TouchList_item_Callback"; 22511 Touch operator[](int index) native "TouchList_item_Callback";
21548 22512
21549 void operator[]=(int index, Touch value) { 22513 void operator[]=(int index, Touch value) {
21550 throw new UnsupportedError("Cannot assign element of immutable List."); 22514 throw new UnsupportedError("Cannot assign element of immutable List.");
21551 } 22515 }
21552 // -- start List<Touch> mixins. 22516 // -- start List<Touch> mixins.
21553 // Touch is the element type. 22517 // Touch is the element type.
21554 22518
21555 // From Iterable<Touch>: 22519 // From Iterable<Touch>:
21556 22520
21557 Iterator<Touch> iterator() { 22521 Iterator<Touch> get iterator {
21558 // Note: NodeLists are not fixed size. And most probably length shouldn't 22522 // Note: NodeLists are not fixed size. And most probably length shouldn't
21559 // be cached in both iterator _and_ forEach method. For now caching it 22523 // be cached in both iterator _and_ forEach method. For now caching it
21560 // for consistency. 22524 // for consistency.
21561 return new FixedSizeListIterator<Touch>(this); 22525 return new FixedSizeListIterator<Touch>(this);
21562 } 22526 }
21563 22527
21564 // From Collection<Touch>:
21565
21566 void add(Touch value) {
21567 throw new UnsupportedError("Cannot add to immutable List.");
21568 }
21569
21570 void addLast(Touch value) {
21571 throw new UnsupportedError("Cannot add to immutable List.");
21572 }
21573
21574 void addAll(Collection<Touch> collection) {
21575 throw new UnsupportedError("Cannot add to immutable List.");
21576 }
21577
21578 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Touch)) { 22528 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Touch)) {
21579 return Collections.reduce(this, initialValue, combine); 22529 return Collections.reduce(this, initialValue, combine);
21580 } 22530 }
21581 22531
21582 bool contains(Touch element) => Collections.contains(this, element); 22532 bool contains(Touch element) => Collections.contains(this, element);
21583 22533
21584 void forEach(void f(Touch element)) => Collections.forEach(this, f); 22534 void forEach(void f(Touch element)) => Collections.forEach(this, f);
21585 22535
21586 Collection map(f(Touch element)) => Collections.map(this, [], f); 22536 String join([String separator]) => Collections.joinList(this, separator);
21587 22537
21588 Collection<Touch> filter(bool f(Touch element)) => 22538 List mappedBy(f(Touch element)) => new MappedList<Touch, dynamic>(this, f);
21589 Collections.filter(this, <Touch>[], f); 22539
22540 Iterable<Touch> where(bool f(Touch element)) => new WhereIterable<Touch>(this, f);
21590 22541
21591 bool every(bool f(Touch element)) => Collections.every(this, f); 22542 bool every(bool f(Touch element)) => Collections.every(this, f);
21592 22543
21593 bool some(bool f(Touch element)) => Collections.some(this, f); 22544 bool any(bool f(Touch element)) => Collections.any(this, f);
21594 22545
21595 bool get isEmpty => this.length == 0; 22546 bool get isEmpty => this.length == 0;
21596 22547
22548 List<Touch> take(int n) => new ListView<Touch>(this, 0, n);
22549
22550 Iterable<Touch> takeWhile(bool test(Touch value)) {
22551 return new TakeWhileIterable<Touch>(this, test);
22552 }
22553
22554 List<Touch> skip(int n) => new ListView<Touch>(this, n, null);
22555
22556 Iterable<Touch> skipWhile(bool test(Touch value)) {
22557 return new SkipWhileIterable<Touch>(this, test);
22558 }
22559
22560 Touch firstMatching(bool test(Touch value), { Touch orElse() }) {
22561 return Collections.firstMatching(this, test, orElse);
22562 }
22563
22564 Touch lastMatching(bool test(Touch value), {Touch orElse()}) {
22565 return Collections.lastMatchingInList(this, test, orElse);
22566 }
22567
22568 Touch singleMatching(bool test(Touch value)) {
22569 return Collections.singleMatching(this, test);
22570 }
22571
22572 Touch elementAt(int index) {
22573 return this[index];
22574 }
22575
22576 // From Collection<Touch>:
22577
22578 void add(Touch value) {
22579 throw new UnsupportedError("Cannot add to immutable List.");
22580 }
22581
22582 void addLast(Touch value) {
22583 throw new UnsupportedError("Cannot add to immutable List.");
22584 }
22585
22586 void addAll(Iterable<Touch> iterable) {
22587 throw new UnsupportedError("Cannot add to immutable List.");
22588 }
22589
21597 // From List<Touch>: 22590 // From List<Touch>:
21598 void set length(int value) { 22591 void set length(int value) {
21599 throw new UnsupportedError("Cannot resize immutable List."); 22592 throw new UnsupportedError("Cannot resize immutable List.");
21600 } 22593 }
21601 22594
21602 void clear() { 22595 void clear() {
21603 throw new UnsupportedError("Cannot clear immutable List."); 22596 throw new UnsupportedError("Cannot clear immutable List.");
21604 } 22597 }
21605 22598
21606 void sort([int compare(Touch a, Touch b)]) { 22599 void sort([int compare(Touch a, Touch b)]) {
21607 throw new UnsupportedError("Cannot sort immutable List."); 22600 throw new UnsupportedError("Cannot sort immutable List.");
21608 } 22601 }
21609 22602
21610 int indexOf(Touch element, [int start = 0]) => 22603 int indexOf(Touch element, [int start = 0]) =>
21611 Lists.indexOf(this, element, start, this.length); 22604 Lists.indexOf(this, element, start, this.length);
21612 22605
21613 int lastIndexOf(Touch element, [int start]) { 22606 int lastIndexOf(Touch element, [int start]) {
21614 if (start == null) start = length - 1; 22607 if (start == null) start = length - 1;
21615 return Lists.lastIndexOf(this, element, start); 22608 return Lists.lastIndexOf(this, element, start);
21616 } 22609 }
21617 22610
21618 Touch get first => this[0]; 22611 Touch get first {
22612 if (this.length > 0) return this[0];
22613 throw new StateError("No elements");
22614 }
21619 22615
21620 Touch get last => this[length - 1]; 22616 Touch get last {
22617 if (this.length > 0) return this[this.length - 1];
22618 throw new StateError("No elements");
22619 }
22620
22621 Touch get single {
22622 if (length == 1) return this[0];
22623 if (length == 0) throw new StateError("No elements");
22624 throw new StateError("More than one element");
22625 }
22626
22627 Touch min([int compare(Touch a, Touch b)]) => _Collections.minInList(this, com pare);
22628
22629 Touch max([int compare(Touch a, Touch b)]) => _Collections.maxInList(this, com pare);
21621 22630
21622 Touch removeAt(int pos) { 22631 Touch removeAt(int pos) {
21623 throw new UnsupportedError("Cannot removeAt on immutable List."); 22632 throw new UnsupportedError("Cannot removeAt on immutable List.");
21624 } 22633 }
21625 22634
21626 Touch removeLast() { 22635 Touch removeLast() {
21627 throw new UnsupportedError("Cannot removeLast on immutable List."); 22636 throw new UnsupportedError("Cannot removeLast on immutable List.");
21628 } 22637 }
21629 22638
21630 void setRange(int start, int rangeLength, List<Touch> from, [int startFrom]) { 22639 void setRange(int start, int rangeLength, List<Touch> from, [int startFrom]) {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
21938 int operator[](int index) native "Uint16Array_numericIndexGetter_Callback"; 22947 int operator[](int index) native "Uint16Array_numericIndexGetter_Callback";
21939 22948
21940 22949
21941 /** @domName Uint16Array.numericIndexSetter */ 22950 /** @domName Uint16Array.numericIndexSetter */
21942 void operator[]=(int index, int value) native "Uint16Array_numericIndexSetter_ Callback"; 22951 void operator[]=(int index, int value) native "Uint16Array_numericIndexSetter_ Callback";
21943 // -- start List<int> mixins. 22952 // -- start List<int> mixins.
21944 // int is the element type. 22953 // int is the element type.
21945 22954
21946 // From Iterable<int>: 22955 // From Iterable<int>:
21947 22956
21948 Iterator<int> iterator() { 22957 Iterator<int> get iterator {
21949 // Note: NodeLists are not fixed size. And most probably length shouldn't 22958 // Note: NodeLists are not fixed size. And most probably length shouldn't
21950 // be cached in both iterator _and_ forEach method. For now caching it 22959 // be cached in both iterator _and_ forEach method. For now caching it
21951 // for consistency. 22960 // for consistency.
21952 return new FixedSizeListIterator<int>(this); 22961 return new FixedSizeListIterator<int>(this);
21953 } 22962 }
21954 22963
21955 // From Collection<int>:
21956
21957 void add(int value) {
21958 throw new UnsupportedError("Cannot add to immutable List.");
21959 }
21960
21961 void addLast(int value) {
21962 throw new UnsupportedError("Cannot add to immutable List.");
21963 }
21964
21965 void addAll(Collection<int> collection) {
21966 throw new UnsupportedError("Cannot add to immutable List.");
21967 }
21968
21969 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 22964 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
21970 return Collections.reduce(this, initialValue, combine); 22965 return Collections.reduce(this, initialValue, combine);
21971 } 22966 }
21972 22967
21973 bool contains(int element) => Collections.contains(this, element); 22968 bool contains(int element) => Collections.contains(this, element);
21974 22969
21975 void forEach(void f(int element)) => Collections.forEach(this, f); 22970 void forEach(void f(int element)) => Collections.forEach(this, f);
21976 22971
21977 Collection map(f(int element)) => Collections.map(this, [], f); 22972 String join([String separator]) => Collections.joinList(this, separator);
21978 22973
21979 Collection<int> filter(bool f(int element)) => 22974 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
21980 Collections.filter(this, <int>[], f); 22975
22976 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
21981 22977
21982 bool every(bool f(int element)) => Collections.every(this, f); 22978 bool every(bool f(int element)) => Collections.every(this, f);
21983 22979
21984 bool some(bool f(int element)) => Collections.some(this, f); 22980 bool any(bool f(int element)) => Collections.any(this, f);
21985 22981
21986 bool get isEmpty => this.length == 0; 22982 bool get isEmpty => this.length == 0;
21987 22983
22984 List<int> take(int n) => new ListView<int>(this, 0, n);
22985
22986 Iterable<int> takeWhile(bool test(int value)) {
22987 return new TakeWhileIterable<int>(this, test);
22988 }
22989
22990 List<int> skip(int n) => new ListView<int>(this, n, null);
22991
22992 Iterable<int> skipWhile(bool test(int value)) {
22993 return new SkipWhileIterable<int>(this, test);
22994 }
22995
22996 int firstMatching(bool test(int value), { int orElse() }) {
22997 return Collections.firstMatching(this, test, orElse);
22998 }
22999
23000 int lastMatching(bool test(int value), {int orElse()}) {
23001 return Collections.lastMatchingInList(this, test, orElse);
23002 }
23003
23004 int singleMatching(bool test(int value)) {
23005 return Collections.singleMatching(this, test);
23006 }
23007
23008 int elementAt(int index) {
23009 return this[index];
23010 }
23011
23012 // From Collection<int>:
23013
23014 void add(int value) {
23015 throw new UnsupportedError("Cannot add to immutable List.");
23016 }
23017
23018 void addLast(int value) {
23019 throw new UnsupportedError("Cannot add to immutable List.");
23020 }
23021
23022 void addAll(Iterable<int> iterable) {
23023 throw new UnsupportedError("Cannot add to immutable List.");
23024 }
23025
21988 // From List<int>: 23026 // From List<int>:
21989 void set length(int value) { 23027 void set length(int value) {
21990 throw new UnsupportedError("Cannot resize immutable List."); 23028 throw new UnsupportedError("Cannot resize immutable List.");
21991 } 23029 }
21992 23030
21993 void clear() { 23031 void clear() {
21994 throw new UnsupportedError("Cannot clear immutable List."); 23032 throw new UnsupportedError("Cannot clear immutable List.");
21995 } 23033 }
21996 23034
21997 void sort([int compare(int a, int b)]) { 23035 void sort([int compare(int a, int b)]) {
21998 throw new UnsupportedError("Cannot sort immutable List."); 23036 throw new UnsupportedError("Cannot sort immutable List.");
21999 } 23037 }
22000 23038
22001 int indexOf(int element, [int start = 0]) => 23039 int indexOf(int element, [int start = 0]) =>
22002 Lists.indexOf(this, element, start, this.length); 23040 Lists.indexOf(this, element, start, this.length);
22003 23041
22004 int lastIndexOf(int element, [int start]) { 23042 int lastIndexOf(int element, [int start]) {
22005 if (start == null) start = length - 1; 23043 if (start == null) start = length - 1;
22006 return Lists.lastIndexOf(this, element, start); 23044 return Lists.lastIndexOf(this, element, start);
22007 } 23045 }
22008 23046
22009 int get first => this[0]; 23047 int get first {
23048 if (this.length > 0) return this[0];
23049 throw new StateError("No elements");
23050 }
22010 23051
22011 int get last => this[length - 1]; 23052 int get last {
23053 if (this.length > 0) return this[this.length - 1];
23054 throw new StateError("No elements");
23055 }
23056
23057 int get single {
23058 if (length == 1) return this[0];
23059 if (length == 0) throw new StateError("No elements");
23060 throw new StateError("More than one element");
23061 }
23062
23063 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
23064
23065 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
22012 23066
22013 int removeAt(int pos) { 23067 int removeAt(int pos) {
22014 throw new UnsupportedError("Cannot removeAt on immutable List."); 23068 throw new UnsupportedError("Cannot removeAt on immutable List.");
22015 } 23069 }
22016 23070
22017 int removeLast() { 23071 int removeLast() {
22018 throw new UnsupportedError("Cannot removeLast on immutable List."); 23072 throw new UnsupportedError("Cannot removeLast on immutable List.");
22019 } 23073 }
22020 23074
22021 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 23075 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
22086 int operator[](int index) native "Uint32Array_numericIndexGetter_Callback"; 23140 int operator[](int index) native "Uint32Array_numericIndexGetter_Callback";
22087 23141
22088 23142
22089 /** @domName Uint32Array.numericIndexSetter */ 23143 /** @domName Uint32Array.numericIndexSetter */
22090 void operator[]=(int index, int value) native "Uint32Array_numericIndexSetter_ Callback"; 23144 void operator[]=(int index, int value) native "Uint32Array_numericIndexSetter_ Callback";
22091 // -- start List<int> mixins. 23145 // -- start List<int> mixins.
22092 // int is the element type. 23146 // int is the element type.
22093 23147
22094 // From Iterable<int>: 23148 // From Iterable<int>:
22095 23149
22096 Iterator<int> iterator() { 23150 Iterator<int> get iterator {
22097 // Note: NodeLists are not fixed size. And most probably length shouldn't 23151 // Note: NodeLists are not fixed size. And most probably length shouldn't
22098 // be cached in both iterator _and_ forEach method. For now caching it 23152 // be cached in both iterator _and_ forEach method. For now caching it
22099 // for consistency. 23153 // for consistency.
22100 return new FixedSizeListIterator<int>(this); 23154 return new FixedSizeListIterator<int>(this);
22101 } 23155 }
22102 23156
22103 // From Collection<int>:
22104
22105 void add(int value) {
22106 throw new UnsupportedError("Cannot add to immutable List.");
22107 }
22108
22109 void addLast(int value) {
22110 throw new UnsupportedError("Cannot add to immutable List.");
22111 }
22112
22113 void addAll(Collection<int> collection) {
22114 throw new UnsupportedError("Cannot add to immutable List.");
22115 }
22116
22117 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) { 23157 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
22118 return Collections.reduce(this, initialValue, combine); 23158 return Collections.reduce(this, initialValue, combine);
22119 } 23159 }
22120 23160
22121 bool contains(int element) => Collections.contains(this, element); 23161 bool contains(int element) => Collections.contains(this, element);
22122 23162
22123 void forEach(void f(int element)) => Collections.forEach(this, f); 23163 void forEach(void f(int element)) => Collections.forEach(this, f);
22124 23164
22125 Collection map(f(int element)) => Collections.map(this, [], f); 23165 String join([String separator]) => Collections.joinList(this, separator);
22126 23166
22127 Collection<int> filter(bool f(int element)) => 23167 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
22128 Collections.filter(this, <int>[], f); 23168
23169 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
22129 23170
22130 bool every(bool f(int element)) => Collections.every(this, f); 23171 bool every(bool f(int element)) => Collections.every(this, f);
22131 23172
22132 bool some(bool f(int element)) => Collections.some(this, f); 23173 bool any(bool f(int element)) => Collections.any(this, f);
22133 23174
22134 bool get isEmpty => this.length == 0; 23175 bool get isEmpty => this.length == 0;
22135 23176
23177 List<int> take(int n) => new ListView<int>(this, 0, n);
23178
23179 Iterable<int> takeWhile(bool test(int value)) {
23180 return new TakeWhileIterable<int>(this, test);
23181 }
23182
23183 List<int> skip(int n) => new ListView<int>(this, n, null);
23184
23185 Iterable<int> skipWhile(bool test(int value)) {
23186 return new SkipWhileIterable<int>(this, test);
23187 }
23188
23189 int firstMatching(bool test(int value), { int orElse() }) {
23190 return Collections.firstMatching(this, test, orElse);
23191 }
23192
23193 int lastMatching(bool test(int value), {int orElse()}) {
23194 return Collections.lastMatchingInList(this, test, orElse);
23195 }
23196
23197 int singleMatching(bool test(int value)) {
23198 return Collections.singleMatching(this, test);
23199 }
23200
23201 int elementAt(int index) {
23202 return this[index];
23203 }
23204
23205 // From Collection<int>:
23206
23207 void add(int value) {
23208 throw new UnsupportedError("Cannot add to immutable List.");
23209 }
23210
23211 void addLast(int value) {
23212 throw new UnsupportedError("Cannot add to immutable List.");
23213 }
23214
23215 void addAll(Iterable<int> iterable) {
23216 throw new UnsupportedError("Cannot add to immutable List.");
23217 }
23218
22136 // From List<int>: 23219 // From List<int>:
22137 void set length(int value) { 23220 void set length(int value) {
22138 throw new UnsupportedError("Cannot resize immutable List."); 23221 throw new UnsupportedError("Cannot resize immutable List.");
22139 } 23222 }
22140 23223
22141 void clear() { 23224 void clear() {
22142 throw new UnsupportedError("Cannot clear immutable List."); 23225 throw new UnsupportedError("Cannot clear immutable List.");
22143 } 23226 }
22144 23227
22145 void sort([int compare(int a, int b)]) { 23228 void sort([int compare(int a, int b)]) {
22146 throw new UnsupportedError("Cannot sort immutable List."); 23229 throw new UnsupportedError("Cannot sort immutable List.");
22147 } 23230 }
22148 23231
22149 int indexOf(int element, [int start = 0]) => 23232 int indexOf(int element, [int start = 0]) =>
22150 Lists.indexOf(this, element, start, this.length); 23233 Lists.indexOf(this, element, start, this.length);
22151 23234
22152 int lastIndexOf(int element, [int start]) { 23235 int lastIndexOf(int element, [int start]) {
22153 if (start == null) start = length - 1; 23236 if (start == null) start = length - 1;
22154 return Lists.lastIndexOf(this, element, start); 23237 return Lists.lastIndexOf(this, element, start);
22155 } 23238 }
22156 23239
22157 int get first => this[0]; 23240 int get first {
23241 if (this.length > 0) return this[0];
23242 throw new StateError("No elements");
23243 }
22158 23244
22159 int get last => this[length - 1]; 23245 int get last {
23246 if (this.length > 0) return this[this.length - 1];
23247 throw new StateError("No elements");
23248 }
23249
23250 int get single {
23251 if (length == 1) return this[0];
23252 if (length == 0) throw new StateError("No elements");
23253 throw new StateError("More than one element");
23254 }
23255
23256 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
23257
23258 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
22160 23259
22161 int removeAt(int pos) { 23260 int removeAt(int pos) {
22162 throw new UnsupportedError("Cannot removeAt on immutable List."); 23261 throw new UnsupportedError("Cannot removeAt on immutable List.");
22163 } 23262 }
22164 23263
22165 int removeLast() { 23264 int removeLast() {
22166 throw new UnsupportedError("Cannot removeLast on immutable List."); 23265 throw new UnsupportedError("Cannot removeLast on immutable List.");
22167 } 23266 }
22168 23267
22169 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 23268 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
22234 int operator[](int index) native "Uint8Array_numericIndexGetter_Callback"; 23333 int operator[](int index) native "Uint8Array_numericIndexGetter_Callback";
22235 23334
22236 23335
22237 /** @domName Uint8Array.numericIndexSetter */ 23336 /** @domName Uint8Array.numericIndexSetter */
22238 void operator[]=(int index, int value) native "Uint8Array_numericIndexSetter_C allback"; 23337 void operator[]=(int index, int value) native "Uint8Array_numericIndexSetter_C allback";
22239 // -- start List<int> mixins. 23338 // -- start List<int> mixins.
22240 // int is the element type. 23339 // int is the element type.
22241 23340
22242 // From Iterable<int>: 23341 // From Iterable<int>:
22243 23342
22244 Iterator<int> iterator() { 23343 Iterator<int> get iterator {
22245 // Note: NodeLists are not fixed size. And most probably length shouldn't 23344 // Note: NodeLists are not fixed size. And most probably length shouldn't
22246 // be cached in both iterator _and_ forEach method. For now caching it 23345 // be cached in both iterator _and_ forEach method. For now caching it
22247 // for consistency. 23346 // for consistency.
22248 return new FixedSizeListIterator<int>(this); 23347 return new FixedSizeListIterator<int>(this);
22249 } 23348 }
22250 23349
23350 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
23351 return Collections.reduce(this, initialValue, combine);
23352 }
23353
23354 bool contains(int element) => Collections.contains(this, element);
23355
23356 void forEach(void f(int element)) => Collections.forEach(this, f);
23357
23358 String join([String separator]) => Collections.joinList(this, separator);
23359
23360 List mappedBy(f(int element)) => new MappedList<int, dynamic>(this, f);
23361
23362 Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
23363
23364 bool every(bool f(int element)) => Collections.every(this, f);
23365
23366 bool any(bool f(int element)) => Collections.any(this, f);
23367
23368 bool get isEmpty => this.length == 0;
23369
23370 List<int> take(int n) => new ListView<int>(this, 0, n);
23371
23372 Iterable<int> takeWhile(bool test(int value)) {
23373 return new TakeWhileIterable<int>(this, test);
23374 }
23375
23376 List<int> skip(int n) => new ListView<int>(this, n, null);
23377
23378 Iterable<int> skipWhile(bool test(int value)) {
23379 return new SkipWhileIterable<int>(this, test);
23380 }
23381
23382 int firstMatching(bool test(int value), { int orElse() }) {
23383 return Collections.firstMatching(this, test, orElse);
23384 }
23385
23386 int lastMatching(bool test(int value), {int orElse()}) {
23387 return Collections.lastMatchingInList(this, test, orElse);
23388 }
23389
23390 int singleMatching(bool test(int value)) {
23391 return Collections.singleMatching(this, test);
23392 }
23393
23394 int elementAt(int index) {
23395 return this[index];
23396 }
23397
22251 // From Collection<int>: 23398 // From Collection<int>:
22252 23399
22253 void add(int value) { 23400 void add(int value) {
22254 throw new UnsupportedError("Cannot add to immutable List."); 23401 throw new UnsupportedError("Cannot add to immutable List.");
22255 } 23402 }
22256 23403
22257 void addLast(int value) { 23404 void addLast(int value) {
22258 throw new UnsupportedError("Cannot add to immutable List."); 23405 throw new UnsupportedError("Cannot add to immutable List.");
22259 } 23406 }
22260 23407
22261 void addAll(Collection<int> collection) { 23408 void addAll(Iterable<int> iterable) {
22262 throw new UnsupportedError("Cannot add to immutable List."); 23409 throw new UnsupportedError("Cannot add to immutable List.");
22263 } 23410 }
22264 23411
22265 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, int)) {
22266 return Collections.reduce(this, initialValue, combine);
22267 }
22268
22269 bool contains(int element) => Collections.contains(this, element);
22270
22271 void forEach(void f(int element)) => Collections.forEach(this, f);
22272
22273 Collection map(f(int element)) => Collections.map(this, [], f);
22274
22275 Collection<int> filter(bool f(int element)) =>
22276 Collections.filter(this, <int>[], f);
22277
22278 bool every(bool f(int element)) => Collections.every(this, f);
22279
22280 bool some(bool f(int element)) => Collections.some(this, f);
22281
22282 bool get isEmpty => this.length == 0;
22283
22284 // From List<int>: 23412 // From List<int>:
22285 void set length(int value) { 23413 void set length(int value) {
22286 throw new UnsupportedError("Cannot resize immutable List."); 23414 throw new UnsupportedError("Cannot resize immutable List.");
22287 } 23415 }
22288 23416
22289 void clear() { 23417 void clear() {
22290 throw new UnsupportedError("Cannot clear immutable List."); 23418 throw new UnsupportedError("Cannot clear immutable List.");
22291 } 23419 }
22292 23420
22293 void sort([int compare(int a, int b)]) { 23421 void sort([int compare(int a, int b)]) {
22294 throw new UnsupportedError("Cannot sort immutable List."); 23422 throw new UnsupportedError("Cannot sort immutable List.");
22295 } 23423 }
22296 23424
22297 int indexOf(int element, [int start = 0]) => 23425 int indexOf(int element, [int start = 0]) =>
22298 Lists.indexOf(this, element, start, this.length); 23426 Lists.indexOf(this, element, start, this.length);
22299 23427
22300 int lastIndexOf(int element, [int start]) { 23428 int lastIndexOf(int element, [int start]) {
22301 if (start == null) start = length - 1; 23429 if (start == null) start = length - 1;
22302 return Lists.lastIndexOf(this, element, start); 23430 return Lists.lastIndexOf(this, element, start);
22303 } 23431 }
22304 23432
22305 int get first => this[0]; 23433 int get first {
23434 if (this.length > 0) return this[0];
23435 throw new StateError("No elements");
23436 }
22306 23437
22307 int get last => this[length - 1]; 23438 int get last {
23439 if (this.length > 0) return this[this.length - 1];
23440 throw new StateError("No elements");
23441 }
23442
23443 int get single {
23444 if (length == 1) return this[0];
23445 if (length == 0) throw new StateError("No elements");
23446 throw new StateError("More than one element");
23447 }
23448
23449 int min([int compare(int a, int b)]) => _Collections.minInList(this, compare);
23450
23451 int max([int compare(int a, int b)]) => _Collections.maxInList(this, compare);
22308 23452
22309 int removeAt(int pos) { 23453 int removeAt(int pos) {
22310 throw new UnsupportedError("Cannot removeAt on immutable List."); 23454 throw new UnsupportedError("Cannot removeAt on immutable List.");
22311 } 23455 }
22312 23456
22313 int removeLast() { 23457 int removeLast() {
22314 throw new UnsupportedError("Cannot removeLast on immutable List."); 23458 throw new UnsupportedError("Cannot removeLast on immutable List.");
22315 } 23459 }
22316 23460
22317 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) { 23461 void setRange(int start, int rangeLength, List<int> from, [int startFrom]) {
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after
24499 */ 25643 */
24500 void requestLayoutFrame(TimeoutHandler callback) { 25644 void requestLayoutFrame(TimeoutHandler callback) {
24501 _addMeasurementFrameCallback(callback); 25645 _addMeasurementFrameCallback(callback);
24502 } 25646 }
24503 25647
24504 /** 25648 /**
24505 * Lookup a port by its [name]. Return null if no port is 25649 * Lookup a port by its [name]. Return null if no port is
24506 * registered under [name]. 25650 * registered under [name].
24507 */ 25651 */
24508 lookupPort(String name) { 25652 lookupPort(String name) {
24509 var port = JSON.parse(document.documentElement.attributes['dart-port:$name'] ); 25653 var port = json.parse(document.documentElement.attributes['dart-port:$name'] );
24510 return _deserialize(port); 25654 return _deserialize(port);
24511 } 25655 }
24512 25656
24513 /** 25657 /**
24514 * Register a [port] on this window under the given [name]. This 25658 * Register a [port] on this window under the given [name]. This
24515 * port may be retrieved by any isolate (or JavaScript script) 25659 * port may be retrieved by any isolate (or JavaScript script)
24516 * running in this window. 25660 * running in this window.
24517 */ 25661 */
24518 registerPort(String name, var port) { 25662 registerPort(String name, var port) {
24519 var serialized = _serialize(port); 25663 var serialized = _serialize(port);
24520 document.documentElement.attributes['dart-port:$name'] = JSON.stringify(seri alized); 25664 document.documentElement.attributes['dart-port:$name'] = json.stringify(seri alized);
24521 } 25665 }
24522 25666
24523 Window.internal() : super.internal(); 25667 Window.internal() : super.internal();
24524 25668
24525 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true 25669 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
24526 WindowEvents get on => 25670 WindowEvents get on =>
24527 new WindowEvents(this); 25671 new WindowEvents(this);
24528 25672
24529 static const int PERSISTENT = 1; 25673 static const int PERSISTENT = 1;
24530 25674
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
25607 ClientRect operator[](int index) native "ClientRectList_item_Callback"; 26751 ClientRect operator[](int index) native "ClientRectList_item_Callback";
25608 26752
25609 void operator[]=(int index, ClientRect value) { 26753 void operator[]=(int index, ClientRect value) {
25610 throw new UnsupportedError("Cannot assign element of immutable List."); 26754 throw new UnsupportedError("Cannot assign element of immutable List.");
25611 } 26755 }
25612 // -- start List<ClientRect> mixins. 26756 // -- start List<ClientRect> mixins.
25613 // ClientRect is the element type. 26757 // ClientRect is the element type.
25614 26758
25615 // From Iterable<ClientRect>: 26759 // From Iterable<ClientRect>:
25616 26760
25617 Iterator<ClientRect> iterator() { 26761 Iterator<ClientRect> get iterator {
25618 // Note: NodeLists are not fixed size. And most probably length shouldn't 26762 // Note: NodeLists are not fixed size. And most probably length shouldn't
25619 // be cached in both iterator _and_ forEach method. For now caching it 26763 // be cached in both iterator _and_ forEach method. For now caching it
25620 // for consistency. 26764 // for consistency.
25621 return new FixedSizeListIterator<ClientRect>(this); 26765 return new FixedSizeListIterator<ClientRect>(this);
25622 } 26766 }
25623 26767
25624 // From Collection<ClientRect>:
25625
25626 void add(ClientRect value) {
25627 throw new UnsupportedError("Cannot add to immutable List.");
25628 }
25629
25630 void addLast(ClientRect value) {
25631 throw new UnsupportedError("Cannot add to immutable List.");
25632 }
25633
25634 void addAll(Collection<ClientRect> collection) {
25635 throw new UnsupportedError("Cannot add to immutable List.");
25636 }
25637
25638 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ClientRect)) { 26768 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, ClientRect)) {
25639 return Collections.reduce(this, initialValue, combine); 26769 return Collections.reduce(this, initialValue, combine);
25640 } 26770 }
25641 26771
25642 bool contains(ClientRect element) => Collections.contains(this, element); 26772 bool contains(ClientRect element) => Collections.contains(this, element);
25643 26773
25644 void forEach(void f(ClientRect element)) => Collections.forEach(this, f); 26774 void forEach(void f(ClientRect element)) => Collections.forEach(this, f);
25645 26775
25646 Collection map(f(ClientRect element)) => Collections.map(this, [], f); 26776 String join([String separator]) => Collections.joinList(this, separator);
25647 26777
25648 Collection<ClientRect> filter(bool f(ClientRect element)) => 26778 List mappedBy(f(ClientRect element)) => new MappedList<ClientRect, dynamic>(th is, f);
25649 Collections.filter(this, <ClientRect>[], f); 26779
26780 Iterable<ClientRect> where(bool f(ClientRect element)) => new WhereIterable<Cl ientRect>(this, f);
25650 26781
25651 bool every(bool f(ClientRect element)) => Collections.every(this, f); 26782 bool every(bool f(ClientRect element)) => Collections.every(this, f);
25652 26783
25653 bool some(bool f(ClientRect element)) => Collections.some(this, f); 26784 bool any(bool f(ClientRect element)) => Collections.any(this, f);
25654 26785
25655 bool get isEmpty => this.length == 0; 26786 bool get isEmpty => this.length == 0;
25656 26787
26788 List<ClientRect> take(int n) => new ListView<ClientRect>(this, 0, n);
26789
26790 Iterable<ClientRect> takeWhile(bool test(ClientRect value)) {
26791 return new TakeWhileIterable<ClientRect>(this, test);
26792 }
26793
26794 List<ClientRect> skip(int n) => new ListView<ClientRect>(this, n, null);
26795
26796 Iterable<ClientRect> skipWhile(bool test(ClientRect value)) {
26797 return new SkipWhileIterable<ClientRect>(this, test);
26798 }
26799
26800 ClientRect firstMatching(bool test(ClientRect value), { ClientRect orElse() }) {
26801 return Collections.firstMatching(this, test, orElse);
26802 }
26803
26804 ClientRect lastMatching(bool test(ClientRect value), {ClientRect orElse()}) {
26805 return Collections.lastMatchingInList(this, test, orElse);
26806 }
26807
26808 ClientRect singleMatching(bool test(ClientRect value)) {
26809 return Collections.singleMatching(this, test);
26810 }
26811
26812 ClientRect elementAt(int index) {
26813 return this[index];
26814 }
26815
26816 // From Collection<ClientRect>:
26817
26818 void add(ClientRect value) {
26819 throw new UnsupportedError("Cannot add to immutable List.");
26820 }
26821
26822 void addLast(ClientRect value) {
26823 throw new UnsupportedError("Cannot add to immutable List.");
26824 }
26825
26826 void addAll(Iterable<ClientRect> iterable) {
26827 throw new UnsupportedError("Cannot add to immutable List.");
26828 }
26829
25657 // From List<ClientRect>: 26830 // From List<ClientRect>:
25658 void set length(int value) { 26831 void set length(int value) {
25659 throw new UnsupportedError("Cannot resize immutable List."); 26832 throw new UnsupportedError("Cannot resize immutable List.");
25660 } 26833 }
25661 26834
25662 void clear() { 26835 void clear() {
25663 throw new UnsupportedError("Cannot clear immutable List."); 26836 throw new UnsupportedError("Cannot clear immutable List.");
25664 } 26837 }
25665 26838
25666 void sort([int compare(ClientRect a, ClientRect b)]) { 26839 void sort([int compare(ClientRect a, ClientRect b)]) {
25667 throw new UnsupportedError("Cannot sort immutable List."); 26840 throw new UnsupportedError("Cannot sort immutable List.");
25668 } 26841 }
25669 26842
25670 int indexOf(ClientRect element, [int start = 0]) => 26843 int indexOf(ClientRect element, [int start = 0]) =>
25671 Lists.indexOf(this, element, start, this.length); 26844 Lists.indexOf(this, element, start, this.length);
25672 26845
25673 int lastIndexOf(ClientRect element, [int start]) { 26846 int lastIndexOf(ClientRect element, [int start]) {
25674 if (start == null) start = length - 1; 26847 if (start == null) start = length - 1;
25675 return Lists.lastIndexOf(this, element, start); 26848 return Lists.lastIndexOf(this, element, start);
25676 } 26849 }
25677 26850
25678 ClientRect get first => this[0]; 26851 ClientRect get first {
26852 if (this.length > 0) return this[0];
26853 throw new StateError("No elements");
26854 }
25679 26855
25680 ClientRect get last => this[length - 1]; 26856 ClientRect get last {
26857 if (this.length > 0) return this[this.length - 1];
26858 throw new StateError("No elements");
26859 }
26860
26861 ClientRect get single {
26862 if (length == 1) return this[0];
26863 if (length == 0) throw new StateError("No elements");
26864 throw new StateError("More than one element");
26865 }
26866
26867 ClientRect min([int compare(ClientRect a, ClientRect b)]) => _Collections.minI nList(this, compare);
26868
26869 ClientRect max([int compare(ClientRect a, ClientRect b)]) => _Collections.maxI nList(this, compare);
25681 26870
25682 ClientRect removeAt(int pos) { 26871 ClientRect removeAt(int pos) {
25683 throw new UnsupportedError("Cannot removeAt on immutable List."); 26872 throw new UnsupportedError("Cannot removeAt on immutable List.");
25684 } 26873 }
25685 26874
25686 ClientRect removeLast() { 26875 ClientRect removeLast() {
25687 throw new UnsupportedError("Cannot removeLast on immutable List."); 26876 throw new UnsupportedError("Cannot removeLast on immutable List.");
25688 } 26877 }
25689 26878
25690 void setRange(int start, int rangeLength, List<ClientRect> from, [int startFro m]) { 26879 void setRange(int start, int rangeLength, List<ClientRect> from, [int startFro m]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
25727 CssRule operator[](int index) native "CSSRuleList_item_Callback"; 26916 CssRule operator[](int index) native "CSSRuleList_item_Callback";
25728 26917
25729 void operator[]=(int index, CssRule value) { 26918 void operator[]=(int index, CssRule value) {
25730 throw new UnsupportedError("Cannot assign element of immutable List."); 26919 throw new UnsupportedError("Cannot assign element of immutable List.");
25731 } 26920 }
25732 // -- start List<CssRule> mixins. 26921 // -- start List<CssRule> mixins.
25733 // CssRule is the element type. 26922 // CssRule is the element type.
25734 26923
25735 // From Iterable<CssRule>: 26924 // From Iterable<CssRule>:
25736 26925
25737 Iterator<CssRule> iterator() { 26926 Iterator<CssRule> get iterator {
25738 // Note: NodeLists are not fixed size. And most probably length shouldn't 26927 // Note: NodeLists are not fixed size. And most probably length shouldn't
25739 // be cached in both iterator _and_ forEach method. For now caching it 26928 // be cached in both iterator _and_ forEach method. For now caching it
25740 // for consistency. 26929 // for consistency.
25741 return new FixedSizeListIterator<CssRule>(this); 26930 return new FixedSizeListIterator<CssRule>(this);
25742 } 26931 }
25743 26932
25744 // From Collection<CssRule>:
25745
25746 void add(CssRule value) {
25747 throw new UnsupportedError("Cannot add to immutable List.");
25748 }
25749
25750 void addLast(CssRule value) {
25751 throw new UnsupportedError("Cannot add to immutable List.");
25752 }
25753
25754 void addAll(Collection<CssRule> collection) {
25755 throw new UnsupportedError("Cannot add to immutable List.");
25756 }
25757
25758 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssRule)) { 26933 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssRule)) {
25759 return Collections.reduce(this, initialValue, combine); 26934 return Collections.reduce(this, initialValue, combine);
25760 } 26935 }
25761 26936
25762 bool contains(CssRule element) => Collections.contains(this, element); 26937 bool contains(CssRule element) => Collections.contains(this, element);
25763 26938
25764 void forEach(void f(CssRule element)) => Collections.forEach(this, f); 26939 void forEach(void f(CssRule element)) => Collections.forEach(this, f);
25765 26940
25766 Collection map(f(CssRule element)) => Collections.map(this, [], f); 26941 String join([String separator]) => Collections.joinList(this, separator);
25767 26942
25768 Collection<CssRule> filter(bool f(CssRule element)) => 26943 List mappedBy(f(CssRule element)) => new MappedList<CssRule, dynamic>(this, f) ;
25769 Collections.filter(this, <CssRule>[], f); 26944
26945 Iterable<CssRule> where(bool f(CssRule element)) => new WhereIterable<CssRule> (this, f);
25770 26946
25771 bool every(bool f(CssRule element)) => Collections.every(this, f); 26947 bool every(bool f(CssRule element)) => Collections.every(this, f);
25772 26948
25773 bool some(bool f(CssRule element)) => Collections.some(this, f); 26949 bool any(bool f(CssRule element)) => Collections.any(this, f);
25774 26950
25775 bool get isEmpty => this.length == 0; 26951 bool get isEmpty => this.length == 0;
25776 26952
26953 List<CssRule> take(int n) => new ListView<CssRule>(this, 0, n);
26954
26955 Iterable<CssRule> takeWhile(bool test(CssRule value)) {
26956 return new TakeWhileIterable<CssRule>(this, test);
26957 }
26958
26959 List<CssRule> skip(int n) => new ListView<CssRule>(this, n, null);
26960
26961 Iterable<CssRule> skipWhile(bool test(CssRule value)) {
26962 return new SkipWhileIterable<CssRule>(this, test);
26963 }
26964
26965 CssRule firstMatching(bool test(CssRule value), { CssRule orElse() }) {
26966 return Collections.firstMatching(this, test, orElse);
26967 }
26968
26969 CssRule lastMatching(bool test(CssRule value), {CssRule orElse()}) {
26970 return Collections.lastMatchingInList(this, test, orElse);
26971 }
26972
26973 CssRule singleMatching(bool test(CssRule value)) {
26974 return Collections.singleMatching(this, test);
26975 }
26976
26977 CssRule elementAt(int index) {
26978 return this[index];
26979 }
26980
26981 // From Collection<CssRule>:
26982
26983 void add(CssRule value) {
26984 throw new UnsupportedError("Cannot add to immutable List.");
26985 }
26986
26987 void addLast(CssRule value) {
26988 throw new UnsupportedError("Cannot add to immutable List.");
26989 }
26990
26991 void addAll(Iterable<CssRule> iterable) {
26992 throw new UnsupportedError("Cannot add to immutable List.");
26993 }
26994
25777 // From List<CssRule>: 26995 // From List<CssRule>:
25778 void set length(int value) { 26996 void set length(int value) {
25779 throw new UnsupportedError("Cannot resize immutable List."); 26997 throw new UnsupportedError("Cannot resize immutable List.");
25780 } 26998 }
25781 26999
25782 void clear() { 27000 void clear() {
25783 throw new UnsupportedError("Cannot clear immutable List."); 27001 throw new UnsupportedError("Cannot clear immutable List.");
25784 } 27002 }
25785 27003
25786 void sort([int compare(CssRule a, CssRule b)]) { 27004 void sort([int compare(CssRule a, CssRule b)]) {
25787 throw new UnsupportedError("Cannot sort immutable List."); 27005 throw new UnsupportedError("Cannot sort immutable List.");
25788 } 27006 }
25789 27007
25790 int indexOf(CssRule element, [int start = 0]) => 27008 int indexOf(CssRule element, [int start = 0]) =>
25791 Lists.indexOf(this, element, start, this.length); 27009 Lists.indexOf(this, element, start, this.length);
25792 27010
25793 int lastIndexOf(CssRule element, [int start]) { 27011 int lastIndexOf(CssRule element, [int start]) {
25794 if (start == null) start = length - 1; 27012 if (start == null) start = length - 1;
25795 return Lists.lastIndexOf(this, element, start); 27013 return Lists.lastIndexOf(this, element, start);
25796 } 27014 }
25797 27015
25798 CssRule get first => this[0]; 27016 CssRule get first {
27017 if (this.length > 0) return this[0];
27018 throw new StateError("No elements");
27019 }
25799 27020
25800 CssRule get last => this[length - 1]; 27021 CssRule get last {
27022 if (this.length > 0) return this[this.length - 1];
27023 throw new StateError("No elements");
27024 }
27025
27026 CssRule get single {
27027 if (length == 1) return this[0];
27028 if (length == 0) throw new StateError("No elements");
27029 throw new StateError("More than one element");
27030 }
27031
27032 CssRule min([int compare(CssRule a, CssRule b)]) => _Collections.minInList(thi s, compare);
27033
27034 CssRule max([int compare(CssRule a, CssRule b)]) => _Collections.maxInList(thi s, compare);
25801 27035
25802 CssRule removeAt(int pos) { 27036 CssRule removeAt(int pos) {
25803 throw new UnsupportedError("Cannot removeAt on immutable List."); 27037 throw new UnsupportedError("Cannot removeAt on immutable List.");
25804 } 27038 }
25805 27039
25806 CssRule removeLast() { 27040 CssRule removeLast() {
25807 throw new UnsupportedError("Cannot removeLast on immutable List."); 27041 throw new UnsupportedError("Cannot removeLast on immutable List.");
25808 } 27042 }
25809 27043
25810 void setRange(int start, int rangeLength, List<CssRule> from, [int startFrom]) { 27044 void setRange(int start, int rangeLength, List<CssRule> from, [int startFrom]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
25847 CssValue operator[](int index) native "CSSValueList_item_Callback"; 27081 CssValue operator[](int index) native "CSSValueList_item_Callback";
25848 27082
25849 void operator[]=(int index, CssValue value) { 27083 void operator[]=(int index, CssValue value) {
25850 throw new UnsupportedError("Cannot assign element of immutable List."); 27084 throw new UnsupportedError("Cannot assign element of immutable List.");
25851 } 27085 }
25852 // -- start List<CssValue> mixins. 27086 // -- start List<CssValue> mixins.
25853 // CssValue is the element type. 27087 // CssValue is the element type.
25854 27088
25855 // From Iterable<CssValue>: 27089 // From Iterable<CssValue>:
25856 27090
25857 Iterator<CssValue> iterator() { 27091 Iterator<CssValue> get iterator {
25858 // Note: NodeLists are not fixed size. And most probably length shouldn't 27092 // Note: NodeLists are not fixed size. And most probably length shouldn't
25859 // be cached in both iterator _and_ forEach method. For now caching it 27093 // be cached in both iterator _and_ forEach method. For now caching it
25860 // for consistency. 27094 // for consistency.
25861 return new FixedSizeListIterator<CssValue>(this); 27095 return new FixedSizeListIterator<CssValue>(this);
25862 } 27096 }
25863 27097
25864 // From Collection<CssValue>:
25865
25866 void add(CssValue value) {
25867 throw new UnsupportedError("Cannot add to immutable List.");
25868 }
25869
25870 void addLast(CssValue value) {
25871 throw new UnsupportedError("Cannot add to immutable List.");
25872 }
25873
25874 void addAll(Collection<CssValue> collection) {
25875 throw new UnsupportedError("Cannot add to immutable List.");
25876 }
25877
25878 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssValue)) { 27098 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, CssValue)) {
25879 return Collections.reduce(this, initialValue, combine); 27099 return Collections.reduce(this, initialValue, combine);
25880 } 27100 }
25881 27101
25882 bool contains(CssValue element) => Collections.contains(this, element); 27102 bool contains(CssValue element) => Collections.contains(this, element);
25883 27103
25884 void forEach(void f(CssValue element)) => Collections.forEach(this, f); 27104 void forEach(void f(CssValue element)) => Collections.forEach(this, f);
25885 27105
25886 Collection map(f(CssValue element)) => Collections.map(this, [], f); 27106 String join([String separator]) => Collections.joinList(this, separator);
25887 27107
25888 Collection<CssValue> filter(bool f(CssValue element)) => 27108 List mappedBy(f(CssValue element)) => new MappedList<CssValue, dynamic>(this, f);
25889 Collections.filter(this, <CssValue>[], f); 27109
27110 Iterable<CssValue> where(bool f(CssValue element)) => new WhereIterable<CssVal ue>(this, f);
25890 27111
25891 bool every(bool f(CssValue element)) => Collections.every(this, f); 27112 bool every(bool f(CssValue element)) => Collections.every(this, f);
25892 27113
25893 bool some(bool f(CssValue element)) => Collections.some(this, f); 27114 bool any(bool f(CssValue element)) => Collections.any(this, f);
25894 27115
25895 bool get isEmpty => this.length == 0; 27116 bool get isEmpty => this.length == 0;
25896 27117
27118 List<CssValue> take(int n) => new ListView<CssValue>(this, 0, n);
27119
27120 Iterable<CssValue> takeWhile(bool test(CssValue value)) {
27121 return new TakeWhileIterable<CssValue>(this, test);
27122 }
27123
27124 List<CssValue> skip(int n) => new ListView<CssValue>(this, n, null);
27125
27126 Iterable<CssValue> skipWhile(bool test(CssValue value)) {
27127 return new SkipWhileIterable<CssValue>(this, test);
27128 }
27129
27130 CssValue firstMatching(bool test(CssValue value), { CssValue orElse() }) {
27131 return Collections.firstMatching(this, test, orElse);
27132 }
27133
27134 CssValue lastMatching(bool test(CssValue value), {CssValue orElse()}) {
27135 return Collections.lastMatchingInList(this, test, orElse);
27136 }
27137
27138 CssValue singleMatching(bool test(CssValue value)) {
27139 return Collections.singleMatching(this, test);
27140 }
27141
27142 CssValue elementAt(int index) {
27143 return this[index];
27144 }
27145
27146 // From Collection<CssValue>:
27147
27148 void add(CssValue value) {
27149 throw new UnsupportedError("Cannot add to immutable List.");
27150 }
27151
27152 void addLast(CssValue value) {
27153 throw new UnsupportedError("Cannot add to immutable List.");
27154 }
27155
27156 void addAll(Iterable<CssValue> iterable) {
27157 throw new UnsupportedError("Cannot add to immutable List.");
27158 }
27159
25897 // From List<CssValue>: 27160 // From List<CssValue>:
25898 void set length(int value) { 27161 void set length(int value) {
25899 throw new UnsupportedError("Cannot resize immutable List."); 27162 throw new UnsupportedError("Cannot resize immutable List.");
25900 } 27163 }
25901 27164
25902 void clear() { 27165 void clear() {
25903 throw new UnsupportedError("Cannot clear immutable List."); 27166 throw new UnsupportedError("Cannot clear immutable List.");
25904 } 27167 }
25905 27168
25906 void sort([int compare(CssValue a, CssValue b)]) { 27169 void sort([int compare(CssValue a, CssValue b)]) {
25907 throw new UnsupportedError("Cannot sort immutable List."); 27170 throw new UnsupportedError("Cannot sort immutable List.");
25908 } 27171 }
25909 27172
25910 int indexOf(CssValue element, [int start = 0]) => 27173 int indexOf(CssValue element, [int start = 0]) =>
25911 Lists.indexOf(this, element, start, this.length); 27174 Lists.indexOf(this, element, start, this.length);
25912 27175
25913 int lastIndexOf(CssValue element, [int start]) { 27176 int lastIndexOf(CssValue element, [int start]) {
25914 if (start == null) start = length - 1; 27177 if (start == null) start = length - 1;
25915 return Lists.lastIndexOf(this, element, start); 27178 return Lists.lastIndexOf(this, element, start);
25916 } 27179 }
25917 27180
25918 CssValue get first => this[0]; 27181 CssValue get first {
27182 if (this.length > 0) return this[0];
27183 throw new StateError("No elements");
27184 }
25919 27185
25920 CssValue get last => this[length - 1]; 27186 CssValue get last {
27187 if (this.length > 0) return this[this.length - 1];
27188 throw new StateError("No elements");
27189 }
27190
27191 CssValue get single {
27192 if (length == 1) return this[0];
27193 if (length == 0) throw new StateError("No elements");
27194 throw new StateError("More than one element");
27195 }
27196
27197 CssValue min([int compare(CssValue a, CssValue b)]) => _Collections.minInList( this, compare);
27198
27199 CssValue max([int compare(CssValue a, CssValue b)]) => _Collections.maxInList( this, compare);
25921 27200
25922 CssValue removeAt(int pos) { 27201 CssValue removeAt(int pos) {
25923 throw new UnsupportedError("Cannot removeAt on immutable List."); 27202 throw new UnsupportedError("Cannot removeAt on immutable List.");
25924 } 27203 }
25925 27204
25926 CssValue removeLast() { 27205 CssValue removeLast() {
25927 throw new UnsupportedError("Cannot removeLast on immutable List."); 27206 throw new UnsupportedError("Cannot removeLast on immutable List.");
25928 } 27207 }
25929 27208
25930 void setRange(int start, int rangeLength, List<CssValue> from, [int startFrom] ) { 27209 void setRange(int start, int rangeLength, List<CssValue> from, [int startFrom] ) {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
26103 Entry operator[](int index) native "EntryArray_item_Callback"; 27382 Entry operator[](int index) native "EntryArray_item_Callback";
26104 27383
26105 void operator[]=(int index, Entry value) { 27384 void operator[]=(int index, Entry value) {
26106 throw new UnsupportedError("Cannot assign element of immutable List."); 27385 throw new UnsupportedError("Cannot assign element of immutable List.");
26107 } 27386 }
26108 // -- start List<Entry> mixins. 27387 // -- start List<Entry> mixins.
26109 // Entry is the element type. 27388 // Entry is the element type.
26110 27389
26111 // From Iterable<Entry>: 27390 // From Iterable<Entry>:
26112 27391
26113 Iterator<Entry> iterator() { 27392 Iterator<Entry> get iterator {
26114 // Note: NodeLists are not fixed size. And most probably length shouldn't 27393 // Note: NodeLists are not fixed size. And most probably length shouldn't
26115 // be cached in both iterator _and_ forEach method. For now caching it 27394 // be cached in both iterator _and_ forEach method. For now caching it
26116 // for consistency. 27395 // for consistency.
26117 return new FixedSizeListIterator<Entry>(this); 27396 return new FixedSizeListIterator<Entry>(this);
26118 } 27397 }
26119 27398
26120 // From Collection<Entry>:
26121
26122 void add(Entry value) {
26123 throw new UnsupportedError("Cannot add to immutable List.");
26124 }
26125
26126 void addLast(Entry value) {
26127 throw new UnsupportedError("Cannot add to immutable List.");
26128 }
26129
26130 void addAll(Collection<Entry> collection) {
26131 throw new UnsupportedError("Cannot add to immutable List.");
26132 }
26133
26134 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Entry)) { 27399 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Entry)) {
26135 return Collections.reduce(this, initialValue, combine); 27400 return Collections.reduce(this, initialValue, combine);
26136 } 27401 }
26137 27402
26138 bool contains(Entry element) => Collections.contains(this, element); 27403 bool contains(Entry element) => Collections.contains(this, element);
26139 27404
26140 void forEach(void f(Entry element)) => Collections.forEach(this, f); 27405 void forEach(void f(Entry element)) => Collections.forEach(this, f);
26141 27406
26142 Collection map(f(Entry element)) => Collections.map(this, [], f); 27407 String join([String separator]) => Collections.joinList(this, separator);
26143 27408
26144 Collection<Entry> filter(bool f(Entry element)) => 27409 List mappedBy(f(Entry element)) => new MappedList<Entry, dynamic>(this, f);
26145 Collections.filter(this, <Entry>[], f); 27410
27411 Iterable<Entry> where(bool f(Entry element)) => new WhereIterable<Entry>(this, f);
26146 27412
26147 bool every(bool f(Entry element)) => Collections.every(this, f); 27413 bool every(bool f(Entry element)) => Collections.every(this, f);
26148 27414
26149 bool some(bool f(Entry element)) => Collections.some(this, f); 27415 bool any(bool f(Entry element)) => Collections.any(this, f);
26150 27416
26151 bool get isEmpty => this.length == 0; 27417 bool get isEmpty => this.length == 0;
26152 27418
27419 List<Entry> take(int n) => new ListView<Entry>(this, 0, n);
27420
27421 Iterable<Entry> takeWhile(bool test(Entry value)) {
27422 return new TakeWhileIterable<Entry>(this, test);
27423 }
27424
27425 List<Entry> skip(int n) => new ListView<Entry>(this, n, null);
27426
27427 Iterable<Entry> skipWhile(bool test(Entry value)) {
27428 return new SkipWhileIterable<Entry>(this, test);
27429 }
27430
27431 Entry firstMatching(bool test(Entry value), { Entry orElse() }) {
27432 return Collections.firstMatching(this, test, orElse);
27433 }
27434
27435 Entry lastMatching(bool test(Entry value), {Entry orElse()}) {
27436 return Collections.lastMatchingInList(this, test, orElse);
27437 }
27438
27439 Entry singleMatching(bool test(Entry value)) {
27440 return Collections.singleMatching(this, test);
27441 }
27442
27443 Entry elementAt(int index) {
27444 return this[index];
27445 }
27446
27447 // From Collection<Entry>:
27448
27449 void add(Entry value) {
27450 throw new UnsupportedError("Cannot add to immutable List.");
27451 }
27452
27453 void addLast(Entry value) {
27454 throw new UnsupportedError("Cannot add to immutable List.");
27455 }
27456
27457 void addAll(Iterable<Entry> iterable) {
27458 throw new UnsupportedError("Cannot add to immutable List.");
27459 }
27460
26153 // From List<Entry>: 27461 // From List<Entry>:
26154 void set length(int value) { 27462 void set length(int value) {
26155 throw new UnsupportedError("Cannot resize immutable List."); 27463 throw new UnsupportedError("Cannot resize immutable List.");
26156 } 27464 }
26157 27465
26158 void clear() { 27466 void clear() {
26159 throw new UnsupportedError("Cannot clear immutable List."); 27467 throw new UnsupportedError("Cannot clear immutable List.");
26160 } 27468 }
26161 27469
26162 void sort([int compare(Entry a, Entry b)]) { 27470 void sort([int compare(Entry a, Entry b)]) {
26163 throw new UnsupportedError("Cannot sort immutable List."); 27471 throw new UnsupportedError("Cannot sort immutable List.");
26164 } 27472 }
26165 27473
26166 int indexOf(Entry element, [int start = 0]) => 27474 int indexOf(Entry element, [int start = 0]) =>
26167 Lists.indexOf(this, element, start, this.length); 27475 Lists.indexOf(this, element, start, this.length);
26168 27476
26169 int lastIndexOf(Entry element, [int start]) { 27477 int lastIndexOf(Entry element, [int start]) {
26170 if (start == null) start = length - 1; 27478 if (start == null) start = length - 1;
26171 return Lists.lastIndexOf(this, element, start); 27479 return Lists.lastIndexOf(this, element, start);
26172 } 27480 }
26173 27481
26174 Entry get first => this[0]; 27482 Entry get first {
27483 if (this.length > 0) return this[0];
27484 throw new StateError("No elements");
27485 }
26175 27486
26176 Entry get last => this[length - 1]; 27487 Entry get last {
27488 if (this.length > 0) return this[this.length - 1];
27489 throw new StateError("No elements");
27490 }
27491
27492 Entry get single {
27493 if (length == 1) return this[0];
27494 if (length == 0) throw new StateError("No elements");
27495 throw new StateError("More than one element");
27496 }
27497
27498 Entry min([int compare(Entry a, Entry b)]) => _Collections.minInList(this, com pare);
27499
27500 Entry max([int compare(Entry a, Entry b)]) => _Collections.maxInList(this, com pare);
26177 27501
26178 Entry removeAt(int pos) { 27502 Entry removeAt(int pos) {
26179 throw new UnsupportedError("Cannot removeAt on immutable List."); 27503 throw new UnsupportedError("Cannot removeAt on immutable List.");
26180 } 27504 }
26181 27505
26182 Entry removeLast() { 27506 Entry removeLast() {
26183 throw new UnsupportedError("Cannot removeLast on immutable List."); 27507 throw new UnsupportedError("Cannot removeLast on immutable List.");
26184 } 27508 }
26185 27509
26186 void setRange(int start, int rangeLength, List<Entry> from, [int startFrom]) { 27510 void setRange(int start, int rangeLength, List<Entry> from, [int startFrom]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
26223 EntrySync operator[](int index) native "EntryArraySync_item_Callback"; 27547 EntrySync operator[](int index) native "EntryArraySync_item_Callback";
26224 27548
26225 void operator[]=(int index, EntrySync value) { 27549 void operator[]=(int index, EntrySync value) {
26226 throw new UnsupportedError("Cannot assign element of immutable List."); 27550 throw new UnsupportedError("Cannot assign element of immutable List.");
26227 } 27551 }
26228 // -- start List<EntrySync> mixins. 27552 // -- start List<EntrySync> mixins.
26229 // EntrySync is the element type. 27553 // EntrySync is the element type.
26230 27554
26231 // From Iterable<EntrySync>: 27555 // From Iterable<EntrySync>:
26232 27556
26233 Iterator<EntrySync> iterator() { 27557 Iterator<EntrySync> get iterator {
26234 // Note: NodeLists are not fixed size. And most probably length shouldn't 27558 // Note: NodeLists are not fixed size. And most probably length shouldn't
26235 // be cached in both iterator _and_ forEach method. For now caching it 27559 // be cached in both iterator _and_ forEach method. For now caching it
26236 // for consistency. 27560 // for consistency.
26237 return new FixedSizeListIterator<EntrySync>(this); 27561 return new FixedSizeListIterator<EntrySync>(this);
26238 } 27562 }
26239 27563
26240 // From Collection<EntrySync>:
26241
26242 void add(EntrySync value) {
26243 throw new UnsupportedError("Cannot add to immutable List.");
26244 }
26245
26246 void addLast(EntrySync value) {
26247 throw new UnsupportedError("Cannot add to immutable List.");
26248 }
26249
26250 void addAll(Collection<EntrySync> collection) {
26251 throw new UnsupportedError("Cannot add to immutable List.");
26252 }
26253
26254 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, EntrySync)) { 27564 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, EntrySync)) {
26255 return Collections.reduce(this, initialValue, combine); 27565 return Collections.reduce(this, initialValue, combine);
26256 } 27566 }
26257 27567
26258 bool contains(EntrySync element) => Collections.contains(this, element); 27568 bool contains(EntrySync element) => Collections.contains(this, element);
26259 27569
26260 void forEach(void f(EntrySync element)) => Collections.forEach(this, f); 27570 void forEach(void f(EntrySync element)) => Collections.forEach(this, f);
26261 27571
26262 Collection map(f(EntrySync element)) => Collections.map(this, [], f); 27572 String join([String separator]) => Collections.joinList(this, separator);
26263 27573
26264 Collection<EntrySync> filter(bool f(EntrySync element)) => 27574 List mappedBy(f(EntrySync element)) => new MappedList<EntrySync, dynamic>(this , f);
26265 Collections.filter(this, <EntrySync>[], f); 27575
27576 Iterable<EntrySync> where(bool f(EntrySync element)) => new WhereIterable<Entr ySync>(this, f);
26266 27577
26267 bool every(bool f(EntrySync element)) => Collections.every(this, f); 27578 bool every(bool f(EntrySync element)) => Collections.every(this, f);
26268 27579
26269 bool some(bool f(EntrySync element)) => Collections.some(this, f); 27580 bool any(bool f(EntrySync element)) => Collections.any(this, f);
26270 27581
26271 bool get isEmpty => this.length == 0; 27582 bool get isEmpty => this.length == 0;
26272 27583
27584 List<EntrySync> take(int n) => new ListView<EntrySync>(this, 0, n);
27585
27586 Iterable<EntrySync> takeWhile(bool test(EntrySync value)) {
27587 return new TakeWhileIterable<EntrySync>(this, test);
27588 }
27589
27590 List<EntrySync> skip(int n) => new ListView<EntrySync>(this, n, null);
27591
27592 Iterable<EntrySync> skipWhile(bool test(EntrySync value)) {
27593 return new SkipWhileIterable<EntrySync>(this, test);
27594 }
27595
27596 EntrySync firstMatching(bool test(EntrySync value), { EntrySync orElse() }) {
27597 return Collections.firstMatching(this, test, orElse);
27598 }
27599
27600 EntrySync lastMatching(bool test(EntrySync value), {EntrySync orElse()}) {
27601 return Collections.lastMatchingInList(this, test, orElse);
27602 }
27603
27604 EntrySync singleMatching(bool test(EntrySync value)) {
27605 return Collections.singleMatching(this, test);
27606 }
27607
27608 EntrySync elementAt(int index) {
27609 return this[index];
27610 }
27611
27612 // From Collection<EntrySync>:
27613
27614 void add(EntrySync value) {
27615 throw new UnsupportedError("Cannot add to immutable List.");
27616 }
27617
27618 void addLast(EntrySync value) {
27619 throw new UnsupportedError("Cannot add to immutable List.");
27620 }
27621
27622 void addAll(Iterable<EntrySync> iterable) {
27623 throw new UnsupportedError("Cannot add to immutable List.");
27624 }
27625
26273 // From List<EntrySync>: 27626 // From List<EntrySync>:
26274 void set length(int value) { 27627 void set length(int value) {
26275 throw new UnsupportedError("Cannot resize immutable List."); 27628 throw new UnsupportedError("Cannot resize immutable List.");
26276 } 27629 }
26277 27630
26278 void clear() { 27631 void clear() {
26279 throw new UnsupportedError("Cannot clear immutable List."); 27632 throw new UnsupportedError("Cannot clear immutable List.");
26280 } 27633 }
26281 27634
26282 void sort([int compare(EntrySync a, EntrySync b)]) { 27635 void sort([int compare(EntrySync a, EntrySync b)]) {
26283 throw new UnsupportedError("Cannot sort immutable List."); 27636 throw new UnsupportedError("Cannot sort immutable List.");
26284 } 27637 }
26285 27638
26286 int indexOf(EntrySync element, [int start = 0]) => 27639 int indexOf(EntrySync element, [int start = 0]) =>
26287 Lists.indexOf(this, element, start, this.length); 27640 Lists.indexOf(this, element, start, this.length);
26288 27641
26289 int lastIndexOf(EntrySync element, [int start]) { 27642 int lastIndexOf(EntrySync element, [int start]) {
26290 if (start == null) start = length - 1; 27643 if (start == null) start = length - 1;
26291 return Lists.lastIndexOf(this, element, start); 27644 return Lists.lastIndexOf(this, element, start);
26292 } 27645 }
26293 27646
26294 EntrySync get first => this[0]; 27647 EntrySync get first {
27648 if (this.length > 0) return this[0];
27649 throw new StateError("No elements");
27650 }
26295 27651
26296 EntrySync get last => this[length - 1]; 27652 EntrySync get last {
27653 if (this.length > 0) return this[this.length - 1];
27654 throw new StateError("No elements");
27655 }
27656
27657 EntrySync get single {
27658 if (length == 1) return this[0];
27659 if (length == 0) throw new StateError("No elements");
27660 throw new StateError("More than one element");
27661 }
27662
27663 EntrySync min([int compare(EntrySync a, EntrySync b)]) => _Collections.minInLi st(this, compare);
27664
27665 EntrySync max([int compare(EntrySync a, EntrySync b)]) => _Collections.maxInLi st(this, compare);
26297 27666
26298 EntrySync removeAt(int pos) { 27667 EntrySync removeAt(int pos) {
26299 throw new UnsupportedError("Cannot removeAt on immutable List."); 27668 throw new UnsupportedError("Cannot removeAt on immutable List.");
26300 } 27669 }
26301 27670
26302 EntrySync removeLast() { 27671 EntrySync removeLast() {
26303 throw new UnsupportedError("Cannot removeLast on immutable List."); 27672 throw new UnsupportedError("Cannot removeLast on immutable List.");
26304 } 27673 }
26305 27674
26306 void setRange(int start, int rangeLength, List<EntrySync> from, [int startFrom ]) { 27675 void setRange(int start, int rangeLength, List<EntrySync> from, [int startFrom ]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
26343 Gamepad operator[](int index) native "GamepadList_item_Callback"; 27712 Gamepad operator[](int index) native "GamepadList_item_Callback";
26344 27713
26345 void operator[]=(int index, Gamepad value) { 27714 void operator[]=(int index, Gamepad value) {
26346 throw new UnsupportedError("Cannot assign element of immutable List."); 27715 throw new UnsupportedError("Cannot assign element of immutable List.");
26347 } 27716 }
26348 // -- start List<Gamepad> mixins. 27717 // -- start List<Gamepad> mixins.
26349 // Gamepad is the element type. 27718 // Gamepad is the element type.
26350 27719
26351 // From Iterable<Gamepad>: 27720 // From Iterable<Gamepad>:
26352 27721
26353 Iterator<Gamepad> iterator() { 27722 Iterator<Gamepad> get iterator {
26354 // Note: NodeLists are not fixed size. And most probably length shouldn't 27723 // Note: NodeLists are not fixed size. And most probably length shouldn't
26355 // be cached in both iterator _and_ forEach method. For now caching it 27724 // be cached in both iterator _and_ forEach method. For now caching it
26356 // for consistency. 27725 // for consistency.
26357 return new FixedSizeListIterator<Gamepad>(this); 27726 return new FixedSizeListIterator<Gamepad>(this);
26358 } 27727 }
26359 27728
26360 // From Collection<Gamepad>:
26361
26362 void add(Gamepad value) {
26363 throw new UnsupportedError("Cannot add to immutable List.");
26364 }
26365
26366 void addLast(Gamepad value) {
26367 throw new UnsupportedError("Cannot add to immutable List.");
26368 }
26369
26370 void addAll(Collection<Gamepad> collection) {
26371 throw new UnsupportedError("Cannot add to immutable List.");
26372 }
26373
26374 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Gamepad)) { 27729 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, Gamepad)) {
26375 return Collections.reduce(this, initialValue, combine); 27730 return Collections.reduce(this, initialValue, combine);
26376 } 27731 }
26377 27732
26378 bool contains(Gamepad element) => Collections.contains(this, element); 27733 bool contains(Gamepad element) => Collections.contains(this, element);
26379 27734
26380 void forEach(void f(Gamepad element)) => Collections.forEach(this, f); 27735 void forEach(void f(Gamepad element)) => Collections.forEach(this, f);
26381 27736
26382 Collection map(f(Gamepad element)) => Collections.map(this, [], f); 27737 String join([String separator]) => Collections.joinList(this, separator);
26383 27738
26384 Collection<Gamepad> filter(bool f(Gamepad element)) => 27739 List mappedBy(f(Gamepad element)) => new MappedList<Gamepad, dynamic>(this, f) ;
26385 Collections.filter(this, <Gamepad>[], f); 27740
27741 Iterable<Gamepad> where(bool f(Gamepad element)) => new WhereIterable<Gamepad> (this, f);
26386 27742
26387 bool every(bool f(Gamepad element)) => Collections.every(this, f); 27743 bool every(bool f(Gamepad element)) => Collections.every(this, f);
26388 27744
26389 bool some(bool f(Gamepad element)) => Collections.some(this, f); 27745 bool any(bool f(Gamepad element)) => Collections.any(this, f);
26390 27746
26391 bool get isEmpty => this.length == 0; 27747 bool get isEmpty => this.length == 0;
26392 27748
27749 List<Gamepad> take(int n) => new ListView<Gamepad>(this, 0, n);
27750
27751 Iterable<Gamepad> takeWhile(bool test(Gamepad value)) {
27752 return new TakeWhileIterable<Gamepad>(this, test);
27753 }
27754
27755 List<Gamepad> skip(int n) => new ListView<Gamepad>(this, n, null);
27756
27757 Iterable<Gamepad> skipWhile(bool test(Gamepad value)) {
27758 return new SkipWhileIterable<Gamepad>(this, test);
27759 }
27760
27761 Gamepad firstMatching(bool test(Gamepad value), { Gamepad orElse() }) {
27762 return Collections.firstMatching(this, test, orElse);
27763 }
27764
27765 Gamepad lastMatching(bool test(Gamepad value), {Gamepad orElse()}) {
27766 return Collections.lastMatchingInList(this, test, orElse);
27767 }
27768
27769 Gamepad singleMatching(bool test(Gamepad value)) {
27770 return Collections.singleMatching(this, test);
27771 }
27772
27773 Gamepad elementAt(int index) {
27774 return this[index];
27775 }
27776
27777 // From Collection<Gamepad>:
27778
27779 void add(Gamepad value) {
27780 throw new UnsupportedError("Cannot add to immutable List.");
27781 }
27782
27783 void addLast(Gamepad value) {
27784 throw new UnsupportedError("Cannot add to immutable List.");
27785 }
27786
27787 void addAll(Iterable<Gamepad> iterable) {
27788 throw new UnsupportedError("Cannot add to immutable List.");
27789 }
27790
26393 // From List<Gamepad>: 27791 // From List<Gamepad>:
26394 void set length(int value) { 27792 void set length(int value) {
26395 throw new UnsupportedError("Cannot resize immutable List."); 27793 throw new UnsupportedError("Cannot resize immutable List.");
26396 } 27794 }
26397 27795
26398 void clear() { 27796 void clear() {
26399 throw new UnsupportedError("Cannot clear immutable List."); 27797 throw new UnsupportedError("Cannot clear immutable List.");
26400 } 27798 }
26401 27799
26402 void sort([int compare(Gamepad a, Gamepad b)]) { 27800 void sort([int compare(Gamepad a, Gamepad b)]) {
26403 throw new UnsupportedError("Cannot sort immutable List."); 27801 throw new UnsupportedError("Cannot sort immutable List.");
26404 } 27802 }
26405 27803
26406 int indexOf(Gamepad element, [int start = 0]) => 27804 int indexOf(Gamepad element, [int start = 0]) =>
26407 Lists.indexOf(this, element, start, this.length); 27805 Lists.indexOf(this, element, start, this.length);
26408 27806
26409 int lastIndexOf(Gamepad element, [int start]) { 27807 int lastIndexOf(Gamepad element, [int start]) {
26410 if (start == null) start = length - 1; 27808 if (start == null) start = length - 1;
26411 return Lists.lastIndexOf(this, element, start); 27809 return Lists.lastIndexOf(this, element, start);
26412 } 27810 }
26413 27811
26414 Gamepad get first => this[0]; 27812 Gamepad get first {
27813 if (this.length > 0) return this[0];
27814 throw new StateError("No elements");
27815 }
26415 27816
26416 Gamepad get last => this[length - 1]; 27817 Gamepad get last {
27818 if (this.length > 0) return this[this.length - 1];
27819 throw new StateError("No elements");
27820 }
27821
27822 Gamepad get single {
27823 if (length == 1) return this[0];
27824 if (length == 0) throw new StateError("No elements");
27825 throw new StateError("More than one element");
27826 }
27827
27828 Gamepad min([int compare(Gamepad a, Gamepad b)]) => _Collections.minInList(thi s, compare);
27829
27830 Gamepad max([int compare(Gamepad a, Gamepad b)]) => _Collections.maxInList(thi s, compare);
26417 27831
26418 Gamepad removeAt(int pos) { 27832 Gamepad removeAt(int pos) {
26419 throw new UnsupportedError("Cannot removeAt on immutable List."); 27833 throw new UnsupportedError("Cannot removeAt on immutable List.");
26420 } 27834 }
26421 27835
26422 Gamepad removeLast() { 27836 Gamepad removeLast() {
26423 throw new UnsupportedError("Cannot removeLast on immutable List."); 27837 throw new UnsupportedError("Cannot removeLast on immutable List.");
26424 } 27838 }
26425 27839
26426 void setRange(int start, int rangeLength, List<Gamepad> from, [int startFrom]) { 27840 void setRange(int start, int rangeLength, List<Gamepad> from, [int startFrom]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
26463 MediaStream operator[](int index) native "MediaStreamList_item_Callback"; 27877 MediaStream operator[](int index) native "MediaStreamList_item_Callback";
26464 27878
26465 void operator[]=(int index, MediaStream value) { 27879 void operator[]=(int index, MediaStream value) {
26466 throw new UnsupportedError("Cannot assign element of immutable List."); 27880 throw new UnsupportedError("Cannot assign element of immutable List.");
26467 } 27881 }
26468 // -- start List<MediaStream> mixins. 27882 // -- start List<MediaStream> mixins.
26469 // MediaStream is the element type. 27883 // MediaStream is the element type.
26470 27884
26471 // From Iterable<MediaStream>: 27885 // From Iterable<MediaStream>:
26472 27886
26473 Iterator<MediaStream> iterator() { 27887 Iterator<MediaStream> get iterator {
26474 // Note: NodeLists are not fixed size. And most probably length shouldn't 27888 // Note: NodeLists are not fixed size. And most probably length shouldn't
26475 // be cached in both iterator _and_ forEach method. For now caching it 27889 // be cached in both iterator _and_ forEach method. For now caching it
26476 // for consistency. 27890 // for consistency.
26477 return new FixedSizeListIterator<MediaStream>(this); 27891 return new FixedSizeListIterator<MediaStream>(this);
26478 } 27892 }
26479 27893
26480 // From Collection<MediaStream>:
26481
26482 void add(MediaStream value) {
26483 throw new UnsupportedError("Cannot add to immutable List.");
26484 }
26485
26486 void addLast(MediaStream value) {
26487 throw new UnsupportedError("Cannot add to immutable List.");
26488 }
26489
26490 void addAll(Collection<MediaStream> collection) {
26491 throw new UnsupportedError("Cannot add to immutable List.");
26492 }
26493
26494 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, MediaStream)) { 27894 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, MediaStream)) {
26495 return Collections.reduce(this, initialValue, combine); 27895 return Collections.reduce(this, initialValue, combine);
26496 } 27896 }
26497 27897
26498 bool contains(MediaStream element) => Collections.contains(this, element); 27898 bool contains(MediaStream element) => Collections.contains(this, element);
26499 27899
26500 void forEach(void f(MediaStream element)) => Collections.forEach(this, f); 27900 void forEach(void f(MediaStream element)) => Collections.forEach(this, f);
26501 27901
26502 Collection map(f(MediaStream element)) => Collections.map(this, [], f); 27902 String join([String separator]) => Collections.joinList(this, separator);
26503 27903
26504 Collection<MediaStream> filter(bool f(MediaStream element)) => 27904 List mappedBy(f(MediaStream element)) => new MappedList<MediaStream, dynamic>( this, f);
26505 Collections.filter(this, <MediaStream>[], f); 27905
27906 Iterable<MediaStream> where(bool f(MediaStream element)) => new WhereIterable< MediaStream>(this, f);
26506 27907
26507 bool every(bool f(MediaStream element)) => Collections.every(this, f); 27908 bool every(bool f(MediaStream element)) => Collections.every(this, f);
26508 27909
26509 bool some(bool f(MediaStream element)) => Collections.some(this, f); 27910 bool any(bool f(MediaStream element)) => Collections.any(this, f);
26510 27911
26511 bool get isEmpty => this.length == 0; 27912 bool get isEmpty => this.length == 0;
26512 27913
27914 List<MediaStream> take(int n) => new ListView<MediaStream>(this, 0, n);
27915
27916 Iterable<MediaStream> takeWhile(bool test(MediaStream value)) {
27917 return new TakeWhileIterable<MediaStream>(this, test);
27918 }
27919
27920 List<MediaStream> skip(int n) => new ListView<MediaStream>(this, n, null);
27921
27922 Iterable<MediaStream> skipWhile(bool test(MediaStream value)) {
27923 return new SkipWhileIterable<MediaStream>(this, test);
27924 }
27925
27926 MediaStream firstMatching(bool test(MediaStream value), { MediaStream orElse() }) {
27927 return Collections.firstMatching(this, test, orElse);
27928 }
27929
27930 MediaStream lastMatching(bool test(MediaStream value), {MediaStream orElse()}) {
27931 return Collections.lastMatchingInList(this, test, orElse);
27932 }
27933
27934 MediaStream singleMatching(bool test(MediaStream value)) {
27935 return Collections.singleMatching(this, test);
27936 }
27937
27938 MediaStream elementAt(int index) {
27939 return this[index];
27940 }
27941
27942 // From Collection<MediaStream>:
27943
27944 void add(MediaStream value) {
27945 throw new UnsupportedError("Cannot add to immutable List.");
27946 }
27947
27948 void addLast(MediaStream value) {
27949 throw new UnsupportedError("Cannot add to immutable List.");
27950 }
27951
27952 void addAll(Iterable<MediaStream> iterable) {
27953 throw new UnsupportedError("Cannot add to immutable List.");
27954 }
27955
26513 // From List<MediaStream>: 27956 // From List<MediaStream>:
26514 void set length(int value) { 27957 void set length(int value) {
26515 throw new UnsupportedError("Cannot resize immutable List."); 27958 throw new UnsupportedError("Cannot resize immutable List.");
26516 } 27959 }
26517 27960
26518 void clear() { 27961 void clear() {
26519 throw new UnsupportedError("Cannot clear immutable List."); 27962 throw new UnsupportedError("Cannot clear immutable List.");
26520 } 27963 }
26521 27964
26522 void sort([int compare(MediaStream a, MediaStream b)]) { 27965 void sort([int compare(MediaStream a, MediaStream b)]) {
26523 throw new UnsupportedError("Cannot sort immutable List."); 27966 throw new UnsupportedError("Cannot sort immutable List.");
26524 } 27967 }
26525 27968
26526 int indexOf(MediaStream element, [int start = 0]) => 27969 int indexOf(MediaStream element, [int start = 0]) =>
26527 Lists.indexOf(this, element, start, this.length); 27970 Lists.indexOf(this, element, start, this.length);
26528 27971
26529 int lastIndexOf(MediaStream element, [int start]) { 27972 int lastIndexOf(MediaStream element, [int start]) {
26530 if (start == null) start = length - 1; 27973 if (start == null) start = length - 1;
26531 return Lists.lastIndexOf(this, element, start); 27974 return Lists.lastIndexOf(this, element, start);
26532 } 27975 }
26533 27976
26534 MediaStream get first => this[0]; 27977 MediaStream get first {
27978 if (this.length > 0) return this[0];
27979 throw new StateError("No elements");
27980 }
26535 27981
26536 MediaStream get last => this[length - 1]; 27982 MediaStream get last {
27983 if (this.length > 0) return this[this.length - 1];
27984 throw new StateError("No elements");
27985 }
27986
27987 MediaStream get single {
27988 if (length == 1) return this[0];
27989 if (length == 0) throw new StateError("No elements");
27990 throw new StateError("More than one element");
27991 }
27992
27993 MediaStream min([int compare(MediaStream a, MediaStream b)]) => _Collections.m inInList(this, compare);
27994
27995 MediaStream max([int compare(MediaStream a, MediaStream b)]) => _Collections.m axInList(this, compare);
26537 27996
26538 MediaStream removeAt(int pos) { 27997 MediaStream removeAt(int pos) {
26539 throw new UnsupportedError("Cannot removeAt on immutable List."); 27998 throw new UnsupportedError("Cannot removeAt on immutable List.");
26540 } 27999 }
26541 28000
26542 MediaStream removeLast() { 28001 MediaStream removeLast() {
26543 throw new UnsupportedError("Cannot removeLast on immutable List."); 28002 throw new UnsupportedError("Cannot removeLast on immutable List.");
26544 } 28003 }
26545 28004
26546 void setRange(int start, int rangeLength, List<MediaStream> from, [int startFr om]) { 28005 void setRange(int start, int rangeLength, List<MediaStream> from, [int startFr om]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
26583 SpeechInputResult operator[](int index) native "SpeechInputResultList_item_Cal lback"; 28042 SpeechInputResult operator[](int index) native "SpeechInputResultList_item_Cal lback";
26584 28043
26585 void operator[]=(int index, SpeechInputResult value) { 28044 void operator[]=(int index, SpeechInputResult value) {
26586 throw new UnsupportedError("Cannot assign element of immutable List."); 28045 throw new UnsupportedError("Cannot assign element of immutable List.");
26587 } 28046 }
26588 // -- start List<SpeechInputResult> mixins. 28047 // -- start List<SpeechInputResult> mixins.
26589 // SpeechInputResult is the element type. 28048 // SpeechInputResult is the element type.
26590 28049
26591 // From Iterable<SpeechInputResult>: 28050 // From Iterable<SpeechInputResult>:
26592 28051
26593 Iterator<SpeechInputResult> iterator() { 28052 Iterator<SpeechInputResult> get iterator {
26594 // Note: NodeLists are not fixed size. And most probably length shouldn't 28053 // Note: NodeLists are not fixed size. And most probably length shouldn't
26595 // be cached in both iterator _and_ forEach method. For now caching it 28054 // be cached in both iterator _and_ forEach method. For now caching it
26596 // for consistency. 28055 // for consistency.
26597 return new FixedSizeListIterator<SpeechInputResult>(this); 28056 return new FixedSizeListIterator<SpeechInputResult>(this);
26598 } 28057 }
26599 28058
26600 // From Collection<SpeechInputResult>:
26601
26602 void add(SpeechInputResult value) {
26603 throw new UnsupportedError("Cannot add to immutable List.");
26604 }
26605
26606 void addLast(SpeechInputResult value) {
26607 throw new UnsupportedError("Cannot add to immutable List.");
26608 }
26609
26610 void addAll(Collection<SpeechInputResult> collection) {
26611 throw new UnsupportedError("Cannot add to immutable List.");
26612 }
26613
26614 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechInputResul t)) { 28059 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechInputResul t)) {
26615 return Collections.reduce(this, initialValue, combine); 28060 return Collections.reduce(this, initialValue, combine);
26616 } 28061 }
26617 28062
26618 bool contains(SpeechInputResult element) => Collections.contains(this, element ); 28063 bool contains(SpeechInputResult element) => Collections.contains(this, element );
26619 28064
26620 void forEach(void f(SpeechInputResult element)) => Collections.forEach(this, f ); 28065 void forEach(void f(SpeechInputResult element)) => Collections.forEach(this, f );
26621 28066
26622 Collection map(f(SpeechInputResult element)) => Collections.map(this, [], f); 28067 String join([String separator]) => Collections.joinList(this, separator);
26623 28068
26624 Collection<SpeechInputResult> filter(bool f(SpeechInputResult element)) => 28069 List mappedBy(f(SpeechInputResult element)) => new MappedList<SpeechInputResul t, dynamic>(this, f);
26625 Collections.filter(this, <SpeechInputResult>[], f); 28070
28071 Iterable<SpeechInputResult> where(bool f(SpeechInputResult element)) => new Wh ereIterable<SpeechInputResult>(this, f);
26626 28072
26627 bool every(bool f(SpeechInputResult element)) => Collections.every(this, f); 28073 bool every(bool f(SpeechInputResult element)) => Collections.every(this, f);
26628 28074
26629 bool some(bool f(SpeechInputResult element)) => Collections.some(this, f); 28075 bool any(bool f(SpeechInputResult element)) => Collections.any(this, f);
26630 28076
26631 bool get isEmpty => this.length == 0; 28077 bool get isEmpty => this.length == 0;
26632 28078
28079 List<SpeechInputResult> take(int n) => new ListView<SpeechInputResult>(this, 0 , n);
28080
28081 Iterable<SpeechInputResult> takeWhile(bool test(SpeechInputResult value)) {
28082 return new TakeWhileIterable<SpeechInputResult>(this, test);
28083 }
28084
28085 List<SpeechInputResult> skip(int n) => new ListView<SpeechInputResult>(this, n , null);
28086
28087 Iterable<SpeechInputResult> skipWhile(bool test(SpeechInputResult value)) {
28088 return new SkipWhileIterable<SpeechInputResult>(this, test);
28089 }
28090
28091 SpeechInputResult firstMatching(bool test(SpeechInputResult value), { SpeechIn putResult orElse() }) {
28092 return Collections.firstMatching(this, test, orElse);
28093 }
28094
28095 SpeechInputResult lastMatching(bool test(SpeechInputResult value), {SpeechInpu tResult orElse()}) {
28096 return Collections.lastMatchingInList(this, test, orElse);
28097 }
28098
28099 SpeechInputResult singleMatching(bool test(SpeechInputResult value)) {
28100 return Collections.singleMatching(this, test);
28101 }
28102
28103 SpeechInputResult elementAt(int index) {
28104 return this[index];
28105 }
28106
28107 // From Collection<SpeechInputResult>:
28108
28109 void add(SpeechInputResult value) {
28110 throw new UnsupportedError("Cannot add to immutable List.");
28111 }
28112
28113 void addLast(SpeechInputResult value) {
28114 throw new UnsupportedError("Cannot add to immutable List.");
28115 }
28116
28117 void addAll(Iterable<SpeechInputResult> iterable) {
28118 throw new UnsupportedError("Cannot add to immutable List.");
28119 }
28120
26633 // From List<SpeechInputResult>: 28121 // From List<SpeechInputResult>:
26634 void set length(int value) { 28122 void set length(int value) {
26635 throw new UnsupportedError("Cannot resize immutable List."); 28123 throw new UnsupportedError("Cannot resize immutable List.");
26636 } 28124 }
26637 28125
26638 void clear() { 28126 void clear() {
26639 throw new UnsupportedError("Cannot clear immutable List."); 28127 throw new UnsupportedError("Cannot clear immutable List.");
26640 } 28128 }
26641 28129
26642 void sort([int compare(SpeechInputResult a, SpeechInputResult b)]) { 28130 void sort([int compare(SpeechInputResult a, SpeechInputResult b)]) {
26643 throw new UnsupportedError("Cannot sort immutable List."); 28131 throw new UnsupportedError("Cannot sort immutable List.");
26644 } 28132 }
26645 28133
26646 int indexOf(SpeechInputResult element, [int start = 0]) => 28134 int indexOf(SpeechInputResult element, [int start = 0]) =>
26647 Lists.indexOf(this, element, start, this.length); 28135 Lists.indexOf(this, element, start, this.length);
26648 28136
26649 int lastIndexOf(SpeechInputResult element, [int start]) { 28137 int lastIndexOf(SpeechInputResult element, [int start]) {
26650 if (start == null) start = length - 1; 28138 if (start == null) start = length - 1;
26651 return Lists.lastIndexOf(this, element, start); 28139 return Lists.lastIndexOf(this, element, start);
26652 } 28140 }
26653 28141
26654 SpeechInputResult get first => this[0]; 28142 SpeechInputResult get first {
28143 if (this.length > 0) return this[0];
28144 throw new StateError("No elements");
28145 }
26655 28146
26656 SpeechInputResult get last => this[length - 1]; 28147 SpeechInputResult get last {
28148 if (this.length > 0) return this[this.length - 1];
28149 throw new StateError("No elements");
28150 }
28151
28152 SpeechInputResult get single {
28153 if (length == 1) return this[0];
28154 if (length == 0) throw new StateError("No elements");
28155 throw new StateError("More than one element");
28156 }
28157
28158 SpeechInputResult min([int compare(SpeechInputResult a, SpeechInputResult b)]) => _Collections.minInList(this, compare);
28159
28160 SpeechInputResult max([int compare(SpeechInputResult a, SpeechInputResult b)]) => _Collections.maxInList(this, compare);
26657 28161
26658 SpeechInputResult removeAt(int pos) { 28162 SpeechInputResult removeAt(int pos) {
26659 throw new UnsupportedError("Cannot removeAt on immutable List."); 28163 throw new UnsupportedError("Cannot removeAt on immutable List.");
26660 } 28164 }
26661 28165
26662 SpeechInputResult removeLast() { 28166 SpeechInputResult removeLast() {
26663 throw new UnsupportedError("Cannot removeLast on immutable List."); 28167 throw new UnsupportedError("Cannot removeLast on immutable List.");
26664 } 28168 }
26665 28169
26666 void setRange(int start, int rangeLength, List<SpeechInputResult> from, [int s tartFrom]) { 28170 void setRange(int start, int rangeLength, List<SpeechInputResult> from, [int s tartFrom]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
26703 SpeechRecognitionResult operator[](int index) native "SpeechRecognitionResultL ist_item_Callback"; 28207 SpeechRecognitionResult operator[](int index) native "SpeechRecognitionResultL ist_item_Callback";
26704 28208
26705 void operator[]=(int index, SpeechRecognitionResult value) { 28209 void operator[]=(int index, SpeechRecognitionResult value) {
26706 throw new UnsupportedError("Cannot assign element of immutable List."); 28210 throw new UnsupportedError("Cannot assign element of immutable List.");
26707 } 28211 }
26708 // -- start List<SpeechRecognitionResult> mixins. 28212 // -- start List<SpeechRecognitionResult> mixins.
26709 // SpeechRecognitionResult is the element type. 28213 // SpeechRecognitionResult is the element type.
26710 28214
26711 // From Iterable<SpeechRecognitionResult>: 28215 // From Iterable<SpeechRecognitionResult>:
26712 28216
26713 Iterator<SpeechRecognitionResult> iterator() { 28217 Iterator<SpeechRecognitionResult> get iterator {
26714 // Note: NodeLists are not fixed size. And most probably length shouldn't 28218 // Note: NodeLists are not fixed size. And most probably length shouldn't
26715 // be cached in both iterator _and_ forEach method. For now caching it 28219 // be cached in both iterator _and_ forEach method. For now caching it
26716 // for consistency. 28220 // for consistency.
26717 return new FixedSizeListIterator<SpeechRecognitionResult>(this); 28221 return new FixedSizeListIterator<SpeechRecognitionResult>(this);
26718 } 28222 }
26719 28223
26720 // From Collection<SpeechRecognitionResult>:
26721
26722 void add(SpeechRecognitionResult value) {
26723 throw new UnsupportedError("Cannot add to immutable List.");
26724 }
26725
26726 void addLast(SpeechRecognitionResult value) {
26727 throw new UnsupportedError("Cannot add to immutable List.");
26728 }
26729
26730 void addAll(Collection<SpeechRecognitionResult> collection) {
26731 throw new UnsupportedError("Cannot add to immutable List.");
26732 }
26733
26734 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechRecognitio nResult)) { 28224 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, SpeechRecognitio nResult)) {
26735 return Collections.reduce(this, initialValue, combine); 28225 return Collections.reduce(this, initialValue, combine);
26736 } 28226 }
26737 28227
26738 bool contains(SpeechRecognitionResult element) => Collections.contains(this, e lement); 28228 bool contains(SpeechRecognitionResult element) => Collections.contains(this, e lement);
26739 28229
26740 void forEach(void f(SpeechRecognitionResult element)) => Collections.forEach(t his, f); 28230 void forEach(void f(SpeechRecognitionResult element)) => Collections.forEach(t his, f);
26741 28231
26742 Collection map(f(SpeechRecognitionResult element)) => Collections.map(this, [] , f); 28232 String join([String separator]) => Collections.joinList(this, separator);
26743 28233
26744 Collection<SpeechRecognitionResult> filter(bool f(SpeechRecognitionResult elem ent)) => 28234 List mappedBy(f(SpeechRecognitionResult element)) => new MappedList<SpeechReco gnitionResult, dynamic>(this, f);
26745 Collections.filter(this, <SpeechRecognitionResult>[], f); 28235
28236 Iterable<SpeechRecognitionResult> where(bool f(SpeechRecognitionResult element )) => new WhereIterable<SpeechRecognitionResult>(this, f);
26746 28237
26747 bool every(bool f(SpeechRecognitionResult element)) => Collections.every(this, f); 28238 bool every(bool f(SpeechRecognitionResult element)) => Collections.every(this, f);
26748 28239
26749 bool some(bool f(SpeechRecognitionResult element)) => Collections.some(this, f ); 28240 bool any(bool f(SpeechRecognitionResult element)) => Collections.any(this, f);
26750 28241
26751 bool get isEmpty => this.length == 0; 28242 bool get isEmpty => this.length == 0;
26752 28243
28244 List<SpeechRecognitionResult> take(int n) => new ListView<SpeechRecognitionRes ult>(this, 0, n);
28245
28246 Iterable<SpeechRecognitionResult> takeWhile(bool test(SpeechRecognitionResult value)) {
28247 return new TakeWhileIterable<SpeechRecognitionResult>(this, test);
28248 }
28249
28250 List<SpeechRecognitionResult> skip(int n) => new ListView<SpeechRecognitionRes ult>(this, n, null);
28251
28252 Iterable<SpeechRecognitionResult> skipWhile(bool test(SpeechRecognitionResult value)) {
28253 return new SkipWhileIterable<SpeechRecognitionResult>(this, test);
28254 }
28255
28256 SpeechRecognitionResult firstMatching(bool test(SpeechRecognitionResult value) , { SpeechRecognitionResult orElse() }) {
28257 return Collections.firstMatching(this, test, orElse);
28258 }
28259
28260 SpeechRecognitionResult lastMatching(bool test(SpeechRecognitionResult value), {SpeechRecognitionResult orElse()}) {
28261 return Collections.lastMatchingInList(this, test, orElse);
28262 }
28263
28264 SpeechRecognitionResult singleMatching(bool test(SpeechRecognitionResult value )) {
28265 return Collections.singleMatching(this, test);
28266 }
28267
28268 SpeechRecognitionResult elementAt(int index) {
28269 return this[index];
28270 }
28271
28272 // From Collection<SpeechRecognitionResult>:
28273
28274 void add(SpeechRecognitionResult value) {
28275 throw new UnsupportedError("Cannot add to immutable List.");
28276 }
28277
28278 void addLast(SpeechRecognitionResult value) {
28279 throw new UnsupportedError("Cannot add to immutable List.");
28280 }
28281
28282 void addAll(Iterable<SpeechRecognitionResult> iterable) {
28283 throw new UnsupportedError("Cannot add to immutable List.");
28284 }
28285
26753 // From List<SpeechRecognitionResult>: 28286 // From List<SpeechRecognitionResult>:
26754 void set length(int value) { 28287 void set length(int value) {
26755 throw new UnsupportedError("Cannot resize immutable List."); 28288 throw new UnsupportedError("Cannot resize immutable List.");
26756 } 28289 }
26757 28290
26758 void clear() { 28291 void clear() {
26759 throw new UnsupportedError("Cannot clear immutable List."); 28292 throw new UnsupportedError("Cannot clear immutable List.");
26760 } 28293 }
26761 28294
26762 void sort([int compare(SpeechRecognitionResult a, SpeechRecognitionResult b)]) { 28295 void sort([int compare(SpeechRecognitionResult a, SpeechRecognitionResult b)]) {
26763 throw new UnsupportedError("Cannot sort immutable List."); 28296 throw new UnsupportedError("Cannot sort immutable List.");
26764 } 28297 }
26765 28298
26766 int indexOf(SpeechRecognitionResult element, [int start = 0]) => 28299 int indexOf(SpeechRecognitionResult element, [int start = 0]) =>
26767 Lists.indexOf(this, element, start, this.length); 28300 Lists.indexOf(this, element, start, this.length);
26768 28301
26769 int lastIndexOf(SpeechRecognitionResult element, [int start]) { 28302 int lastIndexOf(SpeechRecognitionResult element, [int start]) {
26770 if (start == null) start = length - 1; 28303 if (start == null) start = length - 1;
26771 return Lists.lastIndexOf(this, element, start); 28304 return Lists.lastIndexOf(this, element, start);
26772 } 28305 }
26773 28306
26774 SpeechRecognitionResult get first => this[0]; 28307 SpeechRecognitionResult get first {
28308 if (this.length > 0) return this[0];
28309 throw new StateError("No elements");
28310 }
26775 28311
26776 SpeechRecognitionResult get last => this[length - 1]; 28312 SpeechRecognitionResult get last {
28313 if (this.length > 0) return this[this.length - 1];
28314 throw new StateError("No elements");
28315 }
28316
28317 SpeechRecognitionResult get single {
28318 if (length == 1) return this[0];
28319 if (length == 0) throw new StateError("No elements");
28320 throw new StateError("More than one element");
28321 }
28322
28323 SpeechRecognitionResult min([int compare(SpeechRecognitionResult a, SpeechReco gnitionResult b)]) => _Collections.minInList(this, compare);
28324
28325 SpeechRecognitionResult max([int compare(SpeechRecognitionResult a, SpeechReco gnitionResult b)]) => _Collections.maxInList(this, compare);
26777 28326
26778 SpeechRecognitionResult removeAt(int pos) { 28327 SpeechRecognitionResult removeAt(int pos) {
26779 throw new UnsupportedError("Cannot removeAt on immutable List."); 28328 throw new UnsupportedError("Cannot removeAt on immutable List.");
26780 } 28329 }
26781 28330
26782 SpeechRecognitionResult removeLast() { 28331 SpeechRecognitionResult removeLast() {
26783 throw new UnsupportedError("Cannot removeLast on immutable List."); 28332 throw new UnsupportedError("Cannot removeLast on immutable List.");
26784 } 28333 }
26785 28334
26786 void setRange(int start, int rangeLength, List<SpeechRecognitionResult> from, [int startFrom]) { 28335 void setRange(int start, int rangeLength, List<SpeechRecognitionResult> from, [int startFrom]) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
26823 StyleSheet operator[](int index) native "StyleSheetList_item_Callback"; 28372 StyleSheet operator[](int index) native "StyleSheetList_item_Callback";
26824 28373
26825 void operator[]=(int index, StyleSheet value) { 28374 void operator[]=(int index, StyleSheet value) {
26826 throw new UnsupportedError("Cannot assign element of immutable List."); 28375 throw new UnsupportedError("Cannot assign element of immutable List.");
26827 } 28376 }
26828 // -- start List<StyleSheet> mixins. 28377 // -- start List<StyleSheet> mixins.
26829 // StyleSheet is the element type. 28378 // StyleSheet is the element type.
26830 28379
26831 // From Iterable<StyleSheet>: 28380 // From Iterable<StyleSheet>:
26832 28381
26833 Iterator<StyleSheet> iterator() { 28382 Iterator<StyleSheet> get iterator {
26834 // Note: NodeLists are not fixed size. And most probably length shouldn't 28383 // Note: NodeLists are not fixed size. And most probably length shouldn't
26835 // be cached in both iterator _and_ forEach method. For now caching it 28384 // be cached in both iterator _and_ forEach method. For now caching it
26836 // for consistency. 28385 // for consistency.
26837 return new FixedSizeListIterator<StyleSheet>(this); 28386 return new FixedSizeListIterator<StyleSheet>(this);
26838 } 28387 }
26839 28388
26840 // From Collection<StyleSheet>:
26841
26842 void add(StyleSheet value) {
26843 throw new UnsupportedError("Cannot add to immutable List.");
26844 }
26845
26846 void addLast(StyleSheet value) {
26847 throw new UnsupportedError("Cannot add to immutable List.");
26848 }
26849
26850 void addAll(Collection<StyleSheet> collection) {
26851 throw new UnsupportedError("Cannot add to immutable List.");
26852 }
26853
26854 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, StyleSheet)) { 28389 dynamic reduce(dynamic initialValue, dynamic combine(dynamic, StyleSheet)) {
26855 return Collections.reduce(this, initialValue, combine); 28390 return Collections.reduce(this, initialValue, combine);
26856 } 28391 }
26857 28392
26858 bool contains(StyleSheet element) => Collections.contains(this, element); 28393 bool contains(StyleSheet element) => Collections.contains(this, element);
26859 28394
26860 void forEach(void f(StyleSheet element)) => Collections.forEach(this, f); 28395 void forEach(void f(StyleSheet element)) => Collections.forEach(this, f);
26861 28396
26862 Collection map(f(StyleSheet element)) => Collections.map(this, [], f); 28397 String join([String separator]) => Collections.joinList(this, separator);
26863 28398
26864 Collection<StyleSheet> filter(bool f(StyleSheet element)) => 28399 List mappedBy(f(StyleSheet element)) => new MappedList<StyleSheet, dynamic>(th is, f);
26865 Collections.filter(this, <StyleSheet>[], f); 28400
28401 Iterable<StyleSheet> where(bool f(StyleSheet element)) => new WhereIterable<St yleSheet>(this, f);
26866 28402
26867 bool every(bool f(StyleSheet element)) => Collections.every(this, f); 28403 bool every(bool f(StyleSheet element)) => Collections.every(this, f);
26868 28404
26869 bool some(bool f(StyleSheet element)) => Collections.some(this, f); 28405 bool any(bool f(StyleSheet element)) => Collections.any(this, f);
26870 28406
26871 bool get isEmpty => this.length == 0; 28407 bool get isEmpty => this.length == 0;
26872 28408
28409 List<StyleSheet> take(int n) => new ListView<StyleSheet>(this, 0, n);
28410
28411 Iterable<StyleSheet> takeWhile(bool test(StyleSheet value)) {
28412 return new TakeWhileIterable<StyleSheet>(this, test);
28413 }
28414
28415 List<StyleSheet> skip(int n) => new ListView<StyleSheet>(this, n, null);
28416
28417 Iterable<StyleSheet> skipWhile(bool test(StyleSheet value)) {
28418 return new SkipWhileIterable<StyleSheet>(this, test);
28419 }
28420
28421 StyleSheet firstMatching(bool test(StyleSheet value), { StyleSheet orElse() }) {
28422 return Collections.firstMatching(this, test, orElse);
28423 }
28424
28425 StyleSheet lastMatching(bool test(StyleSheet value), {StyleSheet orElse()}) {
28426 return Collections.lastMatchingInList(this, test, orElse);
28427 }
28428
28429 StyleSheet singleMatching(bool test(StyleSheet value)) {
28430 return Collections.singleMatching(this, test);
28431 }
28432
28433 StyleSheet elementAt(int index) {
28434 return this[index];
28435 }
28436
28437 // From Collection<StyleSheet>:
28438
28439 void add(StyleSheet value) {
28440 throw new UnsupportedError("Cannot add to immutable List.");
28441 }
28442
28443 void addLast(StyleSheet value) {
28444 throw new UnsupportedError("Cannot add to immutable List.");
28445 }
28446
28447 void addAll(Iterable<StyleSheet> iterable) {
28448 throw new UnsupportedError("Cannot add to immutable List.");
28449 }
28450
26873 // From List<StyleSheet>: 28451 // From List<StyleSheet>:
26874 void set length(int value) { 28452 void set length(int value) {
26875 throw new UnsupportedError("Cannot resize immutable List."); 28453 throw new UnsupportedError("Cannot resize immutable List.");
26876 } 28454 }
26877 28455
26878 void clear() { 28456 void clear() {
26879 throw new UnsupportedError("Cannot clear immutable List."); 28457 throw new UnsupportedError("Cannot clear immutable List.");
26880 } 28458 }
26881 28459
26882 void sort([int compare(StyleSheet a, StyleSheet b)]) { 28460 void sort([int compare(StyleSheet a, StyleSheet b)]) {
26883 throw new UnsupportedError("Cannot sort immutable List."); 28461 throw new UnsupportedError("Cannot sort immutable List.");
26884 } 28462 }
26885 28463
26886 int indexOf(StyleSheet element, [int start = 0]) => 28464 int indexOf(StyleSheet element, [int start = 0]) =>
26887 Lists.indexOf(this, element, start, this.length); 28465 Lists.indexOf(this, element, start, this.length);
26888 28466
26889 int lastIndexOf(StyleSheet element, [int start]) { 28467 int lastIndexOf(StyleSheet element, [int start]) {
26890 if (start == null) start = length - 1; 28468 if (start == null) start = length - 1;
26891 return Lists.lastIndexOf(this, element, start); 28469 return Lists.lastIndexOf(this, element, start);
26892 } 28470 }
26893 28471
26894 StyleSheet get first => this[0]; 28472 StyleSheet get first {
28473 if (this.length > 0) return this[0];
28474 throw new StateError("No elements");
28475 }
26895 28476
26896 StyleSheet get last => this[length - 1]; 28477 StyleSheet get last {
28478 if (this.length > 0) return this[this.length - 1];
28479 throw new StateError("No elements");
28480 }
28481
28482 StyleSheet get single {
28483 if (length == 1) return this[0];
28484 if (length == 0) throw new StateError("No elements");
28485 throw new StateError("More than one element");
28486 }
28487
28488 StyleSheet min([int compare(StyleSheet a, StyleSheet b)]) => _Collections.minI nList(this, compare);
28489
28490 StyleSheet max([int compare(StyleSheet a, StyleSheet b)]) => _Collections.maxI nList(this, compare);
26897 28491
26898 StyleSheet removeAt(int pos) { 28492 StyleSheet removeAt(int pos) {
26899 throw new UnsupportedError("Cannot removeAt on immutable List."); 28493 throw new UnsupportedError("Cannot removeAt on immutable List.");
26900 } 28494 }
26901 28495
26902 StyleSheet removeLast() { 28496 StyleSheet removeLast() {
26903 throw new UnsupportedError("Cannot removeLast on immutable List."); 28497 throw new UnsupportedError("Cannot removeLast on immutable List.");
26904 } 28498 }
26905 28499
26906 void setRange(int start, int rangeLength, List<StyleSheet> from, [int startFro m]) { 28500 void setRange(int start, int rangeLength, List<StyleSheet> from, [int startFro m]) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
27080 */ 28674 */
27081 class _DataAttributeMap implements Map<String, String> { 28675 class _DataAttributeMap implements Map<String, String> {
27082 28676
27083 final Map<String, String> $dom_attributes; 28677 final Map<String, String> $dom_attributes;
27084 28678
27085 _DataAttributeMap(this.$dom_attributes); 28679 _DataAttributeMap(this.$dom_attributes);
27086 28680
27087 // interface Map 28681 // interface Map
27088 28682
27089 // TODO: Use lazy iterator when it is available on Map. 28683 // TODO: Use lazy iterator when it is available on Map.
27090 bool containsValue(String value) => values.some((v) => v == value); 28684 bool containsValue(String value) => values.any((v) => v == value);
27091 28685
27092 bool containsKey(String key) => $dom_attributes.containsKey(_attr(key)); 28686 bool containsKey(String key) => $dom_attributes.containsKey(_attr(key));
27093 28687
27094 String operator [](String key) => $dom_attributes[_attr(key)]; 28688 String operator [](String key) => $dom_attributes[_attr(key)];
27095 28689
27096 void operator []=(String key, value) { 28690 void operator []=(String key, value) {
27097 $dom_attributes[_attr(key)] = '$value'; 28691 $dom_attributes[_attr(key)] = '$value';
27098 } 28692 }
27099 28693
27100 String putIfAbsent(String key, String ifAbsent()) => 28694 String putIfAbsent(String key, String ifAbsent()) =>
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
27303 return result; 28897 return result;
27304 } 28898 }
27305 28899
27306 /** 28900 /**
27307 * Returns [:true:] if classes cannot be added or removed from this 28901 * Returns [:true:] if classes cannot be added or removed from this
27308 * [:CssClassSet:]. 28902 * [:CssClassSet:].
27309 */ 28903 */
27310 bool get frozen => false; 28904 bool get frozen => false;
27311 28905
27312 // interface Iterable - BEGIN 28906 // interface Iterable - BEGIN
27313 Iterator<String> iterator() => readClasses().iterator(); 28907 Iterator<String> get iterator => readClasses().iterator;
27314 // interface Iterable - END 28908 // interface Iterable - END
27315 28909
27316 // interface Collection - BEGIN 28910 // interface Collection - BEGIN
27317 void forEach(void f(String element)) { 28911 void forEach(void f(String element)) {
27318 readClasses().forEach(f); 28912 readClasses().forEach(f);
27319 } 28913 }
27320 28914
27321 Collection map(f(String element)) => readClasses().map(f); 28915 String join([String separator]) => readClasses().join(separator);
27322 28916
27323 Collection<String> filter(bool f(String element)) => readClasses().filter(f); 28917 Iterable mappedBy(f(String element)) => readClasses().mappedBy(f);
28918
28919 Iterable<String> where(bool f(String element)) => readClasses().where(f);
27324 28920
27325 bool every(bool f(String element)) => readClasses().every(f); 28921 bool every(bool f(String element)) => readClasses().every(f);
27326 28922
27327 bool some(bool f(String element)) => readClasses().some(f); 28923 bool any(bool f(String element)) => readClasses().any(f);
27328 28924
27329 bool get isEmpty => readClasses().isEmpty; 28925 bool get isEmpty => readClasses().isEmpty;
27330 28926
27331 int get length =>readClasses().length; 28927 int get length =>readClasses().length;
27332 28928
27333 dynamic reduce(dynamic initialValue, 28929 dynamic reduce(dynamic initialValue,
27334 dynamic combine(dynamic previousValue, String element)) { 28930 dynamic combine(dynamic previousValue, String element)) {
27335 return readClasses().reduce(initialValue, combine); 28931 return readClasses().reduce(initialValue, combine);
27336 } 28932 }
27337 // interface Collection - END 28933 // interface Collection - END
27338 28934
27339 // interface Set - BEGIN 28935 // interface Set - BEGIN
27340 bool contains(String value) => readClasses().contains(value); 28936 bool contains(String value) => readClasses().contains(value);
27341 28937
27342 void add(String value) { 28938 void add(String value) {
27343 // TODO - figure out if we need to do any validation here 28939 // TODO - figure out if we need to do any validation here
27344 // or if the browser natively does enough 28940 // or if the browser natively does enough
27345 _modify((s) => s.add(value)); 28941 _modify((s) => s.add(value));
27346 } 28942 }
27347 28943
27348 bool remove(String value) { 28944 bool remove(String value) {
27349 Set<String> s = readClasses(); 28945 Set<String> s = readClasses();
27350 bool result = s.remove(value); 28946 bool result = s.remove(value);
27351 writeClasses(s); 28947 writeClasses(s);
27352 return result; 28948 return result;
27353 } 28949 }
27354 28950
27355 void addAll(Collection<String> collection) { 28951 void addAll(Iterable<String> iterable) {
27356 // TODO - see comment above about validation 28952 // TODO - see comment above about validation
27357 _modify((s) => s.addAll(collection)); 28953 _modify((s) => s.addAll(iterable));
27358 } 28954 }
27359 28955
27360 void removeAll(Collection<String> collection) { 28956 void removeAll(Iterable<String> iterable) {
27361 _modify((s) => s.removeAll(collection)); 28957 _modify((s) => s.removeAll(iterable));
27362 } 28958 }
27363 28959
27364 bool isSubsetOf(Collection<String> collection) => 28960 bool isSubsetOf(Collection<String> collection) =>
27365 readClasses().isSubsetOf(collection); 28961 readClasses().isSubsetOf(collection);
27366 28962
27367 bool containsAll(Collection<String> collection) => 28963 bool containsAll(Collection<String> collection) =>
27368 readClasses().containsAll(collection); 28964 readClasses().containsAll(collection);
27369 28965
27370 Set<String> intersection(Collection<String> other) => 28966 Set<String> intersection(Collection<String> other) =>
27371 readClasses().intersection(other); 28967 readClasses().intersection(other);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
27554 if (_callbacks.length == 0) { 29150 if (_callbacks.length == 0) {
27555 // If we have no listeners, don't bother keeping track of keypresses. 29151 // If we have no listeners, don't bother keeping track of keypresses.
27556 _target.on.keyDown.remove(_keyDown); 29152 _target.on.keyDown.remove(_keyDown);
27557 _target.on.keyPress.remove(_keyPress); 29153 _target.on.keyPress.remove(_keyPress);
27558 _target.on.keyUp.remove(_keyUp); 29154 _target.on.keyUp.remove(_keyUp);
27559 } 29155 }
27560 } 29156 }
27561 29157
27562 /** Determine if caps lock is one of the currently depressed keys. */ 29158 /** Determine if caps lock is one of the currently depressed keys. */
27563 bool get _capsLockOn => 29159 bool get _capsLockOn =>
27564 _keyDownList.some((var element) => element.keyCode == KeyCode.CAPS_LOCK); 29160 _keyDownList.any((var element) => element.keyCode == KeyCode.CAPS_LOCK);
27565 29161
27566 /** 29162 /**
27567 * Given the previously recorded keydown key codes, see if we can determine 29163 * Given the previously recorded keydown key codes, see if we can determine
27568 * the keycode of this keypress [event]. (Generally browsers only provide 29164 * the keycode of this keypress [event]. (Generally browsers only provide
27569 * charCode information for keypress events, but with a little 29165 * charCode information for keypress events, but with a little
27570 * reverse-engineering, we can also determine the keyCode.) Returns 29166 * reverse-engineering, we can also determine the keyCode.) Returns
27571 * KeyCode.UNKNOWN if the keycode could not be determined. 29167 * KeyCode.UNKNOWN if the keycode could not be determined.
27572 */ 29168 */
27573 int _determineKeyCodeForKeypress(KeyboardEvent event) { 29169 int _determineKeyCodeForKeypress(KeyboardEvent event) {
27574 // Note: This function is a work in progress. We'll expand this function 29170 // 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
27783 // pressed, given previous keydown information. 29379 // pressed, given previous keydown information.
27784 e._shadowKeyCode = _determineKeyCodeForKeypress(e); 29380 e._shadowKeyCode = _determineKeyCodeForKeypress(e);
27785 29381
27786 // Correct the key value for certain browser-specific quirks. 29382 // Correct the key value for certain browser-specific quirks.
27787 if (e._shadowKeyIdentifier != null && 29383 if (e._shadowKeyIdentifier != null &&
27788 _keyIdentifier.containsKey(e._shadowKeyIdentifier)) { 29384 _keyIdentifier.containsKey(e._shadowKeyIdentifier)) {
27789 // This is needed for Safari Windows because it currently doesn't give a 29385 // This is needed for Safari Windows because it currently doesn't give a
27790 // keyCode/which for non printable keys. 29386 // keyCode/which for non printable keys.
27791 e._shadowKeyCode = _keyIdentifier[e._shadowKeyIdentifier]; 29387 e._shadowKeyCode = _keyIdentifier[e._shadowKeyIdentifier];
27792 } 29388 }
27793 e._shadowAltKey = _keyDownList.some((var element) => element.altKey); 29389 e._shadowAltKey = _keyDownList.any((var element) => element.altKey);
27794 _dispatch(e); 29390 _dispatch(e);
27795 } 29391 }
27796 29392
27797 /** Handle keyup events. */ 29393 /** Handle keyup events. */
27798 void processKeyUp(KeyboardEvent event) { 29394 void processKeyUp(KeyboardEvent event) {
27799 var e = new KeyEvent(event); 29395 var e = new KeyEvent(event);
27800 KeyboardEvent toRemove = null; 29396 KeyboardEvent toRemove = null;
27801 for (var key in _keyDownList) { 29397 for (var key in _keyDownList) {
27802 if (key.keyCode == e.keyCode) { 29398 if (key.keyCode == e.keyCode) {
27803 toRemove = key; 29399 toRemove = key;
27804 } 29400 }
27805 } 29401 }
27806 if (toRemove != null) { 29402 if (toRemove != null) {
27807 _keyDownList = _keyDownList.filter((element) => element != toRemove); 29403 _keyDownList =
29404 _keyDownList.where((element) => element != toRemove).toList();
27808 } else if (_keyDownList.length > 0) { 29405 } else if (_keyDownList.length > 0) {
27809 // This happens when we've reached some international keyboard case we 29406 // This happens when we've reached some international keyboard case we
27810 // haven't accounted for or we haven't correctly eliminated all browser 29407 // haven't accounted for or we haven't correctly eliminated all browser
27811 // inconsistencies. Filing bugs on when this is reached is welcome! 29408 // inconsistencies. Filing bugs on when this is reached is welcome!
27812 _keyDownList.removeLast(); 29409 _keyDownList.removeLast();
27813 } 29410 }
27814 _dispatch(e); 29411 _dispatch(e);
27815 } 29412 }
27816 } 29413 }
27817 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 29414 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
29069 return _deserialize(result); 30666 return _deserialize(result);
29070 } 30667 }
29071 30668
29072 static _call(int isolateId, int portId, var message) { 30669 static _call(int isolateId, int portId, var message) {
29073 var target = 'dart-port-$isolateId-$portId'; 30670 var target = 'dart-port-$isolateId-$portId';
29074 // TODO(vsm): Make this re-entrant. 30671 // TODO(vsm): Make this re-entrant.
29075 // TODO(vsm): Set this up set once, on the first call. 30672 // TODO(vsm): Set this up set once, on the first call.
29076 var source = '$target-result'; 30673 var source = '$target-result';
29077 var result = null; 30674 var result = null;
29078 var listener = (Event e) { 30675 var listener = (Event e) {
29079 result = JSON.parse(_getPortSyncEventData(e)); 30676 result = json.parse(_getPortSyncEventData(e));
29080 }; 30677 };
29081 window.on[source].add(listener); 30678 window.on[source].add(listener);
29082 _dispatchEvent(target, [source, message]); 30679 _dispatchEvent(target, [source, message]);
29083 window.on[source].remove(listener); 30680 window.on[source].remove(listener);
29084 return result; 30681 return result;
29085 } 30682 }
29086 } 30683 }
29087 30684
29088 // The receiver is in the same Dart isolate, compiled to JS. 30685 // The receiver is in the same Dart isolate, compiled to JS.
29089 class _LocalSendPortSync implements SendPortSync { 30686 class _LocalSendPortSync implements SendPortSync {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
29141 } 30738 }
29142 30739
29143 static String _getListenerName(isolateId, portId) => 30740 static String _getListenerName(isolateId, portId) =>
29144 'dart-port-$isolateId-$portId'; 30741 'dart-port-$isolateId-$portId';
29145 String get _listenerName => _getListenerName(_isolateId, _portId); 30742 String get _listenerName => _getListenerName(_isolateId, _portId);
29146 30743
29147 void receive(callback(var message)) { 30744 void receive(callback(var message)) {
29148 _callback = callback; 30745 _callback = callback;
29149 if (_listener == null) { 30746 if (_listener == null) {
29150 _listener = (Event e) { 30747 _listener = (Event e) {
29151 var data = JSON.parse(_getPortSyncEventData(e)); 30748 var data = json.parse(_getPortSyncEventData(e));
29152 var replyTo = data[0]; 30749 var replyTo = data[0];
29153 var message = _deserialize(data[1]); 30750 var message = _deserialize(data[1]);
29154 var result = _callback(message); 30751 var result = _callback(message);
29155 _dispatchEvent(replyTo, _serialize(result)); 30752 _dispatchEvent(replyTo, _serialize(result));
29156 }; 30753 };
29157 window.on[_listenerName].add(_listener); 30754 window.on[_listenerName].add(_listener);
29158 } 30755 }
29159 } 30756 }
29160 30757
29161 void close() { 30758 void close() {
(...skipping 10 matching lines...) Expand all
29172 return _portMap[portId].toSendPort(); 30769 return _portMap[portId].toSendPort();
29173 } else { 30770 } else {
29174 return new _RemoteSendPortSync(isolateId, portId); 30771 return new _RemoteSendPortSync(isolateId, portId);
29175 } 30772 }
29176 } 30773 }
29177 } 30774 }
29178 30775
29179 get _isolateId => ReceivePortSync._isolateId; 30776 get _isolateId => ReceivePortSync._isolateId;
29180 30777
29181 void _dispatchEvent(String receiver, var message) { 30778 void _dispatchEvent(String receiver, var message) {
29182 var event = new CustomEvent(receiver, false, false, JSON.stringify(message)); 30779 var event = new CustomEvent(receiver, false, false, json.stringify(message));
29183 window.$dom_dispatchEvent(event); 30780 window.$dom_dispatchEvent(event);
29184 } 30781 }
29185 30782
29186 String _getPortSyncEventData(CustomEvent event) => event.detail; 30783 String _getPortSyncEventData(CustomEvent event) => event.detail;
29187 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 30784 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
29188 // for details. All rights reserved. Use of this source code is governed by a 30785 // for details. All rights reserved. Use of this source code is governed by a
29189 // BSD-style license that can be found in the LICENSE file. 30786 // BSD-style license that can be found in the LICENSE file.
29190 30787
29191 30788
29192 typedef Object ComputeValue(); 30789 typedef Object ComputeValue();
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
29467 // TODO(floitsch): we are losing the generic type. 31064 // TODO(floitsch): we are losing the generic type.
29468 return ['list', id, jsArray]; 31065 return ['list', id, jsArray];
29469 } 31066 }
29470 31067
29471 visitMap(Map map) { 31068 visitMap(Map map) {
29472 int copyId = _visited[map]; 31069 int copyId = _visited[map];
29473 if (copyId != null) return ['ref', copyId]; 31070 if (copyId != null) return ['ref', copyId];
29474 31071
29475 int id = _nextFreeRefId++; 31072 int id = _nextFreeRefId++;
29476 _visited[map] = id; 31073 _visited[map] = id;
29477 var keys = _serializeList(map.keys); 31074 var keys = _serializeList(map.keys.toList());
29478 var values = _serializeList(map.values); 31075 var values = _serializeList(map.values.toList());
29479 // TODO(floitsch): we are losing the generic type. 31076 // TODO(floitsch): we are losing the generic type.
29480 return ['map', id, keys, values]; 31077 return ['map', id, keys, values];
29481 } 31078 }
29482 31079
29483 _serializeList(List list) { 31080 _serializeList(List list) {
29484 int len = list.length; 31081 int len = list.length;
29485 var result = new List(len); 31082 var result = new List.fixedLength(len);
29486 for (int i = 0; i < len; i++) { 31083 for (int i = 0; i < len; i++) {
29487 result[i] = _dispatch(list[i]); 31084 result[i] = _dispatch(list[i]);
29488 } 31085 }
29489 return result; 31086 return result;
29490 } 31087 }
29491 } 31088 }
29492 31089
29493 /** Deserializes arrays created with [_Serializer]. */ 31090 /** Deserializes arrays created with [_Serializer]. */
29494 abstract class _Deserializer { 31091 abstract class _Deserializer {
29495 Map<int, dynamic> _deserialized; 31092 Map<int, dynamic> _deserialized;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
29581 target.$dom_removeEventListener(type, listener, useCapture); 31178 target.$dom_removeEventListener(type, listener, useCapture);
29582 } 31179 }
29583 31180
29584 } 31181 }
29585 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 31182 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
29586 // for details. All rights reserved. Use of this source code is governed by a 31183 // for details. All rights reserved. Use of this source code is governed by a
29587 // BSD-style license that can be found in the LICENSE file. 31184 // BSD-style license that can be found in the LICENSE file.
29588 31185
29589 31186
29590 // Iterator for arrays with fixed size. 31187 // Iterator for arrays with fixed size.
29591 class FixedSizeListIterator<T> extends _VariableSizeListIterator<T> { 31188 class FixedSizeListIterator<T> implements Iterator<T> {
31189 final List<T> _array;
31190 final int _length; // Cache array length for faster access.
31191 int _position;
31192 T _current;
31193
29592 FixedSizeListIterator(List<T> array) 31194 FixedSizeListIterator(List<T> array)
29593 : super(array), 31195 : _array = array,
31196 _position = -1,
29594 _length = array.length; 31197 _length = array.length;
29595 31198
29596 bool get hasNext => _length > _pos; 31199 bool moveNext() {
31200 int nextPosition = _position + 1;
31201 if (nextPosition < _length) {
31202 _current = _array[nextPosition];
31203 _position = nextPosition;
31204 return true;
31205 }
31206 _current = null;
31207 _position = _length;
31208 return false;
31209 }
29597 31210
29598 final int _length; // Cache array length for faster access. 31211 T get current => _current;
29599 } 31212 }
29600 31213
29601 // Iterator for arrays with variable size. 31214 // Iterator for arrays with variable size.
29602 class _VariableSizeListIterator<T> implements Iterator<T> { 31215 class _VariableSizeListIterator<T> implements Iterator<T> {
31216 final List<T> _array;
31217 int _position;
31218 T _current;
31219
29603 _VariableSizeListIterator(List<T> array) 31220 _VariableSizeListIterator(List<T> array)
29604 : _array = array, 31221 : _array = array,
29605 _pos = 0; 31222 _position = -1;
29606 31223
29607 bool get hasNext => _array.length > _pos; 31224 bool moveNext() {
29608 31225 int nextPosition = _position + 1;
29609 T next() { 31226 if (nextPosition < _array.length) {
29610 if (!hasNext) { 31227 _current = _array[nextPosition];
29611 throw new StateError("No more elements"); 31228 _position = nextPosition;
31229 return true;
29612 } 31230 }
29613 return _array[_pos++]; 31231 _current = null;
31232 _position = _array.length;
31233 return false;
29614 } 31234 }
29615 31235
29616 final List<T> _array; 31236 T get current => _current;
29617 int _pos;
29618 } 31237 }
29619 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 31238 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
29620 // for details. All rights reserved. Use of this source code is governed by a 31239 // for details. All rights reserved. Use of this source code is governed by a
29621 // BSD-style license that can be found in the LICENSE file. 31240 // BSD-style license that can be found in the LICENSE file.
29622 31241
29623 31242
29624 // This API is exploratory. 31243 // This API is exploratory.
29625 spawnDomFunction(Function topLevelFunction) => _Utils.spawnDomFunctionImpl(topLe velFunction); 31244 spawnDomFunction(Function topLevelFunction) => _Utils.spawnDomFunctionImpl(topLe velFunction);
29626 31245
29627 // testRunner implementation. 31246 // testRunner implementation.
(...skipping 20 matching lines...) Expand all
29648 } 31267 }
29649 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 31268 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
29650 // for details. All rights reserved. Use of this source code is governed by a 31269 // for details. All rights reserved. Use of this source code is governed by a
29651 // BSD-style license that can be found in the LICENSE file. 31270 // BSD-style license that can be found in the LICENSE file.
29652 31271
29653 31272
29654 class _Utils { 31273 class _Utils {
29655 static List convertToList(List list) { 31274 static List convertToList(List list) {
29656 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is fine w/ it. 31275 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is fine w/ it.
29657 final length = list.length; 31276 final length = list.length;
29658 List result = new List(length); 31277 List result = new List.fixedLength(length);
29659 result.setRange(0, length, list); 31278 result.setRange(0, length, list);
29660 return result; 31279 return result;
29661 } 31280 }
29662 31281
29663 static List convertMapToList(Map map) { 31282 static List convertMapToList(Map map) {
29664 List result = []; 31283 List result = [];
29665 map.forEach((k, v) => result.addAll([k, v])); 31284 map.forEach((k, v) => result.addAll([k, v]));
29666 return result; 31285 return result;
29667 } 31286 }
29668 31287
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
29754 bool get isEmpty => Maps.isEmpty(this); 31373 bool get isEmpty => Maps.isEmpty(this);
29755 } 31374 }
29756 31375
29757 get _printClosure => (s) { 31376 get _printClosure => (s) {
29758 try { 31377 try {
29759 window.console.log(s); 31378 window.console.log(s);
29760 } catch (_) { 31379 } catch (_) {
29761 _Utils.print(s); 31380 _Utils.print(s);
29762 } 31381 }
29763 }; 31382 };
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/html/html_common/filtered_element_list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698