| OLD | NEW |
| 1 Sky Base | 1 Sky Base |
| 2 ======== | 2 ======== |
| 3 | 3 |
| 4 AbstractNode |
| 5 ------------ |
| 6 |
| 7 The [node.dart](node.dart) file defines a class, `AbstractNode`, which |
| 8 can be used to build mutable trees. |
| 9 |
| 10 * When a subclass is changing the parent of a child, it should |
| 11 call either parent.adoptChild(child) or parent.dropChild(child) |
| 12 as appropriate. Subclasses should expose an API for |
| 13 manipulating the tree if you want to (e.g. a setter for a |
| 14 'child' property, or an 'add()' method to manipulate a list). |
| 15 |
| 16 * You can see the current parent by querying 'parent'. |
| 17 |
| 18 * You can see the current attachment state by querying |
| 19 'attached'. The root of any tree that is to be considered |
| 20 attached should be manually attached by calling 'attach()'. |
| 21 Other than that, don't call 'attach()' or 'detach()'. This is |
| 22 all managed automatically assuming you call the 'adoptChild()' |
| 23 and 'dropChild()' methods appropriately. |
| 24 |
| 25 * Subclasses that have children must override 'attach()' and |
| 26 'detach()' as described below. |
| 27 |
| 28 * Nodes always have a 'depth' greater than their ancestors'. |
| 29 There's no guarantee regarding depth between siblings. The |
| 30 depth of a node is used to ensure that nodes are processed in |
| 31 depth order. The 'depth' of a child can be more than one |
| 32 greater than the 'depth' of the parent, because the 'depth' |
| 33 values are never decreased: all that matters is that it's |
| 34 greater than the parent. Consider a tree with a root node A, a |
| 35 child B, and a grandchild C. Initially, A will have 'depth' 0, |
| 36 B 'depth' 1, and C 'depth' 2. If C is moved to be a child of A, |
| 37 sibling of B, then the numbers won't change. C's 'depth' will |
| 38 still be 2. This is all managed automatically assuming you call |
| 39 'adoptChild()' and 'dropChild()' appropriately. |
| 40 |
| 41 |
| 4 Dependencies | 42 Dependencies |
| 5 ------------ | 43 ------------ |
| 6 | 44 |
| 7 No dependencies except for `dart:sky` and Dart's core libraries. | 45 No dependencies except for `dart:sky` and Dart's core libraries. |
| OLD | NEW |