Example #1
0
 void RestoreTree(PegNode prevCur, PegTree.AddPolicy prevPolicy)
 {
     if (bMute_) return;
     if (prevCur == null)
     {
         tree.root_ = null;
     }
     else if (prevPolicy == PegTree.AddPolicy.eAddAsChild)
     {
         prevCur.child_ = null;
     }
     else
     {
         prevCur.next_ = null;
     }
     tree.cur_ = prevCur;
     tree.addPolicy = prevPolicy;
 }
Example #2
0
 void AddTreeNode(int nId, PegTree.AddPolicy newAddPolicy, Creator createNode, ECreatorPhase ePhase)
 {
     if (bMute_) return;
     if (tree.root_ == null)
     {
         tree.root_ = tree.cur_ = createNode(ePhase, tree.cur_, nId);
     }
     else if (tree.addPolicy == PegTree.AddPolicy.eAddAsChild)
     {
         tree.cur_ = tree.cur_.child_ = createNode(ePhase, tree.cur_, nId);
     }
     else
     {
         tree.cur_ = tree.cur_.next_ = createNode(ePhase, tree.cur_.parent_, nId);
     }
     tree.addPolicy = newAddPolicy;
 }