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

Unified Diff: lib/src/set_group.dart

Issue 1873373002: Add GroupSet and SetGroup classes. (Closed) Base URL: git@github.com:dart-lang/collection@master
Patch Set: a few more docs Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/set_group.dart
diff --git a/lib/src/set_group.dart b/lib/src/set_group.dart
new file mode 100644
index 0000000000000000000000000000000000000000..14a9b8cefa64b3ab64574de9eeef97b93fda8415
--- /dev/null
+++ b/lib/src/set_group.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'group_set.dart';
+import 'wrappers.dart';
+
+/// A set of sets that provides a view of the union of those sets.
+///
+/// This is a convenience class for creating a [GroupSet] whose contents change
+/// over the lifetime of a class. For example:
+///
+/// ```dart
+/// class Foo {
+/// Set<String> get contents => _contentsGroup.set;
+/// final _contentsGroup = new SetGroup<String>();
+///
Lasse Reichstein Nielsen 2016/04/12 13:55:22 I can't figure out when I would use this class, an
nweiz 2016/04/12 20:29:20 Done.
nweiz 2016/04/13 00:00:57 After making the change and trying it out, I remem
+/// // ...
+/// }
+/// ```
+class SetGroup<E> extends DelegatingSet<Set<E>> {
+ /// The [GroupSet] that provides a view of the union of sets in [this].
+ GroupSet<E> get set => _set;
+ GroupSet<E> _set;
+
+ SetGroup() : super(new Set<Set<E>>()) {
+ _set = new GroupSet<E>(this);
+ }
+}
« lib/src/group_set.dart ('K') | « lib/src/group_set.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698