Class SimulatedStackframe<T>

java.lang.Object
de.uka.ipd.sdq.simucomframework.variables.stackframe.SimulatedStackframe<T>
Type Parameters:
T -
All Implemented Interfaces:
Serializable

public class SimulatedStackframe<T> extends Object implements Serializable
See Also:
  • Constructor Details

    • SimulatedStackframe

      public SimulatedStackframe(SimulatedStackframe<T> parent)
    • SimulatedStackframe

      public SimulatedStackframe()
  • Method Details

    • addValue

      public void addValue(String id, T value)
      Add a value to this stackframe
      Parameters:
      id - ID of the value
      value - The actual value
    • hasValue

      public boolean hasValue(String id)
      Checks whether a value is present on the stack or resolvable via one of its parents.
    • getValue

      public T getValue(String id) throws ValueNotInFrameException
      Retrieve a value from this stackframe. If the value is not part of this stackframe the parent stackframe is queried automatically
      Parameters:
      id - ID of the variable value to retrieve
      Returns:
      The value of the variable with id ID.
      Throws:
      ValueNotInFrameException - Is throw if this frame and all parent frames do not contain the id ID
    • copyFrame

      public SimulatedStackframe<T> copyFrame()
      Clone this stackframe
      Returns:
      A clone of the stackframe. The parent frames are copies as well
    • getContents

      public ArrayList<Map.Entry<String,T>> getContents()
      Returns:
      All IDs and their value in the current frame. For debugging and error reporting cases
    • addVariables

      public void addVariables(SimulatedStackframe<T> callResult)
      Add all variables and their values in the given frame to this frame
      Parameters:
      callResult - The frame whose contents will be copied into this frame
    • toString

      public String toString()
      Overrides:
      toString in class Object