Package de.monticore.types.check
Class CompKindOfGenericComponentType
java.lang.Object
de.monticore.types.check.CompKindExpression
de.monticore.types.check.CompKindOfGenericComponentType
Represents generic component with filled type parameters. E.g., a
TypeExprOfGenericComponent can
represent generic component usages, such as, MyComp<Person> and OtherComp<List<T>>.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.google.common.collect.ImmutableList<SymTypeExpression> Fields inherited from class de.monticore.types.check.CompKindExpression
arguments, component, parameterBindings, sourceNode -
Constructor Summary
ConstructorsConstructorDescriptionCompKindOfGenericComponentType(@NonNull ComponentTypeSymbol component, @NonNull List<SymTypeExpression> typeArguments) -
Method Summary
Modifier and TypeMethodDescriptionLogs an error if this is not a generic component typebindTypeParameter(@NonNull Map<TypeVarSymbol, SymTypeExpression> newTypeVarBindings) If thisTypeExprOfGenericComponentreferences type variables (e.g.protected Optional<SymTypeExpression> createBoundTypeExpression(@NonNull SymTypeExpression unboundTypeExpr) protected List<Optional<SymTypeExpression>> createBoundTypeExpression(@NonNull List<SymTypeExpression> typeExprS) deepClone(@NonNull ComponentTypeSymbol compTypeSymbol) booleandeepEquals(@NonNull CompKindExpression compSymType) getTypeBindingFor(@NonNull TypeVarSymbol typeVar) getTypeBindingFor(@NonNull String typeVarName) com.google.common.collect.ImmutableList<SymTypeExpression> getTypeOfParameter(@NonNull String parameterName) Returns the SymTypeExpression of the type of the parameter specified byparameterName.getTypeOfPort(@NonNull String name) Returns the SymTypeExpression of the type of the port specified byportName.com.google.common.collect.ImmutableMap<TypeVarSymbol, SymTypeExpression> booleanAm I a generic component type? (such asC<int>) (default: no)Methods inherited from class de.monticore.types.check.CompKindExpression
addArgument, addArgument, asComponentType, bindParams, deepClone, getArguments, getParamBindingFor, getParamBindings, getParamBindingsAsList, getSourceNode, getTypeInfo, isComponentType, setSourceNode, setSourceNodeAbsent
-
Field Details
-
typeArguments
-
-
Constructor Details
-
CompKindOfGenericComponentType
public CompKindOfGenericComponentType(@NonNull ComponentTypeSymbol component, @NonNull List<SymTypeExpression> typeArguments)
-
-
Method Details
-
isGenericComponentType
public boolean isGenericComponentType()Description copied from class:CompKindExpressionAm I a generic component type? (such asC<int>) (default: no)- Overrides:
isGenericComponentTypein classCompKindExpression
-
asGenericComponentType
Description copied from class:CompKindExpressionLogs an error if this is not a generic component type- Overrides:
asGenericComponentTypein classCompKindExpression- Returns:
- this expression as a generic component type
-
getTypeVarBindings
-
printName
- Specified by:
printNamein classCompKindExpression
-
printFullName
- Specified by:
printFullNamein classCompKindExpression
-
getSuperComponents
- Specified by:
getSuperComponentsin classCompKindExpression- 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
Description copied from class:CompKindExpressionReturns 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.- Specified by:
getTypeOfPortin classCompKindExpression- Parameters:
name- 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
Description copied from class:CompKindExpressionReturns 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.- Specified by:
getTypeOfParameterin classCompKindExpression- 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
- Specified by:
getParameterTypesin classCompKindExpression
-
getTypeBindingFor
-
getTypeBindingFor
-
getTypeBindingsAsList
-
bindTypeParameter
public CompKindOfGenericComponentType bindTypeParameter(@NonNull Map<TypeVarSymbol, SymTypeExpression> newTypeVarBindings) If thisTypeExprOfGenericComponentreferences type variables (e.g. the typeComp<List<T>>) and you provide aSymTypeExpressionmapping for that type variable, this method returns aTypeExprOfGenericComponentwhere that type variable has been reset by the SymTypeExpression you provided. E.g., if you provide the mappingT -> Personfor the above given example component, then this method would returnComp<List<Person>>. If you provide mappings for type variables that do not appear in the component type expression, then these will be ignored. -
deepClone
- Specified by:
deepClonein classCompKindExpression
-
deepEquals
- Specified by:
deepEqualsin classCompKindExpression
-
createBoundTypeExpression
protected Optional<SymTypeExpression> createBoundTypeExpression(@NonNull SymTypeExpression unboundTypeExpr) -
createBoundTypeExpression
protected List<Optional<SymTypeExpression>> createBoundTypeExpression(@NonNull List<SymTypeExpression> typeExprS)
-