Methods Summary |
---|
public final void | clear()Clears the stack.
m_index = -1;
|
private void | grow()Grows the size of the stack
m_allocatedSize *= 2;
boolean newVector[] = new boolean[m_allocatedSize];
System.arraycopy(m_values, 0, newVector, 0, m_index + 1);
m_values = newVector;
|
public boolean | isEmpty()Tests if this stack is empty.
return (m_index == -1);
|
public final boolean | peek()Looks at the object at the top of this stack without removing it
from the stack.
return m_values[m_index];
|
public final boolean | peekOrFalse()Looks at the object at the top of this stack without removing it
from the stack. If the stack is empty, it returns false.
return (m_index > -1) ? m_values[m_index] : false;
|
public final boolean | peekOrTrue()Looks at the object at the top of this stack without removing it
from the stack. If the stack is empty, it returns true.
return (m_index > -1) ? m_values[m_index] : true;
|
public final boolean | pop()Removes the object at the top of this stack and returns that
object as the value of this function.
return m_values[m_index--];
|
public final boolean | popAndTop()Removes the object at the top of this stack and returns the
next object at the top as the value of this function.
m_index--;
return (m_index >= 0) ? m_values[m_index] : false;
|
public final boolean | push(boolean val)Pushes an item onto the top of this stack.
if (m_index == m_allocatedSize - 1)
grow();
return (m_values[++m_index] = val);
|
public final void | setTop(boolean b)Set the item at the top of this stack
m_values[m_index] = b;
|
public final int | size()Get the length of the list.
return m_index + 1;
|