コード例 #1
0
 /// <summary>
 ///  Walk upwards looking for a node with more children to walk.
 /// </summary>
 protected internal virtual void WalkBackToMostRecentNodeWithUnvisitedChildren()
 {
     while ((currentNode != null) && (currentChildIndex >= adaptor.GetChildCount(currentNode)))
     {
         currentNode = nodeStack.Pop();
         if (currentNode == null)
         {                 // hit the root?
             return;
         }
         currentChildIndex = ((int)indexStack.Pop());
         currentChildIndex++;                 // move to next child
         if (currentChildIndex >= adaptor.GetChildCount(currentNode))
         {
             if (!adaptor.IsNil(currentNode))
             {
                 AddNavigationNode(Token.UP);
             }
             if (currentNode == root)
             {
                 // we done yet?
                 currentNode = null;
             }
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Seek back to previous index saved during last Push() call.
        /// Return top of stack (return index).
        /// </summary>
        public int Pop()
        {
            int ret = (int)calls.Pop();

            Seek(ret);
            return(ret);
        }