Package com.nomagic.uml2.ext.jmi.helpers
Class ClassifierHelper
java.lang.Object
com.nomagic.uml2.ext.jmi.helpers.CoreHelper
com.nomagic.uml2.ext.jmi.helpers.ValueSpecificationHelper
com.nomagic.uml2.ext.jmi.helpers.ClassifierHelper
- Direct Known Subclasses:
InstanceSpecificationHelper
Utility class for working with UML classifiers
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
areEqualParameterTypes
(BehavioralFeature feature1, BehavioralFeature feature2) Method compares parameters and returns true if parameters types are equals.static boolean
areEqualParameterTypes
(BehavioralFeature feature1, BehavioralFeature feature2, boolean compareReturnParameter) Method compares parameters and returns true if parameters types are equals.static Iterator<Association>
associations
(Classifier classifier) Get iterator of association from given classifier.static Iterator<Association>
associationsIncludingInherited
(Classifier classifier) Collects connected directly and inherited associationsattributes
(Classifier classifier) Get iterator of Attribute from given classifier.static Classifier
checkForDerivedClassifier
(Collection<? extends Classifier> classifiers, Classifier checkFor) Checks if there are given classifier or some derived classifier in a given classifier collection.static void
collectBaseClassInheritableAttributes
(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned attributes from the given classifier.static Collection<Association>
collectCommonAssociations
(Collection<? extends Classifier> classifiers1, Collection<? extends Classifier> classifiers2) Collect association connected between given classifiersstatic void
collectDerivedClassifiersRecursively
(Collection<? extends Classifier> result, Classifier general) Collect all derived classifiers recursively (not only the direct children).static <T extends Classifier>
Collection<T>collectGeneralClassifiersAndRealizedInterfacesRecursively
(Classifier classifier, Collection<T> result) Collects all general classifiers including the indirect ones up to hierarchy top.static <T extends Classifier>
Collection<T>collectGeneralClassifiersRecursively
(Classifier classifier, Collection<T> result) Collects all general classifiers including the indirect ones up to hierarchy top.static void
collectInheritedAttributes
(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned attributes from the given classifier.static void
collectInheritedBehaviors
(BehavioredClassifier classifier, Collection<Behavior> result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned behaviors from the given classifierstatic void
collectInheritedEnumerationLiterals
(Enumeration enumeration, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned literals from the given enumeration.static void
collectInheritedExtensionPoints
(UseCase useCase, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned extension points from the given use case.static void
collectInheritedOperations
(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned operations from the given classifier.static void
collectInheritedPorts
(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned ports from the given classifier.static void
collectInheritedPureAttributes
(Classifier classifier, Collection result, boolean collectOwned) Collect inherited and owned attributes (just Property, not Port and etc) from the given classifier.static void
collectInheritedPureAttributes
(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned attributes (just Property, not Port and etc) from the given classifier.static void
collectInheritedRealizedInterfaces
(BehavioredClassifier classifier, Collection result, boolean collectOwned) Collect inherited and directly realized interfaces from the given classifierstatic void
collectInheritedReceptions
(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned receptions from the given classifierstatic void
collectInheritedRelations
(Classifier classifier, Collection<Element> result, boolean collectOwned) Collect inherited and directly connected relationships to the classifierstatic void
collectRealizedInterfaces
(Collection<? extends Classifier> classifiers, Collection<Interface> result) Collects realized interfaces by given classifiers.static Property
findAssociationEndForType
(Classifier classifier, Classifier type, String name) Looks for AssociationEnd connected to the given classifier 'classifier' which can be mapped into 'classifier' attribute with name 'name' and type 'type'.static Generalization
findGeneralization
(Classifier general, Classifier specific) Look for generalization between given classifiers.static InterfaceRealization
findInterfaceRealization
(BehavioredClassifier implementingClass, Interface contract) Look for interface realization between given class and interface.static List<EnumerationLiteral>
getAllLiterals
(Enumeration enumeration) Return owned and inherited enumeration literalsstatic Collection<TypedElement>
getAssociationEndOwnedByAssociation
(Classifier classifier) Returns a collection of properties connected to given classifier by associations.static Collection<Classifier>
getClassifiersIncludingDerived
(Collection<Classifier> generalClassifiers) Returns set of provided classifiers plus directly derived onesstatic Collection<Classifier>
getClassifiersIncludingDerivedRecursively
(Collection<? extends Classifier> classifiers) Returns all general classifiers including the indirect ones down to the leafs of the hierarchy.static List<Classifier>
getClassifiersIncludingGeneralRecursively
(Classifier classifier) Returns all general classifiers including the indirect ones up to hierarchy top.static Collection<Classifier>
getClassifiersIncludingGeneralRecursively
(Collection<? extends Classifier> classifiers) Returns all general classifiers including the indirect ones up to hierarchy top.static Collection<Classifier>
getDerivedClassifiers
(Classifier general) Return classifiers derived directly from the given classifierstatic Collection<Classifier>
Get all derived classifiers for given classifier.static List<Classifier>
getGeneralClassifiers
(Classifier classifier) Returns general classifiers from which the given classifier is directly derived.static List<Classifier>
getGeneralClassifiersRecursively
(Classifier classifier) Returns all general classifiers including the indirect ones up to hierarchy top.static List<BehavioredClassifier>
getImplementedClasses
(Interface anInterface) Gets classifiers which realize (implement) a given interface.static int
getInheritanceDeep
(Classifier classifier) Gets the deep of inherited tree for classifier.getParameters
(BehavioralFeature feature) Returns parameters without return parametergetPropertiesWithoutRedefined
(Classifier classifier) Gets owned and inherited properties without redefined ones.static Collection<Interface>
getProvided
(Class component) Component provided interfaces collection consists of: 1) interfaces, realized by the component throughInterfaceRealization
, 2) provided interfaces of the component ports, 3) component port types which are interfaces.getRealizedInterfaces
(BehavioredClassifier classifier) Collects realized interfaces by the given classifier.static Parameter
getReturnParameter
(BehavioralFeature feature) Return parameter of given behaviour feature.static Parameter
getReturnParameter
(BehavioralFeature feature, boolean create) Return parameter of given behaviour feature.static Parameter
getReturnParameter
(Behavior behavior, boolean create) Return parameter of given behaviour.getReturnParameters
(BehavioralFeature feature) Returns parameters without return parameterstatic boolean
isBehavioralFeatureEqual
(BehavioralFeature feature1, BehavioralFeature feature2, boolean compareReturnParameter) Compare the two given features by name and by parametersstatic boolean
isClassifierOfType
(Classifier classifier, Classifier type) Tests if given classifier isTypeOf (equals or is derived) given type.static boolean
isClassifierOfType
(Collection<? extends Classifier> classifiers, Classifier type) Tests if there is at least one classifier among given ones which isTypeOf (equals or is derived) given type.static boolean
isDerivedClassifier
(Classifier parent, Classifier child) Checks if child is derived from parent by generalizationstatic boolean
isDerivedOrRealizes
(Classifier classifier, Classifier type) Checks if classifier is derived from given type or realizes the given type.static boolean
isLegalInheritance
(Classifier parent, Classifier child) Checks if new generalization relationship is legal between given parent and child.static boolean
isLegalInheritance
(Classifier parent, Classifier child, Collection<? extends Relationship> ignore) Checks if new generalization relationship is legal between given parent and child.static boolean
isOperationEqual
(Operation op1, Operation op2) Compare the two given operation.static boolean
isReturnParameter
(Parameter parameter) static boolean
isSameOrDerivedClassifier
(Classifier parent, Classifier child) Checks if given classifier "child" is same as "parent" or is derived from "parent".static boolean
isSameOrRedefined
(Property first, Property second) Check if given first property is the same as second property or first property is redefined by second propertystatic boolean
isSecondTypeCompatibleToFirst
(Type firstType, Type secondType, boolean checkRealizedInterfaces) Indicates if second parameter type is compatible to the first (is same type or a subtype).static boolean
isSecondTypeCompatibleToFirst
(Type firstType, Collection<Type> secondType, boolean checkRealizedInterfaces) Indicates at least one type from second type collection is compatible to the first type.operations
(Classifier classifier) Get iterator of operations from given classifier.ports
(Classifier classifier) Get iterator of port from given classifier.pureAttributes
(Classifier classifier) Get iterator of pure attribute from given classifier.receptions
(Classifier classifier) Get iterator of reception from given classifier.static Collection<Classifier>
removeDerivedClassifiers
(Collection<Classifier> classifiers) Given a collection of classifiers, returns a collection without derived classifiers in their generalization hierarchy.static void
removeRedefined
(Collection<? extends RedefinableElement> major, Collection<? extends RedefinableElement>... additional) Removes redefined elements from a given major collection.Methods inherited from class com.nomagic.uml2.ext.jmi.helpers.ValueSpecificationHelper
cloneValueSpecification, createValueSpecification, createValueSpecification, createValueSpecification, createValueSpecification, createValueSpecification, getValueSpecificationClass, getValueSpecificationClass, getValueSpecificationValue, getValueString, isValueSpecificationClassElementValue, setValueDisposeIfNeeded, setValueSpecificationValue, setValueSpecificationValue, setValueSpecificationValue
Methods inherited from class com.nomagic.uml2.ext.jmi.helpers.CoreHelper
areElementsEditable, canAddChild, canAssignName, canAssignName, canAssignName, canMoveChildInto, canMoveChildInto, collectRelationships, collectRelationships, collectRelationshipsByType, collectRelationshipsIncludeIndirect, dispose, findAcceptableParentFor, findAcceptableParentFor, findOwnerOfStrictType, findOwnerOfStrictTypeIncludingItself, findOwnerOfType, findOwnerOfTypeIncludingItself, findParent, findParent, getAdditionalElementsIterator, getClientElement, getComment, getCommentElement, getCommentElementOrCreate, getDependentClients, getDependentSuppliers, getFirstMemberEnd, getMultiplicity, getName, getOppositeEnd, getOwnedElementsIncludingAdditional, getSecondMemberEnd, getSupplierElement, getSupplierElement, getSupplierElements, hasParentIn, isChildOf, isDocumentationComment, isMultiplicityMany, isParentOf, isParentOf, isRelationship, isRelationshipAlwaysInClient, parseMultiplicityString, setClientElement, setComment, setCommentElement, setConstraintText, setConstraintText, setMultiplicity, setMultiplicity, setSupplierElement
-
Constructor Details
-
ClassifierHelper
public ClassifierHelper()
-
-
Method Details
-
getDerivedClassifiersRecursively
Get all derived classifiers for given classifier. Result does not include the given classifier.- Parameters:
general
- given classifier to collect specific classifiers for- Returns:
- collection of all derived classifiers
-
getClassifiersIncludingDerivedRecursively
public static Collection<Classifier> getClassifiersIncludingDerivedRecursively(Collection<? extends Classifier> classifiers) Returns all general classifiers including the indirect ones down to the leafs of the hierarchy. Result includes given classifiers.- Parameters:
classifiers
- classifiers- Returns:
- general elements
- See Also:
-
collectDerivedClassifiersRecursively
public static void collectDerivedClassifiersRecursively(Collection<? extends Classifier> result, Classifier general) Collect all derived classifiers recursively (not only the direct children).- Parameters:
result
- collection of all derived classifiersgeneral
- general classifier
-
getDerivedClassifiers
Return classifiers derived directly from the given classifier- Parameters:
general
- general classifier- Returns:
- collection of derived classifiers
-
getClassifiersIncludingDerived
public static Collection<Classifier> getClassifiersIncludingDerived(Collection<Classifier> generalClassifiers) Returns set of provided classifiers plus directly derived ones- Parameters:
generalClassifiers
- classifier collection- Returns:
- collection of classifiers including derived
- See Also:
-
getGeneralClassifiers
Returns general classifiers from which the given classifier is directly derived.- Parameters:
classifier
- classifier- Returns:
- direct general classifiers
- See Also:
-
getGeneralClassifiersRecursively
Returns all general classifiers including the indirect ones up to hierarchy top. Result does not include the given classifier.- Parameters:
classifier
- classifier- Returns:
- general elements
- See Also:
-
getClassifiersIncludingGeneralRecursively
Returns all general classifiers including the indirect ones up to hierarchy top. Result includes given classifier.- Parameters:
classifier
- classifier- Returns:
- general elements
- See Also:
-
getClassifiersIncludingGeneralRecursively
public static Collection<Classifier> getClassifiersIncludingGeneralRecursively(Collection<? extends Classifier> classifiers) Returns all general classifiers including the indirect ones up to hierarchy top. Result includes given classifiers.- Parameters:
classifiers
- classifier- Returns:
- general elements
- See Also:
-
collectGeneralClassifiersRecursively
public static <T extends Classifier> Collection<T> collectGeneralClassifiersRecursively(Classifier classifier, Collection<T> result) Collects all general classifiers including the indirect ones up to hierarchy top.- Parameters:
classifier
- classifierresult
- result collection- Returns:
- result collection
-
collectGeneralClassifiersAndRealizedInterfacesRecursively
public static <T extends Classifier> Collection<T> collectGeneralClassifiersAndRealizedInterfacesRecursively(Classifier classifier, Collection<T> result) Collects all general classifiers including the indirect ones up to hierarchy top. Also collects all realized interfaces from the collected general classifiers.- Parameters:
classifier
- classifierresult
- result collection- Returns:
- result collection
-
getInheritanceDeep
Gets the deep of inherited tree for classifier. Used to sort stereotypes by inheritance.- Parameters:
classifier
- classifier- Returns:
- result deep
-
isLegalInheritance
Checks if new generalization relationship is legal between given parent and child. Legal if it does not create cycle and child isKindOf parent.- Parameters:
parent
- parent element of generalization.child
- child element of generalization.- Returns:
- true - if generalization is legal, otherwise return false.
-
isLegalInheritance
public static boolean isLegalInheritance(Classifier parent, Classifier child, @CheckForNull Collection<? extends Relationship> ignore) Checks if new generalization relationship is legal between given parent and child. Legal if it does not create cycle and child isKindOf parent.- Parameters:
parent
- parent element of generalization.child
- child element of generalization.ignore
- a collection of classifiers that should be ignored.- Returns:
- true - if generalization is legal, otherwise return false.
-
findAssociationEndForType
@CheckForNull public static Property findAssociationEndForType(Classifier classifier, Classifier type, String name) Looks for AssociationEnd connected to the given classifier 'classifier' which can be mapped into 'classifier' attribute with name 'name' and type 'type'.- Parameters:
classifier
- the given classifier.type
- the type of the association end.name
- the name of the association end.- Returns:
- found AssociationEnd or null.
-
getReturnParameter
Return parameter of given behaviour feature. A new parameter is created if feature does not have it.- Parameters:
feature
- a given feature- Returns:
- return parameter (existing one or created)
-
isReturnParameter
- Parameters:
parameter
- parameter- Returns:
- true if given Parameter has return kind
-
getReturnParameter
Return parameter of given behaviour feature. A new parameter may be created if feature does not have it.- Parameters:
feature
- a given featurecreate
- creates a new parameter if needed- Returns:
- return parameter
-
getReturnParameter
Return parameter of given behaviour. A new parameter may be created if behavior does not have it.- Parameters:
behavior
- a given behaviorcreate
- creates a new parameter if needed- Returns:
- return parameter
-
operations
Get iterator of operations from given classifier.- Parameters:
classifier
- The given classifier.- Returns:
- iterator
-
receptions
Get iterator of reception from given classifier.- Parameters:
classifier
- The given classifier.- Returns:
- iterator
-
attributes
Get iterator of Attribute from given classifier.- Parameters:
classifier
- The given classifier.- Returns:
- iterator
-
ports
Get iterator of port from given classifier.- Parameters:
classifier
- The given classifier.- Returns:
- iterator
-
pureAttributes
Get iterator of pure attribute from given classifier.- Parameters:
classifier
- The given classifier.- Returns:
- iterator
-
associations
Get iterator of association from given classifier.- Parameters:
classifier
- The given classifier.- Returns:
- iterator
-
associationsIncludingInherited
Collects connected directly and inherited associations- Parameters:
classifier
- classifier
-
collectInheritedAttributes
public static void collectInheritedAttributes(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned attributes from the given classifier.- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectBaseClassInheritableAttributes
public static void collectBaseClassInheritableAttributes(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned attributes from the given classifier.- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectInheritedPureAttributes
public static void collectInheritedPureAttributes(Classifier classifier, Collection result, boolean collectOwned) Collect inherited and owned attributes (just Property, not Port and etc) from the given classifier. Private attributes are collected.- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also owned
-
collectInheritedPureAttributes
public static void collectInheritedPureAttributes(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned attributes (just Property, not Port and etc) from the given classifier.- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectInheritedRelations
public static void collectInheritedRelations(Classifier classifier, Collection<Element> result, boolean collectOwned) Collect inherited and directly connected relationships to the classifier- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also owned
-
getAssociationEndOwnedByAssociation
Returns a collection of properties connected to given classifier by associations. Properties are owned by Association- Parameters:
classifier
- the given classifier- Returns:
- collection of properties
-
collectInheritedPorts
public static void collectInheritedPorts(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned ports from the given classifier.- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectInheritedExtensionPoints
public static void collectInheritedExtensionPoints(UseCase useCase, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned extension points from the given use case.- Parameters:
useCase
- use caseresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectInheritedOperations
public static void collectInheritedOperations(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned operations from the given classifier.- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectInheritedBehaviors
public static void collectInheritedBehaviors(BehavioredClassifier classifier, Collection<Behavior> result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned behaviors from the given classifier- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectInheritedReceptions
public static void collectInheritedReceptions(Classifier classifier, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned receptions from the given classifier- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
collectInheritedRealizedInterfaces
public static void collectInheritedRealizedInterfaces(BehavioredClassifier classifier, Collection result, boolean collectOwned) Collect inherited and directly realized interfaces from the given classifier- Parameters:
classifier
- classifierresult
- result collectioncollectOwned
- if true, collected also owned
-
getAllLiterals
Return owned and inherited enumeration literals- Parameters:
enumeration
- enumeration- Returns:
- literals
-
collectInheritedEnumerationLiterals
public static void collectInheritedEnumerationLiterals(Enumeration enumeration, Collection result, boolean collectOwned, boolean collectPrivate) Collect inherited and owned literals from the given enumeration.- Parameters:
enumeration
- enumerationresult
- result collectioncollectOwned
- if true, collected also ownedcollectPrivate
- if false, do not collect private
-
isClassifierOfType
Tests if given classifier isTypeOf (equals or is derived) given type.- Parameters:
classifier
- the give classifiertype
- the given type- Returns:
- true if classifier isTypeOf type
-
isClassifierOfType
public static boolean isClassifierOfType(Collection<? extends Classifier> classifiers, Classifier type) Tests if there is at least one classifier among given ones which isTypeOf (equals or is derived) given type.- Parameters:
classifiers
- the given classifiertype
- the given type- Returns:
- true if classifiers contains at least one classifier which isTypeOf type
-
getRealizedInterfaces
Collects realized interfaces by the given classifier.- Parameters:
classifier
- given classifier- Returns:
- a collection of realized interfaces(may be empty)
-
checkForDerivedClassifier
@CheckForNull public static Classifier checkForDerivedClassifier(Collection<? extends Classifier> classifiers, Classifier checkFor) Checks if there are given classifier or some derived classifier in a given classifier collection.- Parameters:
classifiers
- collection of classifiers to look incheckFor
- target classifier- Returns:
- returns classifier which equals to the given or is derived
-
isSameOrDerivedClassifier
public static boolean isSameOrDerivedClassifier(@CheckForNull Classifier parent, @CheckForNull Classifier child) Checks if given classifier "child" is same as "parent" or is derived from "parent".- Parameters:
parent
- parent classifierchild
- child classifier- Returns:
- true if same or derived
- See Also:
-
isDerivedClassifier
public static boolean isDerivedClassifier(@CheckForNull Classifier parent, @CheckForNull Classifier child) Checks if child is derived from parent by generalization- Parameters:
parent
- parentchild
- possible parent- Returns:
- true if derived
-
isDerivedOrRealizes
Checks if classifier is derived from given type or realizes the given type.- Parameters:
classifier
- classifier to checktype
- type- Returns:
- true if derived or realizes
-
isSecondTypeCompatibleToFirst
public static boolean isSecondTypeCompatibleToFirst(Type firstType, Collection<Type> secondType, boolean checkRealizedInterfaces) Indicates at least one type from second type collection is compatible to the first type.- Parameters:
firstType
- type to which types should be checked.secondType
- types which should be compared to the first type.checkRealizedInterfaces
- indicates if realized interfaces should be taken into account when checking type compatibility.- Returns:
- true if parameters are compatible, false otherwise.
-
isSecondTypeCompatibleToFirst
public static boolean isSecondTypeCompatibleToFirst(@CheckForNull Type firstType, @CheckForNull Type secondType, boolean checkRealizedInterfaces) Indicates if second parameter type is compatible to the first (is same type or a subtype).- Parameters:
firstType
- parameter, to which the 2nd parameter must be compatible.secondType
- parameter, which should be compatible to the 1st.checkRealizedInterfaces
- indicates if realized interfaces should be taken into account when checking type compatibility.- Returns:
- true if parameters are compatible, false otherwise.
-
collectRealizedInterfaces
public static void collectRealizedInterfaces(Collection<? extends Classifier> classifiers, Collection<Interface> result) Collects realized interfaces by given classifiers.- Parameters:
classifiers
- classifiers for which realized interfaces should be collected.result
- a set in which realized interfaces should be collected.
-
removeDerivedClassifiers
Given a collection of classifiers, returns a collection without derived classifiers in their generalization hierarchy.- Parameters:
classifiers
- classifier hierarchy to optimize- Returns:
- optimized classifier hierarchy.
-
isOperationEqual
Compare the two given operation.- Parameters:
op1
- First operation.op2
- Second operation.- Returns:
- boolean
-
isBehavioralFeatureEqual
public static boolean isBehavioralFeatureEqual(BehavioralFeature feature1, BehavioralFeature feature2, boolean compareReturnParameter) Compare the two given features by name and by parameters- Parameters:
feature1
- first featurefeature2
- second featurecompareReturnParameter
- take into account return parameter(s)- Returns:
- true if names are equals and parameters are equals
-
areEqualParameterTypes
public static boolean areEqualParameterTypes(BehavioralFeature feature1, BehavioralFeature feature2) Method compares parameters and returns true if parameters types are equals.- Parameters:
feature1
- feature to be compared with.feature2
- feature to be compared with.- Returns:
- true if parameters are equals.
-
areEqualParameterTypes
public static boolean areEqualParameterTypes(BehavioralFeature feature1, BehavioralFeature feature2, boolean compareReturnParameter) Method compares parameters and returns true if parameters types are equals.- Parameters:
feature1
- feature to be compared with.feature2
- feature to be compared with.compareReturnParameter
- take into account return parameter(s)- Returns:
- true if parameters are equals.
-
findInterfaceRealization
@CheckForNull public static InterfaceRealization findInterfaceRealization(BehavioredClassifier implementingClass, Interface contract) Look for interface realization between given class and interface.- Parameters:
implementingClass
- classcontract
- interface
-
findGeneralization
@CheckForNull public static Generalization findGeneralization(Classifier general, Classifier specific) Look for generalization between given classifiers.- Parameters:
general
- general classifierspecific
- specific classifier
-
getParameters
Returns parameters without return parameter- Parameters:
feature
- the given feature
-
getReturnParameters
Returns parameters without return parameter- Parameters:
feature
- the given feature
-
collectCommonAssociations
public static Collection<Association> collectCommonAssociations(Collection<? extends Classifier> classifiers1, Collection<? extends Classifier> classifiers2) Collect association connected between given classifiers- Parameters:
classifiers1
- one classifiers collectionclassifiers2
- second classifiers collection- Returns:
- common Associations between two collections of classifiers
-
getProvided
Component provided interfaces collection consists of: 1) interfaces, realized by the component throughInterfaceRealization
, 2) provided interfaces of the component ports, 3) component port types which are interfaces.- Returns:
- provided interfaces.
-
getImplementedClasses
Gets classifiers which realize (implement) a given interface.- Parameters:
anInterface
- an interface for which to get classifiers.- Returns:
- list of classifiers which realize a given interface.
-
removeRedefined
public static void removeRedefined(Collection<? extends RedefinableElement> major, Collection<? extends RedefinableElement>... additional) Removes redefined elements from a given major collection. Major collection is a result. Additional collections are optional and are used only for redefined elements collecting- Parameters:
major
- elements to remove redefined elements fromadditional
- elements to remove redefined elements from major
-
isSameOrRedefined
public static boolean isSameOrRedefined(@CheckForNull Property first, @CheckForNull Property second) Check if given first property is the same as second property or first property is redefined by second property- Parameters:
first
- first propertysecond
- second property- Returns:
- first is the same as second or is redefined by second
-
getPropertiesWithoutRedefined
Gets owned and inherited properties without redefined ones.- Parameters:
classifier
- classifiers from which properties will be collected- Returns:
- owned and inherited properties without redefined ones.
-