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

Side by Side Diff: sdk/lib/html/html_common/filtered_element_list.dart

Issue 11896013: Add List.reversed to give a reverse fixed-length view of a list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved some functionality to separate CL. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/list.dart ('k') | tests/corelib/list_iterators_test.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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html_common; 5 part of html_common;
6 6
7 /** 7 /**
8 * An indexable collection of a node's descendants in the document tree, 8 * An indexable collection of a node's descendants in the document tree,
9 * filtered so that only elements are in the collection. 9 * filtered so that only elements are in the collection.
10 */ 10 */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 void addLast(Element value) { 64 void addLast(Element value) {
65 add(value); 65 add(value);
66 } 66 }
67 67
68 bool contains(Element element) { 68 bool contains(Element element) {
69 return element is Element && _childNodes.contains(element); 69 return element is Element && _childNodes.contains(element);
70 } 70 }
71 71
72 List<E> get reversed => new ReversedListView<E>(_filtered, 0, null);
73
72 void sort([int compare(Element a, Element b)]) { 74 void sort([int compare(Element a, Element b)]) {
73 throw new UnsupportedError('TODO(jacobr): should we impl?'); 75 throw new UnsupportedError('TODO(jacobr): should we impl?');
74 } 76 }
75 77
76 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) { 78 void setRange(int start, int rangeLength, List from, [int startFrom = 0]) {
77 throw new UnimplementedError(); 79 throw new UnimplementedError();
78 } 80 }
79 81
80 void removeRange(int start, int rangeLength) { 82 void removeRange(int start, int rangeLength) {
81 _filtered.getRange(start, rangeLength).forEach((el) => el.remove()); 83 _filtered.getRange(start, rangeLength).forEach((el) => el.remove());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 Element get first => _filtered.first; 197 Element get first => _filtered.first;
196 198
197 Element get last => _filtered.last; 199 Element get last => _filtered.last;
198 200
199 Element get single => _filtered.single; 201 Element get single => _filtered.single;
200 202
201 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); 203 Element min([int compare(Element a, Element b)]) => _filtered.min(compare);
202 204
203 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); 205 Element max([int compare(Element a, Element b)]) => _filtered.max(compare);
204 } 206 }
OLDNEW
« no previous file with comments | « sdk/lib/core/list.dart ('k') | tests/corelib/list_iterators_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698