org.eclipse.viatra.query.patternlanguage.typing

## Interface ITypeSystem

- All Known Implementing Classes:
    AbstractTypeSystem, EMFTypeSystem, ITypeSystem.NullTypeSystem

      public interface ITypeSystem

  A type system represents the types (classes, or references) provided by a modeling backend.
  No Implement:
    Do not implement directly, rely on `AbstractTypeSystem` instead.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `ITypeSystem.NullTypeSystem` An empty implementation of `ITypeSystem` that can be used by the abstract pattern language module.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Set<IInputKey>` | `addTypeInformation(java.util.Set<IInputKey> types, IInputKey newType)` Adds a new type descriptor to a collection of type descriptors, and minimizes it.
    `java.util.Set<IInputKey>` | `addTypeInformation(java.util.Set<IInputKey> types, java.util.Set<IInputKey> newTypes)`
    `IInputKey` | `extractColumnDescriptor(RelationType type, int columnIndex)` Extracts the model-specific column type of the given index from a RelationType declaration
    `IInputKey` | `extractTypeDescriptor(Type type)` Extracts the model-specific types from a Type declaration.
    `java.util.Set<IInputKey>` | `getCompatibleSupertypes(java.util.Set<IInputKey> types)` Returns a set of types that is a common supertype of a set of type parameters
    `boolean` | `isConformant(IInputKey expectedType, IInputKey actualType)` Decides whether the second type is compatible with the first one
    `boolean` | `isConformToRelationColumn(IInputKey relationType, int columnIndex, IInputKey columnType)` Decides whether the reference can have a selected type at its given column.
    `boolean` | `isValidType(Type type)` Returns whether the type declaration represents a valid, resolvable type for the selected type system.
    `java.util.Set<IInputKey>` | `minimizeTypeInformation(java.util.Set<IInputKey> types, boolean mergeWithSupertypes)` Reduces the type descriptor set by providing the most specific set of type descriptors inferrable for a selected types.
    `org.eclipse.xtext.common.types.JvmTypeReference` | `toJvmTypeReference(IInputKey type, org.eclipse.emf.ecore.EObject context)` Creates a type reference for model inference from a selected type.
    `java.lang.String` | `typeString(IInputKey type)` Converts a type object to a user-visible description string.

- - ### Method Detail

    - #### isConformant

          boolean isConformant(IInputKey expectedType,
                               IInputKey actualType)

      Decides whether the second type is compatible with the first one

    - #### isConformToRelationColumn

          boolean isConformToRelationColumn(IInputKey relationType,
                                            int columnIndex,
                                            IInputKey columnType)

      Decides whether the reference can have a selected type at its given column.

    - #### extractTypeDescriptor

          IInputKey extractTypeDescriptor(Type type)

      Extracts the model-specific types from a Type declaration.
      Parameters:
        `type` - either the `Type` or the `RelationType` instance
      Returns:
        model-specific type representation

    - #### extractColumnDescriptor

          IInputKey extractColumnDescriptor(RelationType type,
                                            int columnIndex)

      Extracts the model-specific column type of the given index from a RelationType declaration
      Parameters:
        `type` -

    - #### minimizeTypeInformation

          java.util.Set<IInputKey> minimizeTypeInformation(java.util.Set<IInputKey> types,
                                                           boolean mergeWithSupertypes)

      Reduces the type descriptor set by providing the most specific set of type descriptors inferrable for a selected types.
      Parameters:
        `types` - a collection of type definitions
        `mergeWithSupertypes` - if true, the collection is also minimized by calculating common supertypes
      Returns:
        the minimized set of type information
      Since:
        1.3

    - #### addTypeInformation

          java.util.Set<IInputKey> addTypeInformation(java.util.Set<IInputKey> types,
                                                      IInputKey newType)

      Adds a new type descriptor to a collection of type descriptors, and minimizes it. Equivalent of calling `#minimizeTypeInformation(Set)` with `types.add(newType)`, but might have a more efficient impementation.
      Parameters:
        `types` -
        `newType` -
      Returns:
        the minimized set of type information including the new type descriptor key
      Since:
        1.3

    - #### addTypeInformation

          java.util.Set<IInputKey> addTypeInformation(java.util.Set<IInputKey> types,
                                                      java.util.Set<IInputKey> newTypes)

      Since:
        1.3

    - #### toJvmTypeReference

          org.eclipse.xtext.common.types.JvmTypeReference toJvmTypeReference(IInputKey type,
                                                                             org.eclipse.emf.ecore.EObject context)

      Creates a type reference for model inference from a selected type.

    - #### typeString

          java.lang.String typeString(IInputKey type)

      Converts a type object to a user-visible description string.
      Parameters:
        `type` - either a `Type`, or a model-specific type instance
      Returns:
        the string representation of the selected type

    - #### getCompatibleSupertypes

          java.util.Set<IInputKey> getCompatibleSupertypes(java.util.Set<IInputKey> types)

      Returns a set of types that is a common supertype of a set of type parameters
      Since:
        1.3

    - #### isValidType

          boolean isValidType(Type type)

      Returns whether the type declaration represents a valid, resolvable type for the selected type system. A null type is invalid.
      Since:
        1.4