OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated | 7 // TODO(jacobr): use _Lists.dart to remove some of the duplicated |
8 // functionality. | 8 // functionality. |
9 class _ChildrenElementList extends ListBase<Element> { | 9 class _ChildrenElementList extends ListBase<Element> { |
10 // Raw Element. | 10 // Raw Element. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 151 |
152 Iterable<Element> get reversed { | 152 Iterable<Element> get reversed { |
153 return _childElements.reversed; | 153 return _childElements.reversed; |
154 } | 154 } |
155 | 155 |
156 void sort([int compare(Element a, Element b)]) { | 156 void sort([int compare(Element a, Element b)]) { |
157 throw new UnsupportedError('TODO(jacobr): should we impl?'); | 157 throw new UnsupportedError('TODO(jacobr): should we impl?'); |
158 } | 158 } |
159 | 159 |
160 dynamic reduce(dynamic initialValue, | 160 Element reduce(Element combine(Element value, Element element)) { |
161 dynamic combine(dynamic previousValue, Element element)) { | 161 return _childElements.reduce(combine); |
162 return _childElements.reduce(initialValue, combine); | |
163 } | 162 } |
164 | 163 |
165 dynamic fold(dynamic initialValue, | 164 dynamic fold(dynamic initialValue, |
166 dynamic combine(dynamic previousValue, Element element)) { | 165 dynamic combine(dynamic previousValue, Element element)) { |
167 return _childElements.fold(initialValue, combine); | 166 return _childElements.fold(initialValue, combine); |
168 } | 167 } |
169 | 168 |
170 void setRange(int start, int rangeLength, List from, | 169 void setRange(int start, int rangeLength, List from, |
171 [int startFrom = 0]) { | 170 [int startFrom = 0]) { |
172 throw new UnimplementedError(); | 171 throw new UnimplementedError(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 Element result = _element.$dom_lastElementChild; | 264 Element result = _element.$dom_lastElementChild; |
266 if (result == null) throw new StateError("No elements"); | 265 if (result == null) throw new StateError("No elements"); |
267 return result; | 266 return result; |
268 } | 267 } |
269 | 268 |
270 Element get single { | 269 Element get single { |
271 if (length > 1) throw new StateError("More than one element"); | 270 if (length > 1) throw new StateError("More than one element"); |
272 return first; | 271 return first; |
273 } | 272 } |
274 | 273 |
275 Element min([int compare(Element a, Element b)]) { | |
276 return _childElements.min(compare); | |
277 } | |
278 | |
279 Element max([int compare(Element a, Element b)]) { | 274 Element max([int compare(Element a, Element b)]) { |
280 return _childElements.max(compare); | 275 return _childElements.max(compare); |
281 } | 276 } |
282 | 277 |
283 Map<int, Element> asMap() { | 278 Map<int, Element> asMap() { |
284 return _childElements.asMap(); | 279 return _childElements.asMap(); |
285 } | 280 } |
286 | 281 |
287 String toString() { | 282 String toString() { |
288 StringBuffer buffer = new StringBuffer('['); | 283 StringBuffer buffer = new StringBuffer('['); |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 const ScrollAlignment._internal(this._value); | 988 const ScrollAlignment._internal(this._value); |
994 toString() => 'ScrollAlignment.$_value'; | 989 toString() => 'ScrollAlignment.$_value'; |
995 | 990 |
996 /// Attempt to align the element to the top of the scrollable area. | 991 /// Attempt to align the element to the top of the scrollable area. |
997 static const TOP = const ScrollAlignment._internal('TOP'); | 992 static const TOP = const ScrollAlignment._internal('TOP'); |
998 /// Attempt to center the element in the scrollable area. | 993 /// Attempt to center the element in the scrollable area. |
999 static const CENTER = const ScrollAlignment._internal('CENTER'); | 994 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1000 /// Attempt to align the element to the bottom of the scrollable area. | 995 /// Attempt to align the element to the bottom of the scrollable area. |
1001 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 996 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1002 } | 997 } |
OLD | NEW |