Class CompKindExpression

java.lang.Object
de.monticore.types.check.CompKindExpression
Direct Known Subclasses:
CompKindOfComponentType, CompKindOfGenericComponentType

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

  • Constructor Details

  • Method Details

    • getArguments

      public List<ASTSubcomponentArgument> getArguments()
      Returns:
      a List of the configuration arguments of this component.
    • addArgument

      public void addArgument(ASTSubcomponentArgument argument)
      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

      public CompKindOfComponentType 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 as C<int>) (default: no)
    • asGenericComponentType

      public CompKindOfGenericComponentType asGenericComponentType()
      Logs an error if this is not a generic component type
      Returns:
      this expression as a generic component type
    • addArgument

      public void addArgument(List<? extends ASTSubcomponentArgument> arguments)
      Parameters:
      arguments - the configuration arguments to add to this component.
      See Also:
    • getParamBindingFor

      public Optional<ASTSubcomponentArgument> getParamBindingFor(VariableSymbol var)
    • getParamBindings

      public Map<VariableSymbol,ASTSubcomponentArgument> getParamBindings()
    • getParamBindingsAsList

      public List<ASTSubcomponentArgument> getParamBindingsAsList()
    • bindParams

      public void bindParams()
    • getSourceNode

      public Optional<de.monticore.ast.ASTNode> 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

      public ComponentTypeSymbol getTypeInfo()
    • printName

      public abstract String printName()
    • printFullName

      public abstract String printFullName()
    • getSuperComponents

      public abstract List<CompKindExpression> getSuperComponents()
      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 abstract Optional<SymTypeExpression> getTypeOfPort(String portName)
      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.
      Parameters:
      portName - 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 abstract Optional<SymTypeExpression> getTypeOfParameter(String parameterName)
      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.
      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 abstract List<Optional<SymTypeExpression>> getParameterTypes()
    • deepClone

      public CompKindExpression deepClone()
    • deepClone

      public abstract CompKindExpression deepClone(ComponentTypeSymbol component)
    • deepEquals

      public abstract boolean deepEquals(CompKindExpression compSymType)