Class CompKindOfGenericComponentType

java.lang.Object
de.monticore.types.check.CompKindExpression
de.monticore.types.check.CompKindOfGenericComponentType

public class CompKindOfGenericComponentType extends CompKindExpression
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 Details

    • typeArguments

      protected final com.google.common.collect.ImmutableList<SymTypeExpression> typeArguments
  • Constructor Details

  • Method Details

    • isGenericComponentType

      public boolean isGenericComponentType()
      Description copied from class: CompKindExpression
      Am I a generic component type? (such as C<int>) (default: no)
      Overrides:
      isGenericComponentType in class CompKindExpression
    • asGenericComponentType

      public CompKindOfGenericComponentType asGenericComponentType()
      Description copied from class: CompKindExpression
      Logs an error if this is not a generic component type
      Overrides:
      asGenericComponentType in class CompKindExpression
      Returns:
      this expression as a generic component type
    • getTypeVarBindings

      public com.google.common.collect.ImmutableMap<TypeVarSymbol,SymTypeExpression> getTypeVarBindings()
    • printName

      public String printName()
      Specified by:
      printName in class CompKindExpression
    • printFullName

      public String printFullName()
      Specified by:
      printFullName in class CompKindExpression
    • getSuperComponents

      public List<CompKindExpression> getSuperComponents()
      Specified by:
      getSuperComponents in class CompKindExpression
      Returns:
      The CompKindExpression that represents this component's super components. E.g., given Comp<T> extends Parent<List<T>>, the returned list for component expression Comp<Person> contains a single entry representing Parent<List<Person>>. The List is empty if the component has no super components.
    • getTypeOfPort

      public Optional<SymTypeExpression> getTypeOfPort(@NonNull String name)
      Description copied from class: CompKindExpression
      Returns the SymTypeExpression of the type of the port specified by portName. 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 is Comp<Person> and Comp is defined by Comp<T>, having a port of type T. Then, as the type argument for T is Person, the SymTypeExpression returned by this method will be Person for that port.
      Specified by:
      getTypeOfPort in class CompKindExpression
      Parameters:
      name - The name of the port for whom the type is requested.
      Returns:
      The SymTypeExpressions of the port's type enclosed in an Optional. An empty Optional if the component has no such port.
    • getTypeOfParameter

      public Optional<SymTypeExpression> getTypeOfParameter(@NonNull String parameterName)
      Description copied from class: CompKindExpression
      Returns the SymTypeExpression of the type of the parameter specified by parameterName. 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 is Comp<Person> and Comp is defined by Comp<T>, having a parameter of type T. Then, as the type argument for T is Person, the SymTypeExpression returned by this method will be Person for that parameter.
      Specified by:
      getTypeOfParameter in class CompKindExpression
      Parameters:
      parameterName - The name of the parameter for whom the type is requested.
      Returns:
      The SymTypeExpressions of the parameter's type enclosed in an Optional. An empty Optional if the component has no such parameter.
    • getParameterTypes

      public List<Optional<SymTypeExpression>> getParameterTypes()
      Specified by:
      getParameterTypes in class CompKindExpression
    • getTypeBindingFor

      public Optional<SymTypeExpression> getTypeBindingFor(@NonNull TypeVarSymbol typeVar)
    • getTypeBindingFor

      public Optional<SymTypeExpression> getTypeBindingFor(@NonNull String typeVarName)
    • getTypeBindingsAsList

      public com.google.common.collect.ImmutableList<SymTypeExpression> getTypeBindingsAsList()
    • bindTypeParameter

      public CompKindOfGenericComponentType bindTypeParameter(@NonNull Map<TypeVarSymbol,SymTypeExpression> newTypeVarBindings)
      If this TypeExprOfGenericComponent references type variables (e.g. the type Comp<List<T>>) and you provide a SymTypeExpression mapping for that type variable, this method returns a TypeExprOfGenericComponent where that type variable has been reset by the SymTypeExpression you provided. E.g., if you provide the mapping T -> Person for the above given example component, then this method would return Comp<List<Person>>. If you provide mappings for type variables that do not appear in the component type expression, then these will be ignored.
    • deepClone

      public CompKindOfGenericComponentType deepClone(@NonNull ComponentTypeSymbol compTypeSymbol)
      Specified by:
      deepClone in class CompKindExpression
    • deepEquals

      public boolean deepEquals(@NonNull CompKindExpression compSymType)
      Specified by:
      deepEquals in class CompKindExpression
    • createBoundTypeExpression

      protected Optional<SymTypeExpression> createBoundTypeExpression(@NonNull SymTypeExpression unboundTypeExpr)
    • createBoundTypeExpression

      protected List<Optional<SymTypeExpression>> createBoundTypeExpression(@NonNull List<SymTypeExpression> typeExprS)