/// Deletes last element, returns its value. If stack is empty, throws exception.
 public ParsingStackElement Pop()
 {
     if (head == null)
     {
         throw new StackNullExeption("Trying to pop an empty stack.");
     }
     ParsingStackElement result = head;
     head = head.GetNext();
     return result;
 }
        /// Deletes last element, returns its value. If stack is empty, throws exception.
        public ParsingStackElement Pop()
        {
            if (head == null)
            {
                throw new StackNullExeption("Trying to pop an empty stack.");
            }
            ParsingStackElement result = head;

            head = head.GetNext();
            return(result);
        }
 private static void AddChildToStackTop(ParsingStackElement top, IParsingTreeVertex added)
 {
     if (top.GetCount() == 0)
     {
         top.GetValue().SetLeft(added);
     }
     else
     {
         top.GetValue().SetRight(added);
     }
     top.IncreaseCount();
 }
Beispiel #4
0
 private static void AddChildToStackTop(ParsingStackElement top, IParsingTreeVertex added)
 {
     if (top.GetCount() == 0)
     {
         top.GetValue().SetLeft(added);
     }
     else
     {
         top.GetValue().SetRight(added);
     }
     top.IncreaseCount();
 }
 /// Gets value and sets element with current value as head.
 public void Push(Operation value)
 {
     head = new ParsingStackElement(value, head);
 }
 /// Gets value and sets element with current value as head.
 public void Push(Operation value)
 {
     head = new ParsingStackElement(value, head);
 }