org.eclipse.viatra.query.patternlanguage.emf.types

## Class EMFTypeSystem

- java.lang.Object
- - org.eclipse.viatra.query.patternlanguage.typing.AbstractTypeSystem
  - - org.eclipse.viatra.query.patternlanguage.emf.types.EMFTypeSystem

- All Implemented Interfaces:
    ITypeSystem

      public class EMFTypeSystem
      extends AbstractTypeSystem

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.viatra.query.patternlanguage.typing.ITypeSystem

      `ITypeSystem.NullTypeSystem`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static com.google.common.base.Function<IInputKey,org.eclipse.emf.ecore.EClassifier>` | `EXTRACT_CLASSIFIER` This function can be used to extract EClassifier instances from IInputKey instances.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EMFTypeSystem(org.apache.log4j.Logger logger)`

  - ### Method Summary

    All Methods Instance Methods Concrete 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` | `classifierToInputKey(org.eclipse.emf.ecore.EClassifier classifier)`
    `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
    `java.lang.Class<?>` | `getJavaClass(EDataTypeInSlotsKey key)`
    `java.lang.Class<?>` | `getJavaClass(JavaTransitiveInstancesKey javaKey)`
    `boolean` | `hasCommonSubtype(java.util.Set<IInputKey> typeKeys, java.lang.Iterable<org.eclipse.emf.ecore.EPackage> ePackages)`
    `boolean` | `isConformant(ClassType expectedType, ClassType actualType)`
    `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` | `isConformToRelationSource(ReferenceType relationType, ClassType sourceType)`
    `boolean` | `isConformToRelationTarget(ReferenceType relationType, ClassType targetType)`
    `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.

    - ### Methods inherited from class org.eclipse.viatra.query.patternlanguage.typing.AbstractTypeSystem

      `getWrapperClassForType, isValidType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EXTRACT_CLASSIFIER

          public static final com.google.common.base.Function<IInputKey,org.eclipse.emf.ecore.EClassifier> EXTRACT_CLASSIFIER

      This function can be used to extract EClassifier instances from IInputKey instances. If the IInputKey instance does not represent an EClassifier, null is returned
      Since:
        1.3

  - ### Constructor Detail

    - #### EMFTypeSystem

          @Inject
          public EMFTypeSystem(org.apache.log4j.Logger logger)

  - ### Method Detail

    - #### extractTypeDescriptor

          public IInputKey extractTypeDescriptor(Type type)

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

    - #### classifierToInputKey

          public IInputKey classifierToInputKey(org.eclipse.emf.ecore.EClassifier classifier)

    - #### extractColumnDescriptor

          public IInputKey extractColumnDescriptor(RelationType type,
                                                   int columnIndex)

      Description copied from interface: `ITypeSystem`
      Extracts the model-specific column type of the given index from a RelationType declaration

    - #### isConformant

          public boolean isConformant(IInputKey expectedType,
                                      IInputKey actualType)

      Description copied from interface: `ITypeSystem`
      Decides whether the second type is compatible with the first one

    - #### getJavaClass

          public java.lang.Class<?> getJavaClass(EDataTypeInSlotsKey key)

      Since:
        1.5

    - #### getJavaClass

          public java.lang.Class<?> getJavaClass(JavaTransitiveInstancesKey javaKey)

      Since:
        1.5

    - #### isConformant

          public boolean isConformant(ClassType expectedType,
                                      ClassType actualType)

    - #### isConformToRelationColumn

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

      Description copied from interface: `ITypeSystem`
      Decides whether the reference can have a selected type at its given column.

    - #### isConformToRelationSource

          public boolean isConformToRelationSource(ReferenceType relationType,
                                                   ClassType sourceType)

    - #### isConformToRelationTarget

          public boolean isConformToRelationTarget(ReferenceType relationType,
                                                   ClassType targetType)

    - #### toJvmTypeReference

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

      Description copied from interface: `ITypeSystem`
      Creates a type reference for model inference from a selected type.

    - #### minimizeTypeInformation

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

      Description copied from interface: `ITypeSystem`
      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

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

      Description copied from interface: `ITypeSystem`
      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.
      Returns:
        the minimized set of type information including the new type descriptor key
      Since:
        1.3

    - #### addTypeInformation

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

      Since:
        1.3

    - #### hasCommonSubtype

          public boolean hasCommonSubtype(java.util.Set<IInputKey> typeKeys,
                                          java.lang.Iterable<org.eclipse.emf.ecore.EPackage> ePackages)

      Returns:
        True if the given classifiers has a common subtype in the selected EPackages.
      Since:
        1.3

    - #### typeString

          public java.lang.String typeString(IInputKey type)

      Description copied from interface: `ITypeSystem`
      Converts a type object to a user-visible description string.
      Specified by:
        `typeString` in interface `ITypeSystem`
      Overrides:
        `typeString` in class `AbstractTypeSystem`
      Parameters:
        `type` - either a `Type`, or a model-specific type instance
      Returns:
        the string representation of the selected type

    - #### getCompatibleSupertypes

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

      Description copied from interface: `ITypeSystem`
      Returns a set of types that is a common supertype of a set of type parameters
      Since:
        1.3

    - #### isValidType

          public boolean isValidType(Type type)

      Description copied from interface: `ITypeSystem`
      Returns whether the type declaration represents a valid, resolvable type for the selected type system. A null type is invalid.
      Specified by:
        `isValidType` in interface `ITypeSystem`
      Overrides:
        `isValidType` in class `AbstractTypeSystem`