Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: tools/dom/src/CssClassSet.dart

Issue 12537009: Rename XMatching to XWhere. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge and rebuild dom libraries. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/async/stream_controller_async_test.dart ('k') | tools/dom/src/WrappedList.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of html; 5 part of html;
6 6
7 abstract class CssClassSet implements Set<String> { 7 abstract class CssClassSet implements Set<String> {
8 8
9 String toString() { 9 String toString() {
10 return readClasses().join(' '); 10 return readClasses().join(' ');
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 void removeAll(Iterable<String> iterable) { 89 void removeAll(Iterable<String> iterable) {
90 _modify((s) => s.removeAll(iterable)); 90 _modify((s) => s.removeAll(iterable));
91 } 91 }
92 92
93 void retainAll(Iterable<String> iterable) { 93 void retainAll(Iterable<String> iterable) {
94 _modify((s) => s.retainAll(iterable)); 94 _modify((s) => s.retainAll(iterable));
95 } 95 }
96 96
97 void removeMatching(bool test(String name)) { 97 void removeWhere(bool test(String name)) {
98 _modify((s) => s.removeMatching(test)); 98 _modify((s) => s.removeWhere(test));
99 } 99 }
100 100
101 void retainMatching(bool test(String name)) { 101 void retainWhere(bool test(String name)) {
102 _modify((s) => s.retainMatching(test)); 102 _modify((s) => s.retainWhere(test));
103 } 103 }
104 104
105 bool isSubsetOf(Collection<String> collection) => 105 bool isSubsetOf(Collection<String> collection) =>
106 readClasses().isSubsetOf(collection); 106 readClasses().isSubsetOf(collection);
107 107
108 bool containsAll(Collection<String> collection) => 108 bool containsAll(Collection<String> collection) =>
109 readClasses().containsAll(collection); 109 readClasses().containsAll(collection);
110 110
111 Set<String> intersection(Collection<String> other) => 111 Set<String> intersection(Collection<String> other) =>
112 readClasses().intersection(other); 112 readClasses().intersection(other);
113 113
114 String get first => readClasses().first; 114 String get first => readClasses().first;
115 String get last => readClasses().last; 115 String get last => readClasses().last;
116 String get single => readClasses().single; 116 String get single => readClasses().single;
117 List<String> toList({ bool growable: true }) => 117 List<String> toList({ bool growable: true }) =>
118 readClasses().toList(growable: growable); 118 readClasses().toList(growable: growable);
119 Set<String> toSet() => readClasses().toSet(); 119 Set<String> toSet() => readClasses().toSet();
120 String min([int compare(String a, String b)]) => 120 String min([int compare(String a, String b)]) =>
121 readClasses().min(compare); 121 readClasses().min(compare);
122 String max([int compare(String a, String b)]) => 122 String max([int compare(String a, String b)]) =>
123 readClasses().max(compare); 123 readClasses().max(compare);
124 Iterable<String> take(int n) => readClasses().take(n); 124 Iterable<String> take(int n) => readClasses().take(n);
125 Iterable<String> takeWhile(bool test(String value)) => 125 Iterable<String> takeWhile(bool test(String value)) =>
126 readClasses().takeWhile(test); 126 readClasses().takeWhile(test);
127 Iterable<String> skip(int n) => readClasses().skip(n); 127 Iterable<String> skip(int n) => readClasses().skip(n);
128 Iterable<String> skipWhile(bool test(String value)) => 128 Iterable<String> skipWhile(bool test(String value)) =>
129 readClasses().skipWhile(test); 129 readClasses().skipWhile(test);
130 String firstMatching(bool test(String value), { String orElse() }) => 130 String firstWhere(bool test(String value), { String orElse() }) =>
131 readClasses().firstMatching(test, orElse: orElse); 131 readClasses().firstWhere(test, orElse: orElse);
132 String lastMatching(bool test(String value), {String orElse()}) => 132 String lastWhere(bool test(String value), {String orElse()}) =>
133 readClasses().lastMatching(test, orElse: orElse); 133 readClasses().lastWhere(test, orElse: orElse);
134 String singleMatching(bool test(String value)) => 134 String singleWhere(bool test(String value)) =>
135 readClasses().singleMatching(test); 135 readClasses().singleWhere(test);
136 String elementAt(int index) => readClasses().elementAt(index); 136 String elementAt(int index) => readClasses().elementAt(index);
137 137
138 void clear() { 138 void clear() {
139 _modify((s) => s.clear()); 139 _modify((s) => s.clear());
140 } 140 }
141 // interface Set - END 141 // interface Set - END
142 142
143 /** 143 /**
144 * Helper method used to modify the set of css classes on this element. 144 * Helper method used to modify the set of css classes on this element.
145 * 145 *
(...skipping 16 matching lines...) Expand all
162 */ 162 */
163 Set<String> readClasses(); 163 Set<String> readClasses();
164 164
165 /** 165 /**
166 * Join all the elements of a set into one string and write 166 * Join all the elements of a set into one string and write
167 * back to the element. 167 * back to the element.
168 * This is intended to be overridden by specific implementations. 168 * This is intended to be overridden by specific implementations.
169 */ 169 */
170 void writeClasses(Set<String> s); 170 void writeClasses(Set<String> s);
171 } 171 }
OLDNEW
« no previous file with comments | « tests/lib/async/stream_controller_async_test.dart ('k') | tools/dom/src/WrappedList.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698