Class ContextStack
java.lang.Object
net.ssehub.easy.varModel.cstEvaluation.ContextStack
Realizes a context stack for evaluating nested self expressions.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classImplements a poolable stack frame. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate static final net.ssehub.easy.basics.pool.Pool<ContextStack.StackFrame> private Stack<ContextStack.StackFrame> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidclear()Clears the whole stack.private voidensureCapacity(IDecisionVariable var, ContextStack.StackFrame frame) Ensures the capacity of a container variable.(package private) ValueReturns the value for self in the current context.(package private) voidpop()Pops a context frame.(package private) voidpush()Pushes an empty frame.(package private) voidpush(ContainerInitializer init) Pushes a frame with given initializer.(package private) voidPushes a context frame for the given expression.(package private) voidsetCompoundSlot(String slot) Sets the compound slot in the actual frame.(package private) voidsetContainerIndex(int index) Sets the container index in the actual frame.(package private) voidSets the container initializer in the actual frame.(package private) voidSets the (top-level) variable in the actual frame.
-
Field Details
-
POOL
-
stack
-
currentStart
private int currentStart
-
-
Constructor Details
-
ContextStack
ContextStack()
-
-
Method Details
-
push
Pushes a context frame for the given expression.- Parameters:
ex- the expression (will not be released
-
push
void push()Pushes an empty frame. -
push
Pushes a frame with given initializer.- Parameters:
init- the initializer- See Also:
-
setVariable
Sets the (top-level) variable in the actual frame. Requirespush()before.- Parameters:
var- the variable
-
setContainerInitializer
Sets the container initializer in the actual frame. Requirespush()before.- Parameters:
init- the initializer- See Also:
-
setContainerIndex
void setContainerIndex(int index) Sets the container index in the actual frame. Requirespush()before.- Parameters:
index- the index value- See Also:
-
setCompoundSlot
Sets the compound slot in the actual frame. Requirespush()before.- Parameters:
slot- the new slot- See Also:
-
pop
void pop()Pops a context frame. -
clear
void clear()Clears the whole stack. -
getSelfValue
Value getSelfValue()Returns the value for self in the current context.- Returns:
- the expression for self
-
ensureCapacity
Ensures the capacity of a container variable.- Parameters:
var- the variableframe- the stack frame with the access index to ensure fore
-