| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** Provides some basic model classes to test serialization. */ | |
| 6 | |
| 7 part of serialization_test; | |
| 8 | |
| 9 class Person { | |
| 10 String name, rank, serialNumber; | |
| 11 var address; | |
| 12 } | |
| 13 | |
| 14 class Address { | |
| 15 String street, city, state, zip; | |
| 16 Address(); | |
| 17 Address.withData(this.street, this.city, this.state, this.zip); | |
| 18 } | |
| 19 | |
| 20 class Various { | |
| 21 Various.Foo(this._d, this.e); | |
| 22 | |
| 23 // Field | |
| 24 var a; | |
| 25 | |
| 26 // Get/Set pair | |
| 27 var _b; | |
| 28 get b => _b; | |
| 29 set b(value) { _b = value; } | |
| 30 | |
| 31 // Private field (shouldn't be visible) | |
| 32 var _c = 'default value'; | |
| 33 | |
| 34 // Getter, value is set in the constructor | |
| 35 var _d; | |
| 36 get d => _d; | |
| 37 | |
| 38 // Final, value set is the constructor. | |
| 39 final e; | |
| 40 | |
| 41 // Get without corresponding set | |
| 42 get aLength => a.length; | |
| 43 | |
| 44 static String thisShouldBeIgnored = "because it's static"; | |
| 45 static get thisShouldAlsoBeIgnored => "for the same reason"; | |
| 46 static set thisShouldAlsoBeIgnored(x) {} | |
| 47 } | |
| 48 | |
| 49 class Node { | |
| 50 Node parent; | |
| 51 String name; | |
| 52 Node(this.name); | |
| 53 Node.parentEssential(this.parent); | |
| 54 List<Node> children; | |
| 55 bool someBoolean = true; | |
| 56 | |
| 57 toString() => "Node($name)"; | |
| 58 } | |
| 59 | |
| 60 class NodeEqualByName extends Node { | |
| 61 NodeEqualByName(name) : super(name); | |
| 62 operator ==(x) => x is NodeEqualByName && name == x.name; | |
| 63 get hashCode => name.hashCode; | |
| 64 } | |
| 65 | |
| 66 class Stream { | |
| 67 // In a real stream the position wouldn't likely be settable, making | |
| 68 // this trickier to reconstruct. | |
| 69 List _collection; | |
| 70 int position = 0; | |
| 71 Stream(this._collection); | |
| 72 | |
| 73 next() => atEnd() ? null : _collection[position++]; | |
| 74 atEnd() => position >= _collection.length; | |
| 75 } | |
| OLD | NEW |