OLD | NEW |
(Empty) | |
| 1 |
| 2 class _NamedNodeMapImpl implements NamedNodeMap native "*NamedNodeMap" { |
| 3 |
| 4 final int length; |
| 5 |
| 6 _NodeImpl operator[](int index) native "return this[index];"; |
| 7 |
| 8 void operator[]=(int index, _NodeImpl value) { |
| 9 throw new UnsupportedOperationException("Cannot assign element of immutable
List."); |
| 10 } |
| 11 // -- start List<Node> mixins. |
| 12 // Node is the element type. |
| 13 |
| 14 // From Iterable<Node>: |
| 15 |
| 16 Iterator<Node> iterator() { |
| 17 // Note: NodeLists are not fixed size. And most probably length shouldn't |
| 18 // be cached in both iterator _and_ forEach method. For now caching it |
| 19 // for consistency. |
| 20 return new _FixedSizeListIterator<Node>(this); |
| 21 } |
| 22 |
| 23 // From Collection<Node>: |
| 24 |
| 25 void add(Node value) { |
| 26 throw new UnsupportedOperationException("Cannot add to immutable List."); |
| 27 } |
| 28 |
| 29 void addLast(Node value) { |
| 30 throw new UnsupportedOperationException("Cannot add to immutable List."); |
| 31 } |
| 32 |
| 33 void addAll(Collection<Node> collection) { |
| 34 throw new UnsupportedOperationException("Cannot add to immutable List."); |
| 35 } |
| 36 |
| 37 void forEach(void f(Node element)) => _Collections.forEach(this, f); |
| 38 |
| 39 Collection map(f(Node element)) => _Collections.map(this, [], f); |
| 40 |
| 41 Collection<Node> filter(bool f(Node element)) => |
| 42 _Collections.filter(this, <Node>[], f); |
| 43 |
| 44 bool every(bool f(Node element)) => _Collections.every(this, f); |
| 45 |
| 46 bool some(bool f(Node element)) => _Collections.some(this, f); |
| 47 |
| 48 bool isEmpty() => this.length == 0; |
| 49 |
| 50 // From List<Node>: |
| 51 |
| 52 void sort(int compare(Node a, Node b)) { |
| 53 throw new UnsupportedOperationException("Cannot sort immutable List."); |
| 54 } |
| 55 |
| 56 int indexOf(Node element, [int start = 0]) => |
| 57 _Lists.indexOf(this, element, start, this.length); |
| 58 |
| 59 int lastIndexOf(Node element, [int start = 0]) => |
| 60 _Lists.lastIndexOf(this, element, start); |
| 61 |
| 62 Node last() => this[length - 1]; |
| 63 |
| 64 // FIXME: implement thesee. |
| 65 void setRange(int start, int length, List<Node> from, [int startFrom]) { |
| 66 throw new UnsupportedOperationException("Cannot setRange on immutable List."
); |
| 67 } |
| 68 void removeRange(int start, int length) { |
| 69 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis
t."); |
| 70 } |
| 71 void insertRange(int start, int length, [Node initialValue]) { |
| 72 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis
t."); |
| 73 } |
| 74 List<Node> getRange(int start, int length) => |
| 75 _Lists.getRange(this, start, length, <Node>[]); |
| 76 |
| 77 // -- end List<Node> mixins. |
| 78 |
| 79 _NodeImpl getNamedItem(String name) native; |
| 80 |
| 81 _NodeImpl getNamedItemNS(String namespaceURI, String localName) native; |
| 82 |
| 83 _NodeImpl item(int index) native; |
| 84 |
| 85 _NodeImpl removeNamedItem(String name) native; |
| 86 |
| 87 _NodeImpl removeNamedItemNS(String namespaceURI, String localName) native; |
| 88 |
| 89 _NodeImpl setNamedItem(_NodeImpl node) native; |
| 90 |
| 91 _NodeImpl setNamedItemNS(_NodeImpl node) native; |
| 92 } |
OLD | NEW |