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

Side by Side Diff: pkg/serialization/lib/src/reader_writer.dart

Issue 12090093: Reapply "Rename mappedBy to map." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed bug in previous commit. Created 7 years, 10 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 serialization; 5 part of serialization;
6 6
7 /** 7 /**
8 * This writes out the state of the objects to an external format. It holds 8 * This writes out the state of the objects to an external format. It holds
9 * all of the intermediate state needed. The primary API for it is the 9 * all of the intermediate state needed. The primary API for it is the
10 * [write] method. 10 * [write] method.
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 */ 190 */
191 int _objectNumberFor(object) { 191 int _objectNumberFor(object) {
192 var reference = references[object]; 192 var reference = references[object];
193 return (reference == null) ? -1 : reference.objectNumber; 193 return (reference == null) ? -1 : reference.objectNumber;
194 } 194 }
195 195
196 /** 196 /**
197 * Return a list of [Reference] objects pointing to our roots. This will be 197 * Return a list of [Reference] objects pointing to our roots. This will be
198 * stored in the output under "roots" in the default format. 198 * stored in the output under "roots" in the default format.
199 */ 199 */
200 _rootReferences() => trace.roots.mappedBy(_referenceFor).toList(); 200 _rootReferences() => trace.roots.map(_referenceFor).toList();
201 201
202 /** 202 /**
203 * Given an object, return a reference for it if one exists. If there's 203 * Given an object, return a reference for it if one exists. If there's
204 * no reference, return the object itself. Once we have finished the tracing 204 * no reference, return the object itself. Once we have finished the tracing
205 * step, all objects that should have a reference (roughly speaking, 205 * step, all objects that should have a reference (roughly speaking,
206 * non-primitives) can be relied on to have a reference. 206 * non-primitives) can be relied on to have a reference.
207 */ 207 */
208 _referenceFor(object) { 208 _referenceFor(object) {
209 var result = references[object]; 209 var result = references[object];
210 return (result == null) ? object : result; 210 return (result == null) ? object : result;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 */ 324 */
325 List<SerializationRule> get rules => serialization._rules; 325 List<SerializationRule> get rules => serialization._rules;
326 326
327 /** 327 /**
328 * Internal use only, for testing purposes. Set the data for this reader 328 * Internal use only, for testing purposes. Set the data for this reader
329 * to a List of Lists whose size must match the number of rules. 329 * to a List of Lists whose size must match the number of rules.
330 */ 330 */
331 // When we set the data, initialize the object storage to a matching size. 331 // When we set the data, initialize the object storage to a matching size.
332 void set data(List<List> newData) { 332 void set data(List<List> newData) {
333 _data = newData; 333 _data = newData;
334 objects = _data.mappedBy((x) => new List(x.length)).toList(); 334 objects = _data.map((x) => new List(x.length)).toList();
335 } 335 }
336 336
337 /** 337 /**
338 * This is the primary method for a [Reader]. It takes the input data, 338 * This is the primary method for a [Reader]. It takes the input data,
339 * decodes it according to [format] and returns the root object. 339 * decodes it according to [format] and returns the root object.
340 */ 340 */
341 read(rawInput, [Map externals = const {}]) { 341 read(rawInput, [Map externals = const {}]) {
342 namedObjects = externals; 342 namedObjects = externals;
343 var input = format.read(rawInput, this); 343 var input = format.read(rawInput, this);
344 data = input["data"]; 344 data = input["data"];
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 * for an example. It knows how to return its object and how to filter. 600 * for an example. It knows how to return its object and how to filter.
601 */ 601 */
602 class DesignatedRuleForObject { 602 class DesignatedRuleForObject {
603 Function rulePredicate; 603 Function rulePredicate;
604 final target; 604 final target;
605 605
606 DesignatedRuleForObject(this.target, this.rulePredicate); 606 DesignatedRuleForObject(this.target, this.rulePredicate);
607 607
608 possibleRules(List rules) => rules.where(rulePredicate).toList(); 608 possibleRules(List rules) => rules.where(rulePredicate).toList();
609 } 609 }
OLDNEW
« no previous file with comments | « pkg/serialization/lib/src/format.dart ('k') | pkg/serialization/lib/src/serialization_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698