package senac_turma02.stack;

public class StackImpl {
	/////////////////////////
	// Interface
	/////////////////////////
	public int pop() {
		return data_[topIndex_--];
	}
	public void push(int n) {
		data_[++topIndex_] = n;
	}
	public int top() {
		return data_[topIndex_];
	}
	public boolean isEmpty() {
		return topIndex_ == -1 ? true: false;
	}
	public boolean isFull() {
		return topIndex_ == MAX_ELEMS-1 ? true: false;
	}
	public StackImpl() {
		topIndex_ = -1;
		data_     = new int[MAX_ELEMS];
	}
	/////////////////////////
	// Implementation
	/////////////////////////
	private static final int MAX_ELEMS = 10;
	private int data_[];
	private int topIndex_;
}

