| 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 // TODO(nweiz): when all implementations we target have the same name for the | 5 // TODO(nweiz): when all implementations we target have the same name for the | 
| 6 // coreimpl implementation of List<E>, extend that rather than wrapping. | 6 // coreimpl implementation of List<E>, extend that rather than wrapping. | 
| 7 class _ListWrapper<E> implements List<E> { | 7 class _ListWrapper<E> implements List<E> { | 
| 8   List _list; | 8   List _list; | 
| 9 | 9 | 
| 10   _ListWrapper(List this._list); | 10   _ListWrapper(List this._list); | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 88   Iterator<Node> iterator() { | 88   Iterator<Node> iterator() { | 
| 89     // Note: NodeLists are not fixed size. And most probably length shouldn't | 89     // Note: NodeLists are not fixed size. And most probably length shouldn't | 
| 90     // be cached in both iterator _and_ forEach method. For now caching it | 90     // be cached in both iterator _and_ forEach method. For now caching it | 
| 91     // for consistency. | 91     // for consistency. | 
| 92     return new _FixedSizeListIterator<Node>(this); | 92     return new _FixedSizeListIterator<Node>(this); | 
| 93   } | 93   } | 
| 94 | 94 | 
| 95   // From Collection<Node>: | 95   // From Collection<Node>: | 
| 96 | 96 | 
| 97   void add(_NodeImpl value) { | 97   void add(_NodeImpl value) { | 
| 98     _parent._appendChild(value); | 98     _parent.$dom_appendChild(value); | 
| 99   } | 99   } | 
| 100 | 100 | 
| 101   void addLast(_NodeImpl value) { | 101   void addLast(_NodeImpl value) { | 
| 102     _parent._appendChild(value); | 102     _parent.$dom_appendChild(value); | 
| 103   } | 103   } | 
| 104 | 104 | 
| 105   void addAll(Collection<_NodeImpl> collection) { | 105   void addAll(Collection<_NodeImpl> collection) { | 
| 106     for (_NodeImpl node in collection) { | 106     for (_NodeImpl node in collection) { | 
| 107       _parent._appendChild(node); | 107       _parent.$dom_appendChild(node); | 
| 108     } | 108     } | 
| 109   } | 109   } | 
| 110 | 110 | 
| 111   _NodeImpl removeLast() { | 111   _NodeImpl removeLast() { | 
| 112     final last = this.last(); | 112     final last = this.last(); | 
| 113     if (last != null) { | 113     if (last != null) { | 
| 114       _parent._removeChild(last); | 114       _parent.$dom_removeChild(last); | 
| 115     } | 115     } | 
| 116     return last; | 116     return last; | 
| 117   } | 117   } | 
| 118 | 118 | 
| 119   void clear() { | 119   void clear() { | 
| 120     _parent.text = ''; | 120     _parent.text = ''; | 
| 121   } | 121   } | 
| 122 | 122 | 
| 123   void operator []=(int index, _NodeImpl value) { | 123   void operator []=(int index, _NodeImpl value) { | 
| 124     _parent._replaceChild(value, this[index]); | 124     _parent.$dom_replaceChild(value, this[index]); | 
| 125   } | 125   } | 
| 126 | 126 | 
| 127   void forEach(void f(Node element)) => _Collections.forEach(this, f); | 127   void forEach(void f(Node element)) => _Collections.forEach(this, f); | 
| 128 | 128 | 
| 129   Collection map(f(Node element)) => _Collections.map(this, [], f); | 129   Collection map(f(Node element)) => _Collections.map(this, [], f); | 
| 130 | 130 | 
| 131   Collection<Node> filter(bool f(Node element)) => | 131   Collection<Node> filter(bool f(Node element)) => | 
| 132      new _NodeListWrapper(_Collections.filter(this, <Node>[], f)); | 132      new _NodeListWrapper(_Collections.filter(this, <Node>[], f)); | 
| 133 | 133 | 
| 134   bool every(bool f(Node element)) => _Collections.every(this, f); | 134   bool every(bool f(Node element)) => _Collections.every(this, f); | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 162   void insertRange(int start, int length, [Node initialValue]) { | 162   void insertRange(int start, int length, [Node initialValue]) { | 
| 163     throw new UnsupportedOperationException("Cannot insertRange on immutable Lis
     t."); | 163     throw new UnsupportedOperationException("Cannot insertRange on immutable Lis
     t."); | 
| 164   } | 164   } | 
| 165   NodeList getRange(int start, int length) => | 165   NodeList getRange(int start, int length) => | 
| 166     new _NodeListWrapper(_Lists.getRange(this, start, length, <Node>[])); | 166     new _NodeListWrapper(_Lists.getRange(this, start, length, <Node>[])); | 
| 167 | 167 | 
| 168   // -- end List<Node> mixins. | 168   // -- end List<Node> mixins. | 
| 169 | 169 | 
| 170 $!MEMBERS | 170 $!MEMBERS | 
| 171 } | 171 } | 
| OLD | NEW | 
|---|