Class MIFrameLayoutForBasicSymbols

java.lang.Object
de.monticore.symbols.basicsymbols.interpreter.frames.MIFrameLayoutForBasicSymbols
All Implemented Interfaces:
de.monticore.interpreter.frames.MIFrameLayout

public class MIFrameLayoutForBasicSymbols extends Object implements de.monticore.interpreter.frames.MIFrameLayout
A frame layout for BasicSymbols.

Note that a frame may encompass the variables of multiple scopes; As long as the variable _symbol_ is unique, one does not need to create a new frame. One does need to create a new frame for, e.g., function calls.

  • Constructor Details

    • MIFrameLayoutForBasicSymbols

      public MIFrameLayoutForBasicSymbols(MIFrameLayoutForBasicSymbols parentFrame)
      the "default" constructor
      Parameters:
      parentFrame - the parent frame
    • MIFrameLayoutForBasicSymbols

      public MIFrameLayoutForBasicSymbols()
      for the topmost frame only
  • Method Details

    • clone

      Overrides:
      clone in class Object
    • sizeBooleans

      public int sizeBooleans()
      Specified by:
      sizeBooleans in interface de.monticore.interpreter.frames.MIFrameLayout
    • sizeIntegers

      public int sizeIntegers()
      Specified by:
      sizeIntegers in interface de.monticore.interpreter.frames.MIFrameLayout
    • sizeDoubles

      public int sizeDoubles()
      Specified by:
      sizeDoubles in interface de.monticore.interpreter.frames.MIFrameLayout
    • sizeObjects

      public int sizeObjects()
      Specified by:
      sizeObjects in interface de.monticore.interpreter.frames.MIFrameLayout
    • hasParentFrame

      public boolean hasParentFrame()
    • getParentFrame

      public MIFrameLayoutForBasicSymbols getParentFrame()
    • declareVariable

      public void declareVariable(VariableSymbol varSym)
    • declareBoolean

      protected void declareBoolean(VariableSymbol varSym)
    • declareInt

      protected void declareInt(VariableSymbol varSym)
    • declareDouble

      protected void declareDouble(VariableSymbol varSym)
    • declareObject

      protected void declareObject(VariableSymbol varSym)
    • getBooleanSymbol

      public VariableSymbol getBooleanSymbol(int index)
    • getIntSymbol

      public VariableSymbol getIntSymbol(int index)
    • getDoubleSymbol

      public VariableSymbol getDoubleSymbol(int index)
    • getObjectSymbol

      public VariableSymbol getObjectSymbol(int index)
    • getSetterCalculation

      public de.monticore.interpreter.calculations.MICalculationVoid getSetterCalculation(VariableSymbol symbol, de.monticore.interpreter.calculations.MICalculation valueCalc)
    • getSetterCalculation

      protected de.monticore.interpreter.calculations.MICalculationVoid getSetterCalculation(VariableSymbol varSym, de.monticore.interpreter.calculations.MICalculation valueCalc, int scopeLevelOfVariable)
    • getVariableSetter

      public de.monticore.interpreter.setters.MISetter getVariableSetter(VariableSymbol varSym)
      Provides a function to set the correct variable
      Parameters:
      varSym - the variable that is to be set.
      Returns:
      A function that sets the variable.
    • getCalcAndStore

      public de.monticore.interpreter.calculations.MICalculationVoid getCalcAndStore(VariableSymbol varSym, de.monticore.interpreter.calculations.MICalculation valueCalc)
      A more optimized variant than getVariableSetter(de.monticore.symbols.basicsymbols._symboltable.VariableSymbol), In cases in which The calculation is ensured to create a fitting primitive.
      Parameters:
      varSym - the variable that is to be set.
      valueCalc - the function that calculates the variable
      Returns:
      A function that calculates the value and stores it in the variable.
    • getVariableGetter

      public de.monticore.interpreter.calculations.MICalculation getVariableGetter(VariableSymbol varSym)
    • isPrefixOf

      public boolean isPrefixOf(MIFrameLayoutForBasicSymbols otherLayout)
      Checks if this is a prefix of another layout.

      Internally used to check if a MIFrame can be cloned.

      Parameters:
      otherLayout - the longer or equal layout
      Returns:
      whether this is a prefix
    • assertVariableHasNotBeenRegisteredYet

      protected void assertVariableHasNotBeenRegisteredYet(VariableSymbol varSym)
    • getScopeLevelOfVarOrThrow

      protected int getScopeLevelOfVarOrThrow(VariableSymbol varSym)
    • getScopeLevelOfVar

      protected Optional<Integer> getScopeLevelOfVar(VariableSymbol varSym)
    • getIdxInScope

      protected int getIdxInScope(VariableSymbol varSym, int scopeLevel)