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

Side by Side Diff: lib/observe/set.dart

Issue 50433010: WebUI fixes for SDK 0.8.10 (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « lib/observe/list.dart ('k') | lib/src/html5_setters.g.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library web_ui.observe.set; 5 library web_ui.observe.set;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'observable.dart'; 8 import 'observable.dart';
9 import 'map.dart' show MapFactory; 9 import 'map.dart' show MapFactory;
10 import 'package:web_ui/src/utils_observe.dart' show IterableWorkaround;
11 10
12 /** 11 /**
13 * Represents an observable set of model values. If any items are added, 12 * Represents an observable set of model values. If any items are added,
14 * removed, or replaced, then observers that are registered with 13 * removed, or replaced, then observers that are registered with
15 * [observe] will be notified. 14 * [observe] will be notified.
16 */ 15 */
17 // TODO(jmesserly): ideally this could be based ObservableMap, or Dart 16 // TODO(jmesserly): ideally this could be based ObservableMap, or Dart
18 // would have a built in Set<->Map adapter as suggested in 17 // would have a built in Set<->Map adapter as suggested in
19 // https://code.google.com/p/dart/issues/detail?id=5603 18 // https://code.google.com/p/dart/issues/detail?id=5603
20 class ObservableSet<E> extends IterableWorkaround with Observable 19 class ObservableSet<E> extends IterableBase<E> with Observable {
21 implements Set<E> {
22 20
23 final Map<E, Object> _map; 21 final Map<E, Object> _map;
24 22
25 final MapFactory<E, Object> _createMap; 23 final MapFactory<E, Object> _createMap;
26 24
27 /** 25 /**
28 * Creates an observable set, optionally using the provided [createMap] 26 * Creates an observable set, optionally using the provided [createMap]
29 * factory to construct a custom map type. 27 * factory to construct a custom map type.
30 */ 28 */
31 ObservableSet({MapFactory<E, Object> createMap}) 29 ObservableSet({MapFactory<E, Object> createMap})
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 _set.length; 182 _set.length;
185 return _hasNext = _iterator.moveNext(); 183 return _hasNext = _iterator.moveNext();
186 } 184 }
187 185
188 E get current { 186 E get current {
189 var result = _iterator.current; 187 var result = _iterator.current;
190 if (observeReads && _hasNext) notifyRead(_set, ChangeRecord.INDEX, result); 188 if (observeReads && _hasNext) notifyRead(_set, ChangeRecord.INDEX, result);
191 return result; 189 return result;
192 } 190 }
193 } 191 }
OLDNEW
« no previous file with comments | « lib/observe/list.dart ('k') | lib/src/html5_setters.g.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698