Example #1
0
        public void Pop()
        {
            StackForPlates currentStack = GetCurrentOne();

            currentStack.Pop();

            if (currentStack.IsEmpty())
            {
                _stacks.RemoveAt(_stacks.Count - 1);
            }
        }
Example #2
0
        public void Push(int data)
        {
            var stack = GetCurrent();

            if (stack == null || stack.IsFull())
            {
                stack = new StackForPlates(_stackSize);
                _stacks.Add(stack);
            }

            stack.Push(data);
        }
Example #3
0
        public void Push(int data)
        {
            StackForPlates currentStack = GetCurrentOne();

            if (currentStack == null || currentStack.IsFull())
            {
                var newStack = new StackForPlates(_stackSize);
                newStack.Push(data);
                _stacks.Add(newStack);
            }
            else
            {
                currentStack.Push(data);
            }
        }