Class EntityState<A extends org.palladiosimulator.pcm.core.entity.Entity>
- java.lang.Object
-
- edu.kit.ipd.sdq.eventsim.interpreter.state.EntityState<A>
-
- Type Parameters:
A
- the least common parent type of all actions that are to be traversed
- All Implemented Interfaces:
IEntityState<A>
public class EntityState<A extends org.palladiosimulator.pcm.core.entity.Entity> extends Object implements IEntityState<A>
This abstract class specifies methods for a stack-like data structure that captures the simulation progress (state) of anEventSimEntity
. The organisation as a stack takes into account the potentially hierarchical nesting of actions such as Loops and Branches.For each level of hierarchy, there is a stack frame, which holds the state information for the respective level of hierarchy. Only state information contained in the topmost frame are accessible.
-
-
Constructor Summary
Constructors Constructor Description EntityState(de.uka.ipd.sdq.simucomframework.variables.StackContext stoExContext)
EntityState(EntityState<A> state)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProperty(String name, Object property)
A
getCurrentPosition()
Returns the current position of the traversal.Procedure
getOnFinishCallback()
<T> T
getProperty(String name, Class<T> type)
de.uka.ipd.sdq.simucomframework.variables.StackContext
getStoExContext()
Returns the context that is used to evaluate stochastic expressions (StoEx).boolean
isEmpty()
Returns whether the stack is empty.void
popStackFrame()
Removes the topmost frame from the stack.void
pushStackFrame()
Pushes an emtpy stack frame onto the stack.void
setCurrentPosition(A position)
Sets the current position of the traversal.void
setOnFinishCallback(Procedure callback)
int
size()
-
-
-
Constructor Detail
-
EntityState
public EntityState(EntityState<A> state)
Copy constructor.- Parameters:
state
- the state to be copied
-
EntityState
public EntityState(de.uka.ipd.sdq.simucomframework.variables.StackContext stoExContext)
-
-
Method Detail
-
pushStackFrame
public void pushStackFrame()
Pushes an emtpy stack frame onto the stack.
-
popStackFrame
public void popStackFrame()
Removes the topmost frame from the stack.
-
isEmpty
public boolean isEmpty()
Returns whether the stack is empty.- Returns:
- true, if the stack is empty; false else
-
size
public int size()
- Returns:
- the number of stack frames contained in this state's stack
-
setOnFinishCallback
public void setOnFinishCallback(Procedure callback)
- Specified by:
setOnFinishCallback
in interfaceIEntityState<A extends org.palladiosimulator.pcm.core.entity.Entity>
-
getOnFinishCallback
public Procedure getOnFinishCallback()
- Specified by:
getOnFinishCallback
in interfaceIEntityState<A extends org.palladiosimulator.pcm.core.entity.Entity>
-
getCurrentPosition
public A getCurrentPosition()
Description copied from interface:IEntityState
Returns the current position of the traversal.- Specified by:
getCurrentPosition
in interfaceIEntityState<A extends org.palladiosimulator.pcm.core.entity.Entity>
- Returns:
- the action that is being traversed currently
-
setCurrentPosition
public void setCurrentPosition(A position)
Sets the current position of the traversal.- Specified by:
setCurrentPosition
in interfaceIEntityState<A extends org.palladiosimulator.pcm.core.entity.Entity>
- Parameters:
position
- the action that is being traversed currently
-
getStoExContext
public de.uka.ipd.sdq.simucomframework.variables.StackContext getStoExContext()
Returns the context that is used to evaluate stochastic expressions (StoEx). The context comprises a stack that contains the local variables of service calls. While traversing aResourceDemandingSEFF
, the stack content changes according to the traversal progress.- Returns:
- the evaluation context for stochastic expressions
-
addProperty
public void addProperty(String name, Object property)
- Specified by:
addProperty
in interfaceIEntityState<A extends org.palladiosimulator.pcm.core.entity.Entity>
-
getProperty
public <T> T getProperty(String name, Class<T> type)
- Specified by:
getProperty
in interfaceIEntityState<A extends org.palladiosimulator.pcm.core.entity.Entity>
-
-