|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjaitools.jiffle.runtime.IntegerStack
public class IntegerStack
A simple, array-based stack for Integer values used by AbstractJiffleRuntime.
This class is here to avoid using generic collections (which the Janino compiler
does not support) or littering the runtime source code with casts.
| Field Summary | |
|---|---|
static int |
CHUNK_SIZE
Initial size of stack and grow increment |
static int |
CLEAR_SIZE
Stack size beyond which the data array will be shrunk when clear() is called. |
| Constructor Summary | |
|---|---|
IntegerStack()
|
|
| Method Summary | |
|---|---|
void |
clear()
Clear the stack. |
Integer |
peek()
Peek at the top value without removing it. |
Integer |
pop()
Pop the top value off the stack. |
Integer |
push(Integer x)
Push a value onto the stack. |
int |
size()
Gets the number of items on the stack. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CHUNK_SIZE
public static final int CLEAR_SIZE
clear() is called.
| Constructor Detail |
|---|
public IntegerStack()
| Method Detail |
|---|
public Integer push(Integer x)
x - the value
public Integer pop()
RuntimeException - if the stack is emptypublic Integer peek()
RuntimeException - if the stack is emptypublic void clear()
CLEAR_SIZE
the data array is shrunk to its initial size.
public int size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||