Package com.nomagic.magicdraw.uml2.util
Class CompatibilityUtil
- java.lang.Object
-
- com.nomagic.magicdraw.uml2.util.CompatibilityUtil
-
final class CompatibilityUtil extends java.lang.Object
Utility class for compatible types of features calculating.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
CompatibilityUtil.AnalysisTransition
Utility class for feature compatibility analysis.private static class
CompatibilityUtil.FeatureNode
Utility class for feature compatibility analysis.
-
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)
ReturnsFeatureNode
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.
-
-
-
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.
-
buildPaths
private static void buildPaths(@Nonnull CompatibilityUtil.AnalysisTransition current, @Nonnull java.util.List<CompatibilityUtil.AnalysisTransition> path, @Nonnull java.util.List<java.util.List<CompatibilityUtil.AnalysisTransition>> paths)
Builds possible paths.- Parameters:
current
- current transition.path
- a path.paths
- all paths.
-
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)
ReturnsFeatureNode
for the specified feature.- Parameters:
nodeMap
- node map.feature
- a feature.- Returns:
- feature node.
-
-