Ejemplo n.º 1
0
 private PegNode CreateNode(CreatorPhase phase, PegNode node, int id)
 {
     if(phase == CreatorPhase.Create || phase == CreatorPhase.CreateAndComplete)
     {
         return new PegNode(node, id);
     }
     else
     {
         return null;
     }
 }
Ejemplo n.º 2
0
        private void AddTreeNode(int id, PegTree.AddPolicy newAddPolicy, CreatorPhase phase)
        {
            if(_mute)
            {
                return;
            }

            if(Tree.Root == null)
            {
                Tree.Root = Tree.Cur = CreateNode(phase, Tree.Cur, id);
            }
            else if(Tree.Policy == PegTree.AddPolicy.AddAsChild)
            {
                Tree.Cur = Tree.Cur.Child = CreateNode(phase, Tree.Cur, id);
            }
            else
            {
                Tree.Cur = Tree.Cur.Next = CreateNode(phase, Tree.Cur.Parent, id);
            }
            Tree.Policy = newAddPolicy;
        }