Package de.monticore.types.check
Class CompKindExpression
java.lang.Object
de.monticore.types.check.CompKindExpression
- Direct Known Subclasses:
CompKindOfComponentType,CompKindOfGenericComponentType
Represents all sorts of component kinds. E.g., a
ComponentExpression can represent a generic component with
bound type arguments MyComp<Integer>. This is not representable by Symbols alone, as generic
components only have unspecific type parameters (MyComp<T>.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ASTSubcomponentArgument> protected final ComponentTypeSymbolprotected LinkedHashMap<VariableSymbol, ASTSubcomponentArgument> protected Optional<de.monticore.ast.ASTNode> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArgument(ASTSubcomponentArgument argument) voidaddArgument(List<? extends ASTSubcomponentArgument> arguments) Logs an error if this is not a component typeLogs an error if this is not a generic component typevoidabstract CompKindExpressiondeepClone(ComponentTypeSymbol component) abstract booleandeepEquals(CompKindExpression compSymType) abstract List<Optional<SymTypeExpression>> Optional<de.monticore.ast.ASTNode> The ast node on which this CompKindExpression is based, if present.abstract List<CompKindExpression> abstract Optional<SymTypeExpression> getTypeOfParameter(String parameterName) Returns the SymTypeExpression of the type of the parameter specified byparameterName.abstract Optional<SymTypeExpression> getTypeOfPort(String portName) Returns the SymTypeExpression of the type of the port specified byportName.booleanAm I simple component type? (such as "C") (default: no)booleanAm I a generic component type? (such asC<int>) (default: no)abstract Stringabstract StringvoidsetSourceNode(de.monticore.ast.ASTNode sourceNode) void
-
Field Details
-
component
-
parameterBindings
-
arguments
-
sourceNode
-
-
Constructor Details
-
CompKindExpression
-
-
Method Details
-
getArguments
- Returns:
- a
Listof the configuration arguments of this component.
-
addArgument
- Parameters:
argument- the configuration argument to add to this component.
-
isComponentType
public boolean isComponentType()Am I simple component type? (such as "C") (default: no) -
asComponentType
Logs an error if this is not a component type- Returns:
- this expression as a component type
-
isGenericComponentType
public boolean isGenericComponentType()Am I a generic component type? (such asC<int>) (default: no) -
asGenericComponentType
Logs an error if this is not a generic component type- Returns:
- this expression as a generic component type
-
addArgument
- Parameters:
arguments- the configuration arguments to add to this component.- See Also:
-
getParamBindingFor
-
getParamBindings
-
getParamBindingsAsList
-
bindParams
public void bindParams() -
getSourceNode
The ast node on which this CompKindExpression is based, if present.This is ONLY meant to be used to create better log messages! As CompKindExpressions are moved around, cloned, and modified, it cannot be assumed that the reference to the AST node holds reliable.
-
setSourceNode
public void setSourceNode(de.monticore.ast.ASTNode sourceNode) - Parameters:
sourceNode- Must not be null- See Also:
-
setSourceNodeAbsent
public void setSourceNodeAbsent()- See Also:
-
getTypeInfo
-
printName
-
printFullName
-
getSuperComponents
- Returns:
- The
CompKindExpressionthat represents this component's super components. E.g., givenComp<T> extends Parent<List<T>>, the returned list for component expressionComp<Person>contains a single entry representingParent<List<Person>>. The List is empty if the component has no super components.
-
getTypeOfPort
Returns the SymTypeExpression of the type of the port specified byportName. If the port's type depends on type parameters which are assigned by this CompTypeExpression, they are resolved in the returned SymTypeExpression. E.g., let assume this component's type expression isComp<Person>and Comp is defined byComp<T>, having a port of typeT. Then, as the type argument forTisPerson, the SymTypeExpression returned by this method will bePersonfor that port.- Parameters:
portName- The name of the port for whom the type is requested.- Returns:
- The
SymTypeExpressionsof the port's type enclosed in anOptional. An emptyOptionalif the component has no such port.
-
getTypeOfParameter
Returns the SymTypeExpression of the type of the parameter specified byparameterName. If the parameter's type depends on type parameters which are assigned by this CompTypeExpression, they are resolved in the returned SymTypeExpression. E.g., let assume this component's type expression isComp<Person>and Comp is defined byComp<T>, having a parameter of typeT. Then, as the type argument forTisPerson, the SymTypeExpression returned by this method will bePersonfor that parameter.- Parameters:
parameterName- The name of the parameter for whom the type is requested.- Returns:
- The
SymTypeExpressionsof the parameter's type enclosed in anOptional. An emptyOptionalif the component has no such parameter.
-
getParameterTypes
-
deepClone
-
deepClone
-
deepEquals
-