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

Side by Side Diff: sdk/lib/html/html_common/css_class_set.dart

Issue 288103003: Change Set.toSet to always return a set with the same behavior. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change .clone() to use .toSet(). Update docs. Created 6 years, 7 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
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_common; 5 part of html_common;
6 6
7 abstract class CssClassSetImpl implements CssClassSet { 7 abstract class CssClassSetImpl implements CssClassSet {
8 8
9 String toString() { 9 String toString() {
10 return readClasses().join(' '); 10 return readClasses().join(' ');
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 Set<String> intersection(Set<String> other) => 166 Set<String> intersection(Set<String> other) =>
167 readClasses().intersection(other); 167 readClasses().intersection(other);
168 168
169 Set<String> union(Set<String> other) => 169 Set<String> union(Set<String> other) =>
170 readClasses().union(other); 170 readClasses().union(other);
171 171
172 Set<String> difference(Set<String> other) => 172 Set<String> difference(Set<String> other) =>
173 readClasses().difference(other); 173 readClasses().difference(other);
174 174
175 // Do overwrite this method in subclasses if it is not the type of set
176 // returned by readClasses.
177 Set<String> cloneEmpty() => new LinkedHashSet<String>();
178
175 String get first => readClasses().first; 179 String get first => readClasses().first;
176 String get last => readClasses().last; 180 String get last => readClasses().last;
177 String get single => readClasses().single; 181 String get single => readClasses().single;
178 List<String> toList({ bool growable: true }) => 182 List<String> toList({ bool growable: true }) =>
179 readClasses().toList(growable: growable); 183 readClasses().toList(growable: growable);
180 Set<String> toSet() => readClasses().toSet(); 184 Set<String> toSet() => readClasses().toSet();
181 Iterable<String> take(int n) => readClasses().take(n); 185 Iterable<String> take(int n) => readClasses().take(n);
182 Iterable<String> takeWhile(bool test(String value)) => 186 Iterable<String> takeWhile(bool test(String value)) =>
183 readClasses().takeWhile(test); 187 readClasses().takeWhile(test);
184 Iterable<String> skip(int n) => readClasses().skip(n); 188 Iterable<String> skip(int n) => readClasses().skip(n);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 */ 224 */
221 Set<String> readClasses(); 225 Set<String> readClasses();
222 226
223 /** 227 /**
224 * Join all the elements of a set into one string and write 228 * Join all the elements of a set into one string and write
225 * back to the element. 229 * back to the element.
226 * This is intended to be overridden by specific implementations. 230 * This is intended to be overridden by specific implementations.
227 */ 231 */
228 void writeClasses(Set<String> s); 232 void writeClasses(Set<String> s);
229 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698