Class TypeCheck3AsTypeCalculator
- java.lang.Object
-
- de.monticore.types.check.TypeCalculator
-
- de.monticore.types.check.types3wrapper.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 Summary
Fields Modifier and Type Field Description protected Type4Asttype4AstDeprecated.protected de.monticore.visitor.ITraversertypeTraverserDeprecated.-
Fields inherited from class de.monticore.types.check.TypeCalculator
iDerive, iSynthesize, iTypeRelations
-
-
Constructor Summary
Constructors Constructor Description TypeCheck3AsTypeCalculator()TypeCheck3AsTypeCalculator(ILValueRelations lValueRelations)Deprecated.TypeCheck3AsTypeCalculator(de.monticore.visitor.ITraverser typeTraverser, Type4Ast type4Ast, ILValueRelations lValueRelations)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompatible(SymTypeExpression left, SymTypeExpression right)Function 3: Given two SymTypeExpressions super, sub: This function answers, whether the right type is a subtype of the left type in an assignment.booleanisSubtypeOf(SymTypeExpression subType, SymTypeExpression superType)determines if one SymTypeExpression is a subtype of another SymTypeExpression-
Methods inherited from class de.monticore.types.check.TypeCalculator
calculateInheritanceDistance, calculateInheritanceDistance, isBoolean, isByte, isChar, isDouble, isFloat, isInt, isIntegralType, isLong, isNumericType, isOfTypeForAssign, isShort, isString, isVoid, symTypeFromAST, symTypeFromAST, symTypeFromAST, symTypeFromAST, typeOf, typeOf
-
-
-
-
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 specifictype4Ast- a map of types to be filledlValueRelations- 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:ITypeRelationsFunction 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:
compatiblein interfaceITypeRelations- Overrides:
compatiblein classTypeCalculator- Parameters:
left- Super-Typeright- Sub-Type (assignment-compatible to supertype?)
-
isSubtypeOf
public boolean isSubtypeOf(SymTypeExpression subType, SymTypeExpression superType)
Description copied from interface:ITypeRelationsdetermines if one SymTypeExpression is a subtype of another SymTypeExpression- Specified by:
isSubtypeOfin interfaceITypeRelations- Overrides:
isSubtypeOfin classTypeCalculator- Parameters:
subType- the SymTypeExpression that could be a subtype of the other SymTypeExpressionsuperType- the SymTypeExpression that could be a supertype of the other SymTypeExpression
-
-