示例#1
0
        public void Push(T v)
        {
            MyStack <T> last = GetLastStack();

            if (last != null)
            { // add to last stack
                if (last.IsFull() != true)
                {
                    last.Push(v);
                }
                else
                {
                    MyStack <T> stack = new MyStack <T>(capacity);
                    stack.Push(v);
                    stacks.Add(stack);
                }
            }
            else
            {
                MyStack <T> stack = new MyStack <T>(capacity);
                stack.Push(v);
                stacks.Add(stack);
            }
        }
示例#2
0
        public bool IsEmpty()
        {
            MyStack <T> last = GetLastStack();

            return(last == null);
        }