void push(StackItem item) { if (item.getLevel() == -1) item.setLevel(stackLevel++); stack.push(item); stackSize += item.size; if (stackMaxSize < stackSize) stackMaxSize = stackSize; }
StackItem peek() { return stack.peek(); }
void popAll() { stackSize = 0; stack.clear(); }
StackItem pop() { StackItem item = stack.pop(); stackSize -= item.size; return item; }
int getStackCount() { return stack.size(); }