| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart.dom.html; | 5 part of dart.dom.html; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A list which just wraps another list, for either intercepting list calls or | 8 * A list which just wraps another list, for either intercepting list calls or |
| 9 * retyping the list (for example, from List<A> to List<B> where B extends A). | 9 * retyping the list (for example, from List<A> to List<B> where B extends A). |
| 10 */ | 10 */ |
| 11 class _WrappedList<E> extends ListBase<E> { | 11 class _WrappedList<E extends Node> extends ListBase<E> |
| 12 implements NodeListWrapper { |
| 12 final List _list; | 13 final List _list; |
| 13 | 14 |
| 14 _WrappedList(this._list); | 15 _WrappedList(this._list); |
| 15 | 16 |
| 16 // Iterable APIs | 17 // Iterable APIs |
| 17 | 18 |
| 18 Iterator<E> get iterator => new _WrappedIterator(_list.iterator); | 19 Iterator<E> get iterator => new _WrappedIterator(_list.iterator); |
| 19 | 20 |
| 20 int get length => _list.length; | 21 int get length => _list.length; |
| 21 | 22 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 | 52 |
| 52 void removeRange(int start, int end) { _list.removeRange(start, end); } | 53 void removeRange(int start, int end) { _list.removeRange(start, end); } |
| 53 | 54 |
| 54 void replaceRange(int start, int end, Iterable<E> iterable) { | 55 void replaceRange(int start, int end, Iterable<E> iterable) { |
| 55 _list.replaceRange(start, end, iterable); | 56 _list.replaceRange(start, end, iterable); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void fillRange(int start, int end, [E fillValue]) { | 59 void fillRange(int start, int end, [E fillValue]) { |
| 59 _list.fillRange(start, end, fillValue); | 60 _list.fillRange(start, end, fillValue); |
| 60 } | 61 } |
| 62 |
| 63 List<Node> get rawList => _list; |
| 61 } | 64 } |
| 62 | 65 |
| 63 /** | 66 /** |
| 64 * Iterator wrapper for _WrappedList. | 67 * Iterator wrapper for _WrappedList. |
| 65 */ | 68 */ |
| 66 class _WrappedIterator<E> implements Iterator<E> { | 69 class _WrappedIterator<E> implements Iterator<E> { |
| 67 Iterator _iterator; | 70 Iterator _iterator; |
| 68 | 71 |
| 69 _WrappedIterator(this._iterator); | 72 _WrappedIterator(this._iterator); |
| 70 | 73 |
| 71 bool moveNext() { | 74 bool moveNext() { |
| 72 return _iterator.moveNext(); | 75 return _iterator.moveNext(); |
| 73 } | 76 } |
| 74 | 77 |
| 75 E get current => _iterator.current; | 78 E get current => _iterator.current; |
| 76 } | 79 } |
| OLD | NEW |