- 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 TypeMethodDescriptionvoid
void
ensureSize
(int size) Ensures that the operand stack is at least the given size.int
Returns the position of the topmostmark
object on the operand stack.<T extends PsyObject>
TgetBacked
(int index) void
popOperands
(int count) void
pushOptional
(Optional<? extends PsyObject> opt) void
rollback()
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, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods 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 topmostmark
object on the operand stack.- Returns:
- the position of the topmost
mark
object on the operand stack. - Throws:
PsyUnmatchedMarkException
- if there is nomark
object on the operand stack.
-
pushOptional
-