| OLD | NEW |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 * The actual representation of the state is determined by the rule. Lists | 48 * The actual representation of the state is determined by the rule. Lists |
| 49 * and Maps are common, but it is arbitrary. | 49 * and Maps are common, but it is arbitrary. |
| 50 */ | 50 */ |
| 51 final List<List> states = new List<List>(); | 51 final List<List> states = new List<List>(); |
| 52 | 52 |
| 53 /** Return the list of rules we use. */ | 53 /** Return the list of rules we use. */ |
| 54 List<SerializationRule> get rules => serialization._rules; | 54 List<SerializationRule> get rules => serialization._rules; |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Creates a new [Writer] that uses the rules from its parent | 57 * Creates a new [Writer] that uses the rules from its parent |
| 58 * [Serialization]. Serializations are do not keep any state | 58 * [Serialization]. Serializations do not keep any state |
| 59 * related to a particular read/write, so the same one can be used | 59 * related to a particular read/write, so the same one can be used |
| 60 * for multiple different Readers/Writers. | 60 * for multiple different Readers/Writers. |
| 61 */ | 61 */ |
| 62 Writer(this.serialization) { | 62 Writer(this.serialization) { |
| 63 trace = new Trace(this); | 63 trace = new Trace(this); |
| 64 selfDescribing = serialization.selfDescribing; | 64 selfDescribing = serialization.selfDescribing; |
| 65 } | 65 } |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * This is the main API for a [Writer]. It writes the objects and returns | 68 * This is the main API for a [Writer]. It writes the objects and returns |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 * for an example. It knows how to return its object and how to filter. | 641 * for an example. It knows how to return its object and how to filter. |
| 642 */ | 642 */ |
| 643 class DesignatedRuleForObject { | 643 class DesignatedRuleForObject { |
| 644 Function rulePredicate; | 644 Function rulePredicate; |
| 645 final target; | 645 final target; |
| 646 | 646 |
| 647 DesignatedRuleForObject(this.target, this.rulePredicate); | 647 DesignatedRuleForObject(this.target, this.rulePredicate); |
| 648 | 648 |
| 649 possibleRules(List rules) => rules.filter(rulePredicate); | 649 possibleRules(List rules) => rules.filter(rulePredicate); |
| 650 } | 650 } |
| OLD | NEW |