コード例 #1
0
 // -------------------------------------------------------------------------------------------
 /// <summary>
 /// Resets the traveling stack.
 /// </summary>
 public void ResetStack()
 {
     if (TravelingStack != null)
     {
         TravelingStack.Clear();
     }
 }
コード例 #2
0
 // -------------------------------------------------------------------------------------------
 /// <summary>
 /// Adds the currently pointed node into the traveling stack.
 /// </summary>
 public void PushNode()
 {
     if (TravelingStack == null)
     {
         TravelingStack = new Stack <SimpleNode <TData> >();  // CAUTION: Could not work inside an iterator.
     }
     TravelingStack.Push(this.CurrentNode);
 }
コード例 #3
0
        // -------------------------------------------------------------------------------------------
        /// <summary>
        /// Extracts the last stored node from the traveling stack making it the current. Returns whether the operation was successful.
        /// </summary>
        public bool PopNode()
        {
            if (TravelingStack == null || TravelingStack.Count < 1)
            {
                return(false);
            }

            this.CurrentNode = TravelingStack.Pop();
            return(true);
        }