OLD | NEW |
1 | 1 |
2 class StyleSheetListJs extends DOMTypeJs implements StyleSheetList native "*Styl
eSheetList" { | 2 class StyleSheetListJs extends DOMTypeJs implements StyleSheetList native "*Styl
eSheetList" { |
3 | 3 |
4 int get length() native "return this.length;"; | 4 int get length() native "return this.length;"; |
5 | 5 |
6 StyleSheetJs operator[](int index) native; | 6 StyleSheetJs operator[](int index) native "return this[index];"; |
7 | 7 |
8 void operator[]=(int index, StyleSheetJs value) { | 8 void operator[]=(int index, StyleSheetJs value) { |
9 throw new UnsupportedOperationException("Cannot assign element of immutable
List."); | 9 throw new UnsupportedOperationException("Cannot assign element of immutable
List."); |
10 } | 10 } |
| 11 // -- start List<StyleSheet> mixins. |
| 12 // StyleSheet is the element type. |
| 13 |
| 14 // From Iterable<StyleSheet>: |
| 15 |
| 16 Iterator<StyleSheet> 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<StyleSheet>(this); |
| 21 } |
| 22 |
| 23 // From Collection<StyleSheet>: |
| 24 |
| 25 void add(StyleSheet value) { |
| 26 throw new UnsupportedOperationException("Cannot add to immutable List."); |
| 27 } |
| 28 |
| 29 void addLast(StyleSheet value) { |
| 30 throw new UnsupportedOperationException("Cannot add to immutable List."); |
| 31 } |
| 32 |
| 33 void addAll(Collection<StyleSheet> collection) { |
| 34 throw new UnsupportedOperationException("Cannot add to immutable List."); |
| 35 } |
| 36 |
| 37 void forEach(void f(StyleSheet element)) => _Collections.forEach(this, f); |
| 38 |
| 39 Collection map(f(StyleSheet element)) => _Collections.map(this, [], f); |
| 40 |
| 41 Collection<StyleSheet> filter(bool f(StyleSheet element)) => |
| 42 _Collections.filter(this, <StyleSheet>[], f); |
| 43 |
| 44 bool every(bool f(StyleSheet element)) => _Collections.every(this, f); |
| 45 |
| 46 bool some(bool f(StyleSheet element)) => _Collections.some(this, f); |
| 47 |
| 48 bool isEmpty() => this.length == 0; |
| 49 |
| 50 // From List<StyleSheet>: |
| 51 |
| 52 void sort(int compare(StyleSheet a, StyleSheet b)) { |
| 53 throw new UnsupportedOperationException("Cannot sort immutable List."); |
| 54 } |
| 55 |
| 56 int indexOf(StyleSheet element, [int start = 0]) => |
| 57 _Lists.indexOf(this, element, start, this.length); |
| 58 |
| 59 int lastIndexOf(StyleSheet element, [int start = 0]) => |
| 60 _Lists.lastIndexOf(this, element, start); |
| 61 |
| 62 StyleSheet last() => this[length - 1]; |
| 63 |
| 64 // FIXME: implement thesee. |
| 65 void setRange(int start, int length, List<StyleSheet> 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, [StyleSheet initialValue]) { |
| 72 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis
t."); |
| 73 } |
| 74 List<StyleSheet> getRange(int start, int length) => |
| 75 _Lists.getRange(this, start, length, <StyleSheet>[]); |
| 76 |
| 77 // -- end List<StyleSheet> mixins. |
11 | 78 |
12 StyleSheetJs item(int index) native; | 79 StyleSheetJs item(int index) native; |
13 } | 80 } |
OLD | NEW |