Class Features
java.lang.Object
com.dassault_systemes.modeler.kerml.model.Features
Utility class to work with
Feature-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Collection<Type>>
TcollectAllFeaturingTypes(Feature feature, T collected) Collects all featuring types of the feature recursively.static TypegetContainingTypeOrContext(Type context, Feature feature) Extracts a type containing a given feature from a given context.static StringgetEffectiveName(Feature feature, Function<Feature, String> nameFunction) Returns the effective name of the feature using the given name function.static FeaturegetOwningFeatureOfAnonymousFeature(Feature anonymousFeature) Returns the owning feature of an anonymous feature.static FeaturegetRedefiningFeatureInType(Feature feature, Type type) Get Feature of the given type that is the same or redefined that is provided.static booleanisAnonymousFeature(Feature feature) Checks whether the feature is anonymous.static booleanisInheritedFromType(Feature feature, Type type) Checks whether the feature is inherited from the given type.
-
Constructor Details
-
Features
public Features()
-
-
Method Details
-
getEffectiveName
@CheckForNull public static String getEffectiveName(Feature feature, Function<Feature, String> nameFunction) Returns the effective name of the feature using the given name function.- Parameters:
feature- the featurenameFunction- function extracting a name from the feature- Returns:
- effective name, or null if none found
-
getContainingTypeOrContext
Extracts a type containing a given feature from a given context. It is either one of Feature::type if context is a Feature, or passed context itself. (must-precondition - given feature belong to "context.feature")- Parameters:
context- contextfeature- feature- Returns:
- type of context to which the given feature belongs
-
isInheritedFromType
Checks whether the feature is inherited from the given type.- Parameters:
feature- the featuretype- the type to check against- Returns:
- true if the feature is inherited from the type
-
collectAllFeaturingTypes
Collects all featuring types of the feature recursively.- Type Parameters:
T- collection type- Parameters:
feature- the featurecollected- collection to populate- Returns:
- the populated collection
-
getRedefiningFeatureInType
Get Feature of the given type that is the same or redefined that is provided. Example: Have Calc defined: Inc { in x; x+1} and call attribute my = Inc(5); Feature is x defined in Inc calc Type is InvocationExpression calling it, it has x feature as input (value 5). Methods returns if Invocation x (feature) is sameOrRedefined as calc x (feature).- Parameters:
feature- feature to look fortype- type in which to look for provided feature- Returns:
- feature of a type
-
isAnonymousFeature
Checks whether the feature is anonymous. A feature is anonymous if it is a plain Feature and its owning relationship is not an OwningMembership.- Parameters:
feature- the feature- Returns:
- true if anonymous
-
getOwningFeatureOfAnonymousFeature
Returns the owning feature of an anonymous feature.- Parameters:
anonymousFeature- anonymous feature- Returns:
- owning feature, or null
-