Interface ITypeRelations

All Known Implementing Classes:
TypeCalculator, TypeCheck3AsTypeCalculator, TypeRelations

@Deprecated public interface ITypeRelations
Deprecated.
This class is intended to provide typeChecking functionality with regard to relations of types
  • Method Details

    • compatible

      boolean compatible(SymTypeExpression left, SymTypeExpression right)
      Deprecated.
      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

      Parameters:
      left - Super-Type
      right - Sub-Type (assignment-compatible to supertype?)

    • isSubtypeOf

      boolean isSubtypeOf(SymTypeExpression subType, SymTypeExpression superType)
      Deprecated.
      determines if one SymTypeExpression is a subtype of another SymTypeExpression
      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
    • calculateInheritanceDistance

      int calculateInheritanceDistance(SymTypeExpression specific, SymTypeExpression general)
      Deprecated.
      calculate the minimum inheritance distance from the specific type to the general type e.g. C extends B extends A: object of type C has distance of 2 to object of type A object of type B has distance of 1 to object of type A object of type A has distance of 0 to object of type A
      Parameters:
      specific - the specific type
      general - the general type
      Returns:
      0 if they are the same type, else their minimum inheritance distance
    • calculateInheritanceDistance

      int calculateInheritanceDistance(SymTypePrimitive specific, SymTypePrimitive general)
      Deprecated.
    • isBoolean

      boolean isBoolean(SymTypeExpression type)
      Deprecated.
    • isInt

      boolean isInt(SymTypeExpression type)
      Deprecated.
    • isDouble

      boolean isDouble(SymTypeExpression type)
      Deprecated.
    • isFloat

      boolean isFloat(SymTypeExpression type)
      Deprecated.
    • isLong

      boolean isLong(SymTypeExpression type)
      Deprecated.
    • isChar

      boolean isChar(SymTypeExpression type)
      Deprecated.
    • isShort

      boolean isShort(SymTypeExpression type)
      Deprecated.
    • isByte

      boolean isByte(SymTypeExpression type)
      Deprecated.
    • isVoid

      boolean isVoid(SymTypeExpression type)
      Deprecated.
    • isString

      boolean isString(SymTypeExpression type)
      Deprecated.
    • isNumericType

      boolean isNumericType(SymTypeExpression type)
      Deprecated.
    • isIntegralType

      boolean isIntegralType(SymTypeExpression type)
      Deprecated.