OLD | NEW |
1 library node; | |
2 | |
3 class AbstractNode { | 1 class AbstractNode { |
4 | 2 |
5 // Nodes always have a 'depth' greater than their ancestors'. | 3 // Nodes always have a 'depth' greater than their ancestors'. |
6 // There's no guarantee regarding depth between siblings. The depth | 4 // There's no guarantee regarding depth between siblings. The depth |
7 // of a node is used to ensure that nodes are processed in depth | 5 // of a node is used to ensure that nodes are processed in depth |
8 // order. The 'depth' of a child can be more than one greater than | 6 // order. The 'depth' of a child can be more than one greater than |
9 // the 'depth' of the parent, because the 'depth' values are never | 7 // the 'depth' of the parent, because the 'depth' values are never |
10 // decreased: all that matters is that it's greater than the parent. | 8 // decreased: all that matters is that it's greater than the parent. |
11 // Consider a tree with a root node A, a child B, and a grandchild | 9 // Consider a tree with a root node A, a child B, and a grandchild |
12 // C. Initially, A will have 'depth' 0, B 'depth' 1, and C 'depth' | 10 // C. Initially, A will have 'depth' 0, B 'depth' 1, and C 'depth' |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void dropChild(AbstractNode child) { // only for use by subclasses | 55 void dropChild(AbstractNode child) { // only for use by subclasses |
58 assert(child != null); | 56 assert(child != null); |
59 assert(child._parent == this); | 57 assert(child._parent == this); |
60 assert(child.attached == attached); | 58 assert(child.attached == attached); |
61 child._parent = null; | 59 child._parent = null; |
62 if (attached) | 60 if (attached) |
63 child.detach(); | 61 child.detach(); |
64 } | 62 } |
65 | 63 |
66 } | 64 } |
OLD | NEW |