java.lang.Object
org.rrd4j.data.RpnCalculator.RpnStack
- Enclosing class:
RpnCalculator
RpnStack class.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intMaximum RPN stack depthprivate intCurrent stack positionprivate final double[]RPN stack storageConstructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescription(package private) booleanisEmpty()Whether the stack holds no values.(package private) doublepeek()Examine the top value on the stack without removing it(package private) doublepop()Pop a value from the RPN stack(package private) voidpush(double x) Push a value onto the RPN stack(package private) voidreset()Reset the allocator state
Field Details
MAX_STACK_SIZE
stack
private final double[] stackRPN stack storagepos
private int posCurrent stack position
Constructor Details
RpnStack
private RpnStack()The stack an RPN expression is evaluated on.
Method Details
push
void push(double x) Push a value onto the RPN stack- Parameters:
x- the value to push
pop
double pop()Pop a value from the RPN stack- Returns:
- the top value, removed from the stack
peek
double peek()Examine the top value on the stack without removing it- Returns:
- the top value, left on the stack
reset
void reset()Reset the allocator stateisEmpty
boolean isEmpty()Whether the stack holds no values.- Returns:
- true if the stack is empty