Class CompatibilityUtil


  • final class CompatibilityUtil
    extends java.lang.Object
    Utility class for compatible types of features calculating.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CompatibilityUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void addToResult​(java.util.Collection<org.eclipse.emf.ecore.EClassifier> result, org.eclipse.emf.ecore.EClassifier type, org.eclipse.emf.ecore.EStructuralFeature feature)
      Adds to the result collection appropriate type.
      private static void buildPaths​(CompatibilityUtil.AnalysisTransition current, java.util.List<CompatibilityUtil.AnalysisTransition> path, java.util.List<java.util.List<CompatibilityUtil.AnalysisTransition>> paths)
      Builds possible paths.
      static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getCompatibleTypes​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns Collection of EClassifiers which instances can be set as values to the specified feature to an instance of the type eClass.
      private static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getCompatibleTypesInternal​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature feature, java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> visited)
      Returns Collection of EClassifiers which instances can be set as values to the specified feature to an instance of the type eClass.
      private static CompatibilityUtil.FeatureNode getFeatureNode​(java.util.Map<org.eclipse.emf.ecore.EStructuralFeature,​CompatibilityUtil.FeatureNode> nodeMap, org.eclipse.emf.ecore.EStructuralFeature feature)
      Returns FeatureNode for the specified feature.
      private static boolean isSkip​(org.eclipse.emf.ecore.EStructuralFeature rootFeature, org.eclipse.emf.ecore.EStructuralFeature currentFeature)
      Returns true if the specified current feature should be skipped from analysis.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompatibilityUtil

        private CompatibilityUtil()
    • Method Detail

      • getCompatibleTypes

        @Nonnull
        public static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getCompatibleTypes​(@Nonnull
                                                                                                 org.eclipse.emf.ecore.EClass eClass,
                                                                                                 @Nonnull
                                                                                                 org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns Collection of EClassifiers which instances can be set as values to the specified feature to an instance of the type eClass.
        Parameters:
        eClass - EClass object which reference should be analyzed.
        feature - a structural feature which should be analyzed.
        Returns:
        compatible type.
        Throws:
        java.lang.IllegalArgumentException - if the specified EClass is not from UML package or if the specified feature is not contained by the class.
      • getCompatibleTypesInternal

        @Nonnull
        private static java.util.Collection<org.eclipse.emf.ecore.EClassifier> getCompatibleTypesInternal​(@Nonnull
                                                                                                          org.eclipse.emf.ecore.EClass eClass,
                                                                                                          @Nonnull
                                                                                                          org.eclipse.emf.ecore.EStructuralFeature feature,
                                                                                                          @Nonnull
                                                                                                          java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> visited)
        Returns Collection of EClassifiers which instances can be set as values to the specified feature to an instance of the type eClass.
        Parameters:
        eClass - EClass object which reference should be analyzed.
        feature - a structural feature which should be analyzed.
        Returns:
        compatible type.
        Throws:
        java.lang.IllegalArgumentException - if the specified EClass is not from UML package or if the specified feature is not contained by the class.
      • addToResult

        private static void addToResult​(@Nonnull
                                        java.util.Collection<org.eclipse.emf.ecore.EClassifier> result,
                                        @CheckForNull
                                        org.eclipse.emf.ecore.EClassifier type,
                                        @CheckForNull
                                        org.eclipse.emf.ecore.EStructuralFeature feature)
        Adds to the result collection appropriate type.
        Parameters:
        result - a result collection.
        type - a type.
        feature - a feature.
      • isSkip

        private static boolean isSkip​(org.eclipse.emf.ecore.EStructuralFeature rootFeature,
                                      org.eclipse.emf.ecore.EStructuralFeature currentFeature)
        Returns true if the specified current feature should be skipped from analysis.
        Parameters:
        rootFeature - a root feature.
        currentFeature - a feature that is affected if the root feature would be modified.
        Returns:
        true if should be skipped.
      • getFeatureNode

        @Nonnull
        private static CompatibilityUtil.FeatureNode getFeatureNode​(@Nonnull
                                                                    java.util.Map<org.eclipse.emf.ecore.EStructuralFeature,​CompatibilityUtil.FeatureNode> nodeMap,
                                                                    @Nonnull
                                                                    org.eclipse.emf.ecore.EStructuralFeature feature)
        Returns FeatureNode for the specified feature.
        Parameters:
        nodeMap - node map.
        feature - a feature.
        Returns:
        feature node.