| 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 - figure out whether classList exists, and if so use that | 5 // TODO - figure out whether classList exists, and if so use that |
| 6 // rather than the className property that is being used here. | 6 // rather than the className property that is being used here. |
| 7 | 7 |
| 8 class _CssClassSet implements Set<String> { | 8 class _CssClassSet implements Set<String> { |
| 9 | 9 |
| 10 final _element; | 10 final _element; |
| 11 | 11 |
| 12 _CssClassSet(this._element); | 12 _CssClassSet(this._element); |
| 13 | 13 |
| 14 String toString() { | 14 String toString() { |
| 15 return _formatSet(_read()); | 15 return _formatSet(_read()); |
| 16 } | 16 } |
| 17 | 17 |
| 18 // interface Iterable - BEGIN | 18 // interface Iterable - BEGIN |
| 19 Iterator<String> iterator() { | 19 Iterator<String> iterator() { |
| 20 return _read().iterator(); | 20 return _read().iterator(); |
| 21 } | 21 } |
| 22 // interface Iterable - END | 22 // interface Iterable - END |
| 23 | 23 |
| 24 // interface Collection - BEGIN | 24 // interface Collection - BEGIN |
| 25 void forEach(void f(String element)) { | 25 void forEach(void f(String element)) { |
| 26 _read().forEach(f); | 26 _read().forEach(f); |
| 27 } | 27 } |
| 28 | 28 |
| 29 Collection map(f(String element)) { |
| 30 return _read().map(f); |
| 31 } |
| 32 |
| 29 Collection<String> filter(bool f(String element)) { | 33 Collection<String> filter(bool f(String element)) { |
| 30 return _read().filter(f); | 34 return _read().filter(f); |
| 31 } | 35 } |
| 32 | 36 |
| 33 bool every(bool f(String element)) { | 37 bool every(bool f(String element)) { |
| 34 return _read().every(f); | 38 return _read().every(f); |
| 35 } | 39 } |
| 36 | 40 |
| 37 bool some(bool f(String element)) { | 41 bool some(bool f(String element)) { |
| 38 return _read().some(f); | 42 return _read().some(f); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 135 } |
| 132 | 136 |
| 133 String _formatSet(Set<String> s) { | 137 String _formatSet(Set<String> s) { |
| 134 // TODO(mattsh) should be able to pass Set to String.joins http:/b/5398605 | 138 // TODO(mattsh) should be able to pass Set to String.joins http:/b/5398605 |
| 135 List list = new List.from(s); | 139 List list = new List.from(s); |
| 136 return Strings.join(list, ' '); | 140 return Strings.join(list, ' '); |
| 137 } | 141 } |
| 138 | 142 |
| 139 } | 143 } |
| 140 | 144 |
| OLD | NEW |