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

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

Issue 13934019: Revert "With the collections deriving from ListBase, we no longer need to implement a number of boi… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// The Dart HTML library. 1 /// The Dart HTML library.
2 library dart.dom.html; 2 library dart.dom.html;
3 3
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'dart:_collection-dev'; 6 import 'dart:_collection-dev';
7 import 'dart:html_common'; 7 import 'dart:html_common';
8 import 'dart:indexed_db'; 8 import 'dart:indexed_db';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:json' as json; 10 import 'dart:json' as json;
(...skipping 7774 matching lines...) Expand 10 before | Expand all | Expand 10 after
7785 7785
7786 @DomName('DOMTokenList.toggle') 7786 @DomName('DOMTokenList.toggle')
7787 @DocsEditable 7787 @DocsEditable
7788 bool toggle(String token, [bool force]) native; 7788 bool toggle(String token, [bool force]) native;
7789 } 7789 }
7790 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 7790 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
7791 // for details. All rights reserved. Use of this source code is governed by a 7791 // for details. All rights reserved. Use of this source code is governed by a
7792 // BSD-style license that can be found in the LICENSE file. 7792 // BSD-style license that can be found in the LICENSE file.
7793 7793
7794 7794
7795 // TODO(jacobr): use _Lists.dart to remove some of the duplicated
7796 // functionality.
7795 class _ChildrenElementList extends ListBase<Element> { 7797 class _ChildrenElementList extends ListBase<Element> {
7796 // Raw Element. 7798 // Raw Element.
7797 final Element _element; 7799 final Element _element;
7798 final HtmlCollection _childElements; 7800 final HtmlCollection _childElements;
7799 7801
7800 _ChildrenElementList._wrap(Element element) 7802 _ChildrenElementList._wrap(Element element)
7801 : _childElements = element.$dom_children, 7803 : _childElements = element.$dom_children,
7802 _element = element; 7804 _element = element;
7803 7805
7806 List<Element> toList({ bool growable: true }) {
7807 List<Element> output;
7808 if (growable) {
7809 output = <Element>[];
7810 output.length = _childElements.length;
7811 } else {
7812 output = new List<Element>(_childElements.length);
7813 }
7814 for (int i = 0, len = _childElements.length; i < len; i++) {
7815 output[i] = _childElements[i];
7816 }
7817 return output;
7818 }
7819
7820 Set<Element> toSet() {
7821 final output = new Set<Element>();
7822 for (int i = 0, len = _childElements.length; i < len; i++) {
7823 output.add(_childElements[i]);
7824 }
7825 return output;
7826 }
7827
7804 bool contains(Element element) => _childElements.contains(element); 7828 bool contains(Element element) => _childElements.contains(element);
7805 7829
7830 void forEach(void f(Element element)) {
7831 for (Element element in _childElements) {
7832 f(element);
7833 }
7834 }
7835
7836 bool every(bool f(Element element)) {
7837 for (Element element in this) {
7838 if (!f(element)) {
7839 return false;
7840 }
7841 }
7842 return true;
7843 }
7844
7845 bool any(bool f(Element element)) {
7846 for (Element element in this) {
7847 if (f(element)) {
7848 return true;
7849 }
7850 }
7851 return false;
7852 }
7853
7854 String join([String separator = ""]) {
7855 return _childElements.join(separator);
7856 }
7857
7858 Iterable map(f(Element element)) {
7859 return _childElements.map(f);
7860 }
7861
7862 Iterable<Element> where(bool f(Element element)) {
7863 return _childElements.where(f);
7864 }
7865
7866 Iterable expand(Iterable f(Element element)) {
7867 return _childElements.expand(f);
7868 }
7806 7869
7807 bool get isEmpty { 7870 bool get isEmpty {
7808 return _element.$dom_firstElementChild == null; 7871 return _element.$dom_firstElementChild == null;
7809 } 7872 }
7810 7873
7874 Iterable<Element> take(int n) {
7875 return _childElements.take(n);
7876 }
7877
7878 Iterable<Element> takeWhile(bool test(Element value)) {
7879 return _childElements.takeWhile(test);
7880 }
7881
7882 Iterable<Element> skip(int n) {
7883 return _childElements.skip(n);
7884 }
7885
7886 Iterable<Element> skipWhile(bool test(Element value)) {
7887 return _childElements.skipWhile(test);
7888 }
7889
7890 Element firstWhere(bool test(Element value), {Element orElse()}) {
7891 return _childElements.firstWhere(test, orElse: orElse);
7892 }
7893
7894 Element lastWhere(bool test(Element value), {Element orElse()}) {
7895 return _childElements.lastWhere(test, orElse: orElse);
7896 }
7897
7898 Element singleWhere(bool test(Element value)) {
7899 return _childElements.singleWhere(test);
7900 }
7901
7902 Element elementAt(int index) {
7903 return this[index];
7904 }
7905
7811 int get length { 7906 int get length {
7812 return _childElements.length; 7907 return _childElements.length;
7813 } 7908 }
7814 7909
7815 Element operator [](int index) { 7910 Element operator [](int index) {
7816 return _childElements[index]; 7911 return _childElements[index];
7817 } 7912 }
7818 7913
7819 void operator []=(int index, Element value) { 7914 void operator []=(int index, Element value) {
7820 _element.$dom_replaceChild(value, _childElements[index]); 7915 _element.$dom_replaceChild(value, _childElements[index]);
7821 } 7916 }
7822 7917
7823 void set length(int newLength) { 7918 void set length(int newLength) {
7824 // TODO(jacobr): remove children when length is reduced. 7919 // TODO(jacobr): remove children when length is reduced.
7825 throw new UnsupportedError('Cannot resize element lists'); 7920 throw new UnsupportedError('');
7826 } 7921 }
7827 7922
7828 Element add(Element value) { 7923 Element add(Element value) {
7829 _element.append(value); 7924 _element.append(value);
7830 return value; 7925 return value;
7831 } 7926 }
7832 7927
7833 Iterator<Element> get iterator => toList().iterator; 7928 Iterator<Element> get iterator => toList().iterator;
7834 7929
7835 void addAll(Iterable<Element> iterable) { 7930 void addAll(Iterable<Element> iterable) {
7836 if (iterable is _ChildNodeListLazy) { 7931 if (iterable is _ChildNodeListLazy) {
7837 iterable = new List.from(iterable); 7932 iterable = new List.from(iterable);
7838 } 7933 }
7839 7934
7840 for (Element element in iterable) { 7935 for (Element element in iterable) {
7841 _element.append(element); 7936 _element.append(element);
7842 } 7937 }
7843 } 7938 }
7844 7939
7940 Iterable<Element> get reversed {
7941 return _childElements.reversed;
7942 }
7943
7845 void sort([int compare(Element a, Element b)]) { 7944 void sort([int compare(Element a, Element b)]) {
7846 throw new UnsupportedError('Cannot sort element lists'); 7945 throw new UnsupportedError('TODO(jacobr): should we impl?');
7946 }
7947
7948 Element reduce(Element combine(Element value, Element element)) {
7949 return _childElements.reduce(combine);
7950 }
7951
7952 dynamic fold(dynamic initialValue,
7953 dynamic combine(dynamic previousValue, Element element)) {
7954 return _childElements.fold(initialValue, combine);
7847 } 7955 }
7848 7956
7849 void setRange(int start, int end, Iterable<Element> iterable, 7957 void setRange(int start, int end, Iterable<Element> iterable,
7850 [int skipCount = 0]) { 7958 [int skipCount = 0]) {
7851 throw new UnimplementedError(); 7959 throw new UnimplementedError();
7852 } 7960 }
7853 7961
7854 void replaceRange(int start, int end, Iterable<Element> iterable) { 7962 void replaceRange(int start, int end, Iterable<Element> iterable) {
7855 throw new UnimplementedError(); 7963 throw new UnimplementedError();
7856 } 7964 }
7857 7965
7858 void fillRange(int start, int end, [Element fillValue]) { 7966 void fillRange(int start, int end, [Element fillValue]) {
7859 throw new UnimplementedError(); 7967 throw new UnimplementedError();
7860 } 7968 }
7861 7969
7862 void remove(Object object) { 7970 void remove(Object object) {
7863 if (object is Element) { 7971 if (object is Element) {
7864 Element element = object; 7972 Element element = object;
7865 if (identical(element.parentNode, _element)) { 7973 if (identical(element.parentNode, _element)) {
7866 _element.$dom_removeChild(element); 7974 _element.$dom_removeChild(element);
7867 } 7975 }
7868 } 7976 }
7869 } 7977 }
7870 7978
7979 void removeWhere(bool test(Element element)) {
7980 _childElements.removeWhere(test);
7981 }
7982
7983 void retainWhere(bool test(Element element)) {
7984 _childElements.retainWhere(test);
7985 }
7986
7987 void removeRange(int start, int end) {
7988 throw new UnimplementedError();
7989 }
7990
7991 Iterable getRange(int start, int end) {
7992 throw new UnimplementedError();
7993 }
7994
7995 List sublist(int start, [int end]) {
7996 if (end == null) end = length;
7997 return new _FrozenElementList._wrap(Lists.getRange(this, start, end, []));
7998 }
7999
8000 int indexOf(Element element, [int start = 0]) {
8001 return Lists.indexOf(this, element, start, this.length);
8002 }
8003
8004 int lastIndexOf(Element element, [int start = null]) {
8005 if (start == null) start = length - 1;
8006 return Lists.lastIndexOf(this, element, start);
8007 }
8008
7871 void insert(int index, Element element) { 8009 void insert(int index, Element element) {
7872 if (index < 0 || index > length) { 8010 if (index < 0 || index > length) {
7873 throw new RangeError.range(index, 0, length); 8011 throw new RangeError.range(index, 0, length);
7874 } 8012 }
7875 if (index == length) { 8013 if (index == length) {
7876 _element.append(element); 8014 _element.append(element);
7877 } else { 8015 } else {
7878 _element.insertBefore(element, this[index]); 8016 _element.insertBefore(element, this[index]);
7879 } 8017 }
7880 } 8018 }
7881 8019
8020 void insertAll(int index, Iterable<Element> iterable) {
8021 throw new UnimplementedError();
8022 }
8023
7882 void setAll(int index, Iterable<Element> iterable) { 8024 void setAll(int index, Iterable<Element> iterable) {
7883 throw new UnimplementedError(); 8025 throw new UnimplementedError();
7884 } 8026 }
7885 8027
7886 void clear() { 8028 void clear() {
7887 // It is unclear if we want to keep non element nodes? 8029 // It is unclear if we want to keep non element nodes?
7888 _element.text = ''; 8030 _element.text = '';
7889 } 8031 }
7890 8032
7891 Element removeAt(int index) { 8033 Element removeAt(int index) {
(...skipping 22 matching lines...) Expand all
7914 Element get last { 8056 Element get last {
7915 Element result = _element.$dom_lastElementChild; 8057 Element result = _element.$dom_lastElementChild;
7916 if (result == null) throw new StateError("No elements"); 8058 if (result == null) throw new StateError("No elements");
7917 return result; 8059 return result;
7918 } 8060 }
7919 8061
7920 Element get single { 8062 Element get single {
7921 if (length > 1) throw new StateError("More than one element"); 8063 if (length > 1) throw new StateError("More than one element");
7922 return first; 8064 return first;
7923 } 8065 }
8066
8067 Map<int, Element> asMap() {
8068 return _childElements.asMap();
8069 }
8070
8071 String toString() {
8072 StringBuffer buffer = new StringBuffer('[');
8073 buffer.writeAll(this, ', ');
8074 buffer.write(']');
8075 return buffer.toString();
8076 }
7924 } 8077 }
7925 8078
7926 // TODO(jacobr): this is an inefficient implementation but it is hard to see 8079 // TODO(jacobr): this is an inefficient implementation but it is hard to see
7927 // a better option given that we cannot quite force NodeList to be an 8080 // a better option given that we cannot quite force NodeList to be an
7928 // ElementList as there are valid cases where a NodeList JavaScript object 8081 // ElementList as there are valid cases where a NodeList JavaScript object
7929 // contains Node objects that are not Elements. 8082 // contains Node objects that are not Elements.
7930 class _FrozenElementList extends ListBase<Element> { 8083 class _FrozenElementList extends ListBase {
7931 final List<Node> _nodeList; 8084 final List<Node> _nodeList;
7932 8085
7933 _FrozenElementList._wrap(this._nodeList); 8086 _FrozenElementList._wrap(this._nodeList);
7934 8087
7935 int get length => _nodeList.length; 8088 int get length => _nodeList.length;
7936 8089
7937 Element operator [](int index) => _nodeList[index]; 8090 Element operator [](int index) => _nodeList[index];
7938 8091
7939 void operator []=(int index, Element value) { 8092 void operator []=(int index, Element value) {
7940 throw new UnsupportedError('Cannot modify list'); 8093 throw new UnsupportedError('');
7941 } 8094 }
7942 8095
7943 void set length(int newLength) { 8096 void set length(int newLength) {
7944 throw new UnsupportedError('Cannot modify list'); 8097 _nodeList.length = newLength;
7945 } 8098 }
7946 8099
7947 void sort([Comparator<Element> compare]) { 8100 void add(Element value) {
7948 throw new UnsupportedError('Cannot sort list'); 8101 throw new UnsupportedError('');
8102 }
8103
8104 void addAll(Iterable<Element> iterable) {
8105 throw new UnsupportedError('');
8106 }
8107
8108 void sort([int compare(Element a, Element b)]) {
8109 throw new UnsupportedError('');
8110 }
8111
8112 void setRange(int start, int end, Iterable<Element> iterable,
8113 [int skipCount = 0]) {
8114 throw new UnsupportedError('');
8115 }
8116
8117 void removeRange(int start, int end) {
8118 throw new UnsupportedError('');
8119 }
8120
8121 List<Element> sublist(int start, [int end]) {
8122 return new _FrozenElementList._wrap(_nodeList.sublist(start, end));
8123 }
8124
8125 void clear() {
8126 throw new UnsupportedError('');
8127 }
8128
8129 Element removeAt(int index) {
8130 throw new UnsupportedError('');
8131 }
8132
8133 Element removeLast() {
8134 throw new UnsupportedError('');
8135 }
8136
8137 void remove(Object element) {
8138 throw new UnsupportedError('');
8139 }
8140
8141 void removeWhere(bool test(Element element)) {
8142 throw new UnsupportedError('');
8143 }
8144
8145 void retainWhere(bool test(Element element)) {
8146 throw new UnsupportedError('');
7949 } 8147 }
7950 8148
7951 Element get first => _nodeList.first; 8149 Element get first => _nodeList.first;
7952 8150
7953 Element get last => _nodeList.last; 8151 Element get last => _nodeList.last;
7954 8152
7955 Element get single => _nodeList.single; 8153 Element get single => _nodeList.single;
8154
8155 String toString() {
8156 StringBuffer buffer = new StringBuffer('[');
8157 buffer.writeAll(this, ', ');
8158 buffer.write(']');
8159 return buffer.toString();
8160 }
7956 } 8161 }
7957 8162
7958 class _ElementCssClassSet extends CssClassSet { 8163 class _ElementCssClassSet extends CssClassSet {
7959 8164
7960 final Element _element; 8165 final Element _element;
7961 8166
7962 _ElementCssClassSet(this._element); 8167 _ElementCssClassSet(this._element);
7963 8168
7964 Set<String> readClasses() { 8169 Set<String> readClasses() {
7965 var s = new LinkedHashSet<String>(); 8170 var s = new LinkedHashSet<String>();
(...skipping 7678 matching lines...) Expand 10 before | Expand all | Expand 10 after
15644 throw new RangeError.range(index, 0, length); 15849 throw new RangeError.range(index, 0, length);
15645 } 15850 }
15646 if (index == length) { 15851 if (index == length) {
15647 _this.append(node); 15852 _this.append(node);
15648 } else { 15853 } else {
15649 _this.insertBefore(node, this[index]); 15854 _this.insertBefore(node, this[index]);
15650 } 15855 }
15651 } 15856 }
15652 15857
15653 void insertAll(int index, Iterable<Node> iterable) { 15858 void insertAll(int index, Iterable<Node> iterable) {
15654 var item = this[index]; 15859 throw new UnimplementedError();
15655 _this.insertAllBefore(iterable, item);
15656 } 15860 }
15657 15861
15658 void setAll(int index, Iterable<Node> iterable) { 15862 void setAll(int index, Iterable<Node> iterable) {
15659 throw new UnsupportedError("Cannot setAll on Node list"); 15863 throw new UnimplementedError();
15660 } 15864 }
15661 15865
15662 Node removeLast() { 15866 Node removeLast() {
15663 final result = last; 15867 final result = last;
15664 if (result != null) { 15868 if (result != null) {
15665 _this.$dom_removeChild(result); 15869 _this.$dom_removeChild(result);
15666 } 15870 }
15667 return result; 15871 return result;
15668 } 15872 }
15669 15873
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
15707 void clear() { 15911 void clear() {
15708 _this.text = ''; 15912 _this.text = '';
15709 } 15913 }
15710 15914
15711 void operator []=(int index, Node value) { 15915 void operator []=(int index, Node value) {
15712 _this.$dom_replaceChild(value, this[index]); 15916 _this.$dom_replaceChild(value, this[index]);
15713 } 15917 }
15714 15918
15715 Iterator<Node> get iterator => _this.$dom_childNodes.iterator; 15919 Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
15716 15920
15921 List<Node> toList({ bool growable: true }) =>
15922 new List<Node>.from(this, growable: growable);
15923 Set<Node> toSet() => new Set<Node>.from(this);
15924
15925 bool get isEmpty => this.length == 0;
15926
15717 // From List<Node>: 15927 // From List<Node>:
15718 15928
15719 // TODO(jacobr): this could be implemented for child node lists. 15929 // TODO(jacobr): this could be implemented for child node lists.
15720 // The exception we throw here is misleading. 15930 // The exception we throw here is misleading.
15721 void sort([Comparator<Node> compare]) { 15931 void sort([int compare(Node a, Node b)]) {
15722 throw new UnsupportedError("Cannot sort Node list"); 15932 throw new UnsupportedError("Cannot sort immutable List.");
15723 } 15933 }
15724 15934
15725 // FIXME: implement these. 15935 // FIXME: implement these.
15726 void setRange(int start, int end, Iterable<Node> iterable, 15936 void setRange(int start, int end, Iterable<Node> iterable,
15727 [int skipCount = 0]) { 15937 [int skipCount = 0]) {
15728 throw new UnsupportedError("Cannot setRange on Node list"); 15938 throw new UnsupportedError(
15939 "Cannot setRange on immutable List.");
15940 }
15941 void removeRange(int start, int end) {
15942 throw new UnsupportedError(
15943 "Cannot removeRange on immutable List.");
15729 } 15944 }
15730 15945
15731 void fillRange(int start, int end, [Node fill]) { 15946 Iterable<Node> getRange(int start, int end) {
15732 throw new UnsupportedError("Cannot fillRange on Node list"); 15947 throw new UnimplementedError("NodeList.getRange");
15948 }
15949
15950 void replaceRange(int start, int end, Iterable<Node> iterable) {
15951 throw new UnimplementedError("NodeList.replaceRange");
15952 }
15953
15954 void fillRange(int start, int end, [Node fillValue]) {
15955 throw new UnimplementedError("NodeList.fillRange");
15956 }
15957
15958 List<Node> sublist(int start, [int end]) {
15959 if (end == null) end == length;
15960 return Lists.getRange(this, start, end, <Node>[]);
15961 }
15962
15963 String toString() {
15964 StringBuffer buffer = new StringBuffer('[');
15965 buffer.writeAll(this, ', ');
15966 buffer.write(']');
15967 return buffer.toString();
15733 } 15968 }
15734 // -- end List<Node> mixins. 15969 // -- end List<Node> mixins.
15735 15970
15736 // TODO(jacobr): benchmark whether this is more efficient or whether caching 15971 // TODO(jacobr): benchmark whether this is more efficient or whether caching
15737 // a local copy of $dom_childNodes is more efficient. 15972 // a local copy of $dom_childNodes is more efficient.
15738 int get length => _this.$dom_childNodes.length; 15973 int get length => _this.$dom_childNodes.length;
15739 15974
15740 void set length(int value) { 15975 void set length(int value) {
15741 throw new UnsupportedError( 15976 throw new UnsupportedError(
15742 "Cannot set length on immutable List."); 15977 "Cannot set length on immutable List.");
(...skipping 13284 matching lines...) Expand 10 before | Expand all | Expand 10 after
29027 } 29262 }
29028 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 29263 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
29029 // for details. All rights reserved. Use of this source code is governed by a 29264 // for details. All rights reserved. Use of this source code is governed by a
29030 // BSD-style license that can be found in the LICENSE file. 29265 // BSD-style license that can be found in the LICENSE file.
29031 29266
29032 29267
29033 /** 29268 /**
29034 * A list which just wraps another list, for either intercepting list calls or 29269 * A list which just wraps another list, for either intercepting list calls or
29035 * retyping the list (for example, from List<A> to List<B> where B extends A). 29270 * retyping the list (for example, from List<A> to List<B> where B extends A).
29036 */ 29271 */
29037 class _WrappedList<E> extends ListBase<E> { 29272 class _WrappedList<E> implements List<E> {
29038 final List _list; 29273 final List _list;
29039 29274
29040 _WrappedList(this._list); 29275 _WrappedList(this._list);
29041 29276
29042 // Iterable APIs 29277 // Iterable APIs
29043 29278
29044 Iterator<E> get iterator => new _WrappedIterator(_list.iterator); 29279 Iterator<E> get iterator => new _WrappedIterator(_list.iterator);
29045 29280
29281 Iterable map(f(E element)) => _list.map(f);
29282
29283 Iterable<E> where(bool f(E element)) => _list.where(f);
29284
29285 Iterable expand(Iterable f(E element)) => _list.expand(f);
29286
29287 bool contains(E element) => _list.contains(element);
29288
29289 void forEach(void f(E element)) { _list.forEach(f); }
29290
29291 E reduce(E combine(E value, E element)) =>
29292 _list.reduce(combine);
29293
29294 dynamic fold(initialValue, combine(previousValue, E element)) =>
29295 _list.fold(initialValue, combine);
29296
29297 bool every(bool f(E element)) => _list.every(f);
29298
29299 String join([String separator = ""]) => _list.join(separator);
29300
29301 bool any(bool f(E element)) => _list.any(f);
29302
29303 List<E> toList({ bool growable: true }) =>
29304 new List.from(_list, growable: growable);
29305
29306 Set<E> toSet() => _list.toSet();
29307
29046 int get length => _list.length; 29308 int get length => _list.length;
29047 29309
29310 bool get isEmpty => _list.isEmpty;
29311
29312 Iterable<E> take(int n) => _list.take(n);
29313
29314 Iterable<E> takeWhile(bool test(E value)) => _list.takeWhile(test);
29315
29316 Iterable<E> skip(int n) => _list.skip(n);
29317
29318 Iterable<E> skipWhile(bool test(E value)) => _list.skipWhile(test);
29319
29320 E get first => _list.first;
29321
29322 E get last => _list.last;
29323
29324 E get single => _list.single;
29325
29326 E firstWhere(bool test(E value), { E orElse() }) =>
29327 _list.firstWhere(test, orElse: orElse);
29328
29329 E lastWhere(bool test(E value), {E orElse()}) =>
29330 _list.lastWhere(test, orElse: orElse);
29331
29332 E singleWhere(bool test(E value)) => _list.singleWhere(test);
29333
29334 E elementAt(int index) => _list.elementAt(index);
29335
29048 // Collection APIs 29336 // Collection APIs
29049 29337
29050 void add(E element) { _list.add(element); } 29338 void add(E element) { _list.add(element); }
29051 29339
29340 void addAll(Iterable<E> elements) { _list.addAll(elements); }
29341
29052 void remove(Object element) { _list.remove(element); } 29342 void remove(Object element) { _list.remove(element); }
29053 29343
29344 void removeWhere(bool test(E element)) { _list.removeWhere(test); }
29345
29346 void retainWhere(bool test(E element)) { _list.retainWhere(test); }
29347
29054 void clear() { _list.clear(); } 29348 void clear() { _list.clear(); }
29055 29349
29056 // List APIs 29350 // List APIs
29057 29351
29058 E operator [](int index) => _list[index]; 29352 E operator [](int index) => _list[index];
29059 29353
29060 void operator []=(int index, E value) { _list[index] = value; } 29354 void operator []=(int index, E value) { _list[index] = value; }
29061 29355
29062 void set length(int newLength) { _list.length = newLength; } 29356 void set length(int newLength) { _list.length = newLength; }
29063 29357
29358 Iterable<E> get reversed => _list.reversed;
29359
29064 void sort([int compare(E a, E b)]) { _list.sort(compare); } 29360 void sort([int compare(E a, E b)]) { _list.sort(compare); }
29065 29361
29066 int indexOf(E element, [int start = 0]) => _list.indexOf(element, start); 29362 int indexOf(E element, [int start = 0]) => _list.indexOf(element, start);
29067 29363
29068 int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start); 29364 int lastIndexOf(E element, [int start]) => _list.lastIndexOf(element, start);
29069 29365
29070 void insert(int index, E element) => _list.insert(index, element); 29366 void insert(int index, E element) => _list.insert(index, element);
29071 29367
29368 void insertAll(int index, Iterable<E> iterable) =>
29369 _list.insertAll(index, iterable);
29370
29371 void setAll(int index, Iterable<E> iterable) =>
29372 _list.setAll(index, iterable);
29373
29072 E removeAt(int index) => _list.removeAt(index); 29374 E removeAt(int index) => _list.removeAt(index);
29073 29375
29376 E removeLast() => _list.removeLast();
29377
29378 List<E> sublist(int start, [int end]) => _list.sublist(start, end);
29379
29380 Iterable<E> getRange(int start, int end) => _list.getRange(start, end);
29381
29074 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) { 29382 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
29075 _list.setRange(start, end, iterable, skipCount); 29383 _list.setRange(start, end, iterable, skipCount);
29076 } 29384 }
29077 29385
29078 void removeRange(int start, int end) { _list.removeRange(start, end); } 29386 void removeRange(int start, int end) { _list.removeRange(start, end); }
29079 29387
29080 void replaceRange(int start, int end, Iterable<E> iterable) { 29388 void replaceRange(int start, int end, Iterable<E> iterable) {
29081 _list.replaceRange(start, end, iterable); 29389 _list.replaceRange(start, end, iterable);
29082 } 29390 }
29083 29391
29084 void fillRange(int start, int end, [E fillValue]) { 29392 void fillRange(int start, int end, [E fillValue]) {
29085 _list.fillRange(start, end, fillValue); 29393 _list.fillRange(start, end, fillValue);
29086 } 29394 }
29395
29396 Map<int, E> asMap() => _list.asMap();
29397
29398 String toString() {
29399 StringBuffer buffer = new StringBuffer('[');
29400 buffer.writeAll(this, ', ');
29401 buffer.write(']');
29402 return buffer.toString();
29403 }
29087 } 29404 }
29088 29405
29089 /** 29406 /**
29090 * Iterator wrapper for _WrappedList. 29407 * Iterator wrapper for _WrappedList.
29091 */ 29408 */
29092 class _WrappedIterator<E> implements Iterator<E> { 29409 class _WrappedIterator<E> implements Iterator<E> {
29093 Iterator _iterator; 29410 Iterator _iterator;
29094 29411
29095 _WrappedIterator(this._iterator); 29412 _WrappedIterator(this._iterator);
29096 29413
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
29593 _position = nextPosition; 29910 _position = nextPosition;
29594 return true; 29911 return true;
29595 } 29912 }
29596 _current = null; 29913 _current = null;
29597 _position = _array.length; 29914 _position = _array.length;
29598 return false; 29915 return false;
29599 } 29916 }
29600 29917
29601 T get current => _current; 29918 T get current => _current;
29602 } 29919 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698