예제 #1
0
 protected void redepthChild(AbstractNodeMixinDiagnosticableTree child)
 {
     D.assert(child.owner == this.owner);
     if (child._depth <= this._depth)
     {
         child._depth = this._depth + 1;
         child.redepthChildren();
     }
 }
예제 #2
0
        protected virtual void dropChild(AbstractNodeMixinDiagnosticableTree child)
        {
            D.assert(child != null);
            D.assert(child._parent == this);
            D.assert(child.attached == this.attached);

            child._parent = null;
            if (this.attached)
            {
                child.detach();
            }
        }
예제 #3
0
        protected virtual void adoptChild(AbstractNodeMixinDiagnosticableTree child)
        {
            D.assert(child != null);
            D.assert(child._parent == null);
            D.assert(() => {
                var node = this;
                while (node.parent != null)
                {
                    node = node.parent;
                }
                D.assert(node != child); // indicates we are about to create a cycle
                return(true);
            });

            child._parent = this;
            if (this.attached)
            {
                child.attach(this._owner);
            }

            this.redepthChild(child);
        }