- All Implemented Interfaces:
Serializable,Cloneable,Iterable<PsyObject>,Collection<PsyObject>,List<PsyObject>,RandomAccess
An interpreter’s operand stack.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidensureSize(int size) Ensures that the operand stack is at least the given size.intReturns the position of the topmostmarkobject on the operand stack.<T extends PsyObject>
TgetBacked(int index) voidpopOperands(int count) voidpushOptional(Optional<? extends PsyObject> opt) voidrollback()Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
OperandStack
public OperandStack()
-
-
Method Details
-
getBacked
-
clearBackup
public void clearBackup() -
ensureSize
Ensures that the operand stack is at least the given size.- Parameters:
size- the given size.- Throws:
PsyStackUnderflowException- when the operand stack’s size less than the given size.PsyRangeCheckException- when given size is negative.
-
popOperands
- Throws:
PsyStackUnderflowException
-
rollback
public void rollback() -
findMarkPosition
Returns the position of the topmostmarkobject on the operand stack.- Returns:
- the position of the topmost
markobject on the operand stack. - Throws:
PsyUnmatchedMarkException- if there is nomarkobject on the operand stack.
-
pushOptional
-