Class TypeCheck3AsTypeCalculator

  • All Implemented Interfaces:
    ITypeRelations

    public class TypeCheck3AsTypeCalculator
    extends TypeCalculator
    the TypeCalculator class using the TypeCheck3. While the TypeCheck3 should be used directly, this can be used to try the TypeCheck without major rewrites.
    • Field Detail

      • type4Ast

        @Deprecated
        protected Type4Ast type4Ast
        Deprecated.
      • typeTraverser

        @Deprecated
        protected de.monticore.visitor.ITraverser typeTraverser
        Deprecated.
    • Constructor Detail

      • TypeCheck3AsTypeCalculator

        @Deprecated
        public TypeCheck3AsTypeCalculator​(de.monticore.visitor.ITraverser typeTraverser,
                                          Type4Ast type4Ast,
                                          ILValueRelations lValueRelations)
        Deprecated.
        Parameters:
        typeTraverser - traverser filling type4Ast, language specific
        type4Ast - a map of types to be filled
        lValueRelations - is expression a variable?, language specific
      • TypeCheck3AsTypeCalculator

        @Deprecated
        public TypeCheck3AsTypeCalculator​(ILValueRelations lValueRelations)
        Deprecated.
        Parameters:
        lValueRelations - is expression a variable?, language specific
      • TypeCheck3AsTypeCalculator

        public TypeCheck3AsTypeCalculator()
    • Method Detail

      • compatible

        public boolean compatible​(SymTypeExpression left,
                                  SymTypeExpression right)
        Description copied from interface: ITypeRelations
        Function 3: Given two SymTypeExpressions super, sub: This function answers, whether the right type is a subtype of the left type in an assignment. (This allows to store/use values of type "sub" at all positions of type "super". Compatibility examples: compatible("int", "long") (in all directions) compatible("long", "int") (in all directions) compatible("double", "float") (in all directions) compatible("Person", "Student") (uni-directional)

        Incompatible: !compatible("double", "int") (in all directions)

        The concrete Typechecker has to decide on further issues, like !compatible("List<double>", "List<int>") where e.g. Java and OCL/P differ in their answers

        Specified by:
        compatible in interface ITypeRelations
        Overrides:
        compatible in class TypeCalculator
        Parameters:
        left - Super-Type
        right - Sub-Type (assignment-compatible to supertype?)

      • isSubtypeOf

        public boolean isSubtypeOf​(SymTypeExpression subType,
                                   SymTypeExpression superType)
        Description copied from interface: ITypeRelations
        determines if one SymTypeExpression is a subtype of another SymTypeExpression
        Specified by:
        isSubtypeOf in interface ITypeRelations
        Overrides:
        isSubtypeOf in class TypeCalculator
        Parameters:
        subType - the SymTypeExpression that could be a subtype of the other SymTypeExpression
        superType - the SymTypeExpression that could be a supertype of the other SymTypeExpression