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 Summary
ConstructorsConstructorDescriptionfor the topmost frame onlyMIFrameLayoutForBasicSymbols(MIFrameLayoutForBasicSymbols parentFrame) the "default" constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclone()protected voiddeclareBoolean(VariableSymbol varSym) protected voiddeclareDouble(VariableSymbol varSym) protected voiddeclareInt(VariableSymbol varSym) protected voiddeclareObject(VariableSymbol varSym) voiddeclareVariable(VariableSymbol varSym) getBooleanSymbol(int index) de.monticore.interpreter.calculations.MICalculationVoidgetCalcAndStore(VariableSymbol varSym, de.monticore.interpreter.calculations.MICalculation valueCalc) A more optimized variant thangetVariableSetter(de.monticore.symbols.basicsymbols._symboltable.VariableSymbol), In cases in which The calculation is ensured to create a fitting primitive.getDoubleSymbol(int index) protected intgetIdxInScope(VariableSymbol varSym, int scopeLevel) getIntSymbol(int index) getObjectSymbol(int index) getScopeLevelOfVar(VariableSymbol varSym) protected intde.monticore.interpreter.calculations.MICalculationVoidgetSetterCalculation(VariableSymbol symbol, de.monticore.interpreter.calculations.MICalculation valueCalc) protected de.monticore.interpreter.calculations.MICalculationVoidgetSetterCalculation(VariableSymbol varSym, de.monticore.interpreter.calculations.MICalculation valueCalc, int scopeLevelOfVariable) de.monticore.interpreter.calculations.MICalculationgetVariableGetter(VariableSymbol varSym) de.monticore.interpreter.setters.MISettergetVariableSetter(VariableSymbol varSym) Provides a function to set the correct variablebooleanbooleanisPrefixOf(MIFrameLayoutForBasicSymbols otherLayout) Checks if this is a prefix of another layout.intintintint
-
Constructor Details
-
MIFrameLayoutForBasicSymbols
the "default" constructor- Parameters:
parentFrame- the parent frame
-
MIFrameLayoutForBasicSymbols
public MIFrameLayoutForBasicSymbols()for the topmost frame only
-
-
Method Details
-
clone
-
sizeBooleans
public int sizeBooleans()- Specified by:
sizeBooleansin interfacede.monticore.interpreter.frames.MIFrameLayout
-
sizeIntegers
public int sizeIntegers()- Specified by:
sizeIntegersin interfacede.monticore.interpreter.frames.MIFrameLayout
-
sizeDoubles
public int sizeDoubles()- Specified by:
sizeDoublesin interfacede.monticore.interpreter.frames.MIFrameLayout
-
sizeObjects
public int sizeObjects()- Specified by:
sizeObjectsin interfacede.monticore.interpreter.frames.MIFrameLayout
-
hasParentFrame
public boolean hasParentFrame() -
getParentFrame
-
declareVariable
-
declareBoolean
-
declareInt
-
declareDouble
-
declareObject
-
getBooleanSymbol
-
getIntSymbol
-
getDoubleSymbol
-
getObjectSymbol
-
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
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 thangetVariableSetter(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
-
isPrefixOf
Checks if this is a prefix of another layout.Internally used to check if a
MIFramecan be cloned.- Parameters:
otherLayout- the longer or equal layout- Returns:
- whether this is a prefix
-
assertVariableHasNotBeenRegisteredYet
-
getScopeLevelOfVarOrThrow
-
getScopeLevelOfVar
-
getIdxInScope
-