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

Side by Side Diff: pkg/mdv_observe/lib/src/observable_list.dart

Issue 16003002: Add StreamController.multiplex constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused code Created 7 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
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/src/mock_clock.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 part of mdv_observe; 5 part of mdv_observe;
6 6
7 /** 7 /**
8 * Represents an observable list of model values. If any items are added, 8 * Represents an observable list of model values. If any items are added,
9 * removed, or replaced, then observers that are listening to [changes] 9 * removed, or replaced, then observers that are listening to [changes]
10 * will be notified. 10 * will be notified.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 _list.length = value; 65 _list.length = value;
66 } 66 }
67 67
68 E operator [](int index) => _list[index]; 68 E operator [](int index) => _list[index];
69 69
70 void operator []=(int index, E value) { 70 void operator []=(int index, E value) {
71 var oldValue = _list[index]; 71 var oldValue = _list[index];
72 if (hasObservers) { 72 if (hasObservers) {
73 _recordChange(new ListChangeRecord(index, addedCount: 1, removedCount: 1)) ; 73 _recordChange(new ListChangeRecord(index, addedCount: 1,
74 removedCount: 1));
74 } 75 }
75 _list[index] = value; 76 _list[index] = value;
76 } 77 }
77 78
78 // The following methods are here so that we can provide nice change events. 79 // The following methods are here so that we can provide nice change events.
79 80
80 void setAll(int index, Iterable<E> iterable) { 81 void setAll(int index, Iterable<E> iterable) {
81 if (iterable is! List && iterable is! Set) { 82 if (iterable is! List && iterable is! Set) {
82 iterable = iterable.toList(); 83 iterable = iterable.toList();
83 } 84 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 280 }
280 281
281 offset += removed - added; 282 offset += removed - added;
282 } 283 }
283 } 284 }
284 } 285 }
285 286
286 // TODO(jmesserly): bogus type to workaround spurious VM bug with generic base 287 // TODO(jmesserly): bogus type to workaround spurious VM bug with generic base
287 // class and mixins. 288 // class and mixins.
288 abstract class _ListBaseWorkaround extends ListBase<dynamic> {} 289 abstract class _ListBaseWorkaround extends ListBase<dynamic> {}
OLDNEW
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/src/mock_clock.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698