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: client/observable/observable.dart

Issue 9114021: Added method map to Collection interface and all its implementations (except classes generated fr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « client/html/src/NodeWrappingImplementation.dart ('k') | client/samples/swarm/DataSource.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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('observable'); 5 #library('observable');
6 6
7 #import('dart:coreimpl'); 7 #import('dart:coreimpl');
8 8
9 #source('ChangeEvent.dart'); 9 #source('ChangeEvent.dart');
10 #source('EventBatch.dart'); 10 #source('EventBatch.dart');
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 List getRange(int start, int length) { 257 List getRange(int start, int length) {
258 throw const NotImplementedException(); 258 throw const NotImplementedException();
259 } 259 }
260 260
261 // Iterable<T>: 261 // Iterable<T>:
262 Iterator<T> iterator() => _internal.iterator(); 262 Iterator<T> iterator() => _internal.iterator();
263 263
264 // Collection<T>: 264 // Collection<T>:
265 Collection<T> filter(bool f(T element)) => _internal.filter(f); 265 Collection<T> filter(bool f(T element)) => _internal.filter(f);
266 Collection map(f(T element)) => _internal.map(f);
266 bool every(bool f(T element)) => _internal.every(f); 267 bool every(bool f(T element)) => _internal.every(f);
267 bool some(bool f(T element)) => _internal.some(f); 268 bool some(bool f(T element)) => _internal.some(f);
268 void forEach(void f(T element)) { _internal.forEach(f); } 269 void forEach(void f(T element)) { _internal.forEach(f); }
269 bool isEmpty() => length == 0; 270 bool isEmpty() => length == 0;
270 } 271 }
271 272
272 // TODO(jmesserly): is this too granular? Other similar systems make whole 273 // TODO(jmesserly): is this too granular? Other similar systems make whole
273 // classes observable instead of individual fields. The memory cost of having 274 // classes observable instead of individual fields. The memory cost of having
274 // every field effectively boxed, plus having a listeners list is likely too 275 // every field effectively boxed, plus having a listeners list is likely too
275 // much. Also, making a value observable necessitates adding ".value" to lots 276 // much. Also, making a value observable necessitates adding ".value" to lots
(...skipping 13 matching lines...) Expand all
289 // equality check should be done? 290 // equality check should be done?
290 if (newValue !== _value) { 291 if (newValue !== _value) {
291 final oldValue = _value; 292 final oldValue = _value;
292 _value = newValue; 293 _value = newValue;
293 recordPropertyUpdate("value", newValue, oldValue); 294 recordPropertyUpdate("value", newValue, oldValue);
294 } 295 }
295 } 296 }
296 297
297 T _value; 298 T _value;
298 } 299 }
OLDNEW
« no previous file with comments | « client/html/src/NodeWrappingImplementation.dart ('k') | client/samples/swarm/DataSource.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698