OLD | NEW |
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 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality. | 5 // TODO(jacobr): use Lists.dart to remove some of the duplicated functionality. |
6 class _ChildrenElementList implements ElementList { | 6 class _ChildrenElementList implements ElementList { |
7 // Raw Element. | 7 // Raw Element. |
8 final _element; | 8 final _element; |
9 final _childElements; | 9 final _childElements; |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return this[0]; | 142 return this[0]; |
143 } | 143 } |
144 | 144 |
145 void forEach(void f(Element element)) { | 145 void forEach(void f(Element element)) { |
146 for (Element el in this) { | 146 for (Element el in this) { |
147 f(el); | 147 f(el); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 Collection map(f(Element element)) { | 151 Collection map(f(Element element)) { |
152 var out = []; | 152 final out = []; |
153 for (Element el in this) { | 153 for (Element el in this) { |
154 out.add(f(el)); | 154 out.add(f(el)); |
155 } | 155 } |
156 return out; | 156 return out; |
157 } | 157 } |
158 | 158 |
159 ElementList filter(bool f(Element element)) { | 159 ElementList filter(bool f(Element element)) { |
160 var out = new _ElementList([]); | 160 final out = new _ElementList([]); |
161 for (Element el in this) { | 161 for (Element el in this) { |
162 if (f(el)) out.add(el); | 162 if (f(el)) out.add(el); |
163 } | 163 } |
164 return out; | 164 return out; |
165 } | 165 } |
166 | 166 |
167 bool every(bool f(Element element)) { | 167 bool every(bool f(Element element)) { |
168 for(Element element in this) { | 168 for(Element element in this) { |
169 if (!f(element)) { | 169 if (!f(element)) { |
170 return false; | 170 return false; |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 779 |
780 ElementEvents get on() { | 780 ElementEvents get on() { |
781 if (_on === null) { | 781 if (_on === null) { |
782 _on = new ElementEventsImplementation._wrap(_ptr); | 782 _on = new ElementEventsImplementation._wrap(_ptr); |
783 } | 783 } |
784 return _on; | 784 return _on; |
785 } | 785 } |
786 | 786 |
787 Element clone(bool deep) => super.clone(deep); | 787 Element clone(bool deep) => super.clone(deep); |
788 } | 788 } |
OLD | NEW |