Ejemplo n.º 1
0
        static FileNodeViewModel ConcatTrees(FileNodeViewModel first, FileNodeViewModel second)
        {
            FileNodeViewModel tmp = first;

            while (tmp.right != null)
            {
                tmp = tmp.right;
            }
            InsertNodeAfter(tmp, second);
            return(tmp.GetListRoot());
        }
Ejemplo n.º 2
0
 static void InsertNodeAfter(FileNodeViewModel pos, FileNodeViewModel newNode)
 {
     // newNode might be the model root of a whole subtree, so go to the list root of that subtree:
     newNode = newNode.GetListRoot();
     if (pos.right == null)
     {
         pos.right          = newNode;
         newNode.listParent = pos;
     }
     else
     {
         // insert before pos.right's leftmost:
         pos = pos.right;
         while (pos.left != null)
         {
             pos = pos.left;
         }
         Debug.Assert(pos.left == null);
         pos.left           = newNode;
         newNode.listParent = pos;
     }
     RebalanceUntilRoot(pos);
 }
Ejemplo n.º 3
0
 static void DumpTree(FileNodeViewModel node)
 {
     node.GetListRoot().DumpTree();
 }