Class Redefinitions
java.lang.Object
com.dassault_systemes.modeler.kerml.model.Redefinitions
Utility class to work with
Redefinition-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddRedefined(Feature redefining, Feature redefined) Adds a redefined feature to the given redefining feature.static booleananySameOrRedefined(Feature redefining, Collection<? extends Feature> redefined) Checks whether the redefining feature is the same as or redefines any feature in the given collection.static <T extends Collection<Feature>>
voidcollectRedefined(Feature redefining, T result) Collects all redefined features of the given feature into the provided collection.static Collection<Feature> collectRedefinedWithSelf(Feature feature) Returns all redefined features including the feature itself.static FeaturecreateRedefining(Feature redefined, Namespace namespace) Creates a new redefining feature for the given redefined feature.static FeaturefirstRedefined(Feature redefining) Returns the first directly redefined feature of the given feature.static voidforEachRedefined(Feature redefining, Consumer<Feature> consumer) Applies the given consumer to each redefined feature of the redefining feature.getDirectlyRedefined(Feature redefining) Returns the directly redefined features of the given feature.static FeaturegetOrCreateOwnedRedefining(Type type, Feature redefined) Returns the owned redefining feature, creating one if necessary.static FeaturegetOrCreateOwnedRedefining(Type type, Feature redefined, Supplier<org.eclipse.emf.ecore.EClass> redefiningECLassSupplier) Returns the owned redefining feature, creating one if necessary, using the supplied EClass.static FeaturegetOwnedRedefining(Type type, Feature redefined) Returns the owned feature of the type that redefines the given feature.getRedefined(Feature redefining) Returns all redefined features of the given feature.static FeaturegetRedefiningOrSame(Type type, Feature redefined) Returns the redefining feature of the type, or the feature itself if none exists.static booleanisRedefined(Feature redefining, Feature redefined) Checks whether the redefining feature redefines the given feature.static booleanisSameOrRedefined(Feature redefining, Feature redefined) Checks whether the redefining feature is the same as or redefines the given feature.static FeaturematchSelfOrRedefined(Feature redefining, Predicate<Feature> filter) Returns the first feature that matches the predicate, searching the feature and its redefined chain.static voidremoveRedefined(Collection<? extends Feature> features) Removes all redefined features from the given collection.static voidsetAllRedefined(Feature redefiningFeature, List<List<Feature>> redefined, boolean set) Set redefined features of given redefining feature.static voidsetFirsRedefined(Feature redefining, List<? extends Feature> redefined, boolean set) Set redefined feature of given redefining feature.static voidsetRedefined(Feature redefining, Feature redefined) Sets the redefined feature of the given redefining feature.static voidsetRedefined(Feature redefining, List<Feature> redefined) Sets the redefined features of the given redefining feature.static voidtraverseRedefinedFeaturesRecursively(Feature feature, Predicate<Feature> predicate) Traverse redefined features recursively.
-
Constructor Details
-
Redefinitions
public Redefinitions()
-
-
Method Details
-
firstRedefined
Returns the first directly redefined feature of the given feature.- Parameters:
redefining- the feature that redefines another- Returns:
- the first redefined feature, or null if none exist
-
removeRedefined
Removes all redefined features from the given collection.- Parameters:
features- the features to modify
-
isSameOrRedefined
Checks whether the redefining feature is the same as or redefines the given feature.- Parameters:
redefining- the redefining featureredefined- the feature being checked- Returns:
- true if redefining is the same as or redefines redefined
-
anySameOrRedefined
public static boolean anySameOrRedefined(Feature redefining, Collection<? extends Feature> redefined) Checks whether the redefining feature is the same as or redefines any feature in the given collection.- Parameters:
redefining- the redefining featureredefined- collection of features to check- Returns:
- true if any match
-
isRedefined
Checks whether the redefining feature redefines the given feature.- Parameters:
redefining- the redefining featureredefined- the feature being checked- Returns:
- true if redefining redefines redefined
-
collectRedefinedWithSelf
Returns all redefined features including the feature itself.- Parameters:
feature- the feature to inspect- Returns:
- collection of redefined features including self
-
collectRedefined
Collects all redefined features of the given feature into the provided collection.- Type Parameters:
T- collection type- Parameters:
redefining- the redefining featureresult- the collection to fill
-
getRedefined
Returns all redefined features of the given feature.- Parameters:
redefining- the redefining feature- Returns:
- list of redefined features
-
getDirectlyRedefined
Returns the directly redefined features of the given feature.- Parameters:
redefining- the redefining feature- Returns:
- list of directly redefined features
-
setRedefined
Sets the redefined feature of the given redefining feature.- Parameters:
redefining- the redefining featureredefined- the redefined feature, or null
-
setRedefined
Sets the redefined features of the given redefining feature.- Parameters:
redefining- the redefining featureredefined- list of redefined features
-
addRedefined
Adds a redefined feature to the given redefining feature.- Parameters:
redefining- the redefining featureredefined- the feature to add as redefined
-
forEachRedefined
Applies the given consumer to each redefined feature of the redefining feature.- Parameters:
redefining- the redefining featureconsumer- action applied to each redefined feature
-
createRedefining
Creates a new redefining feature for the given redefined feature.- Parameters:
redefined- the feature to redefinenamespace- the namespace where the new feature will be created- Returns:
- the newly created redefining feature
-
matchSelfOrRedefined
@CheckForNull public static Feature matchSelfOrRedefined(Feature redefining, Predicate<Feature> filter) Returns the first feature that matches the predicate, searching the feature and its redefined chain.- Parameters:
redefining- the starting featurefilter- predicate to test- Returns:
- matching feature, or null if none found
-
traverseRedefinedFeaturesRecursively
public static void traverseRedefinedFeaturesRecursively(Feature feature, Predicate<Feature> predicate) Traverse redefined features recursively.- Parameters:
feature- feature to start.predicate- test redefined feature, return false to abort operation.
-
getOwnedRedefining
Returns the owned feature of the type that redefines the given feature.- Parameters:
type- the type whose features are inspectedredefined- the feature being redefined- Returns:
- the redefining feature, or null if none found
-
getOrCreateOwnedRedefining
Returns the owned redefining feature, creating one if necessary.- Parameters:
type- the type whose features are modifiedredefined- the feature to redefine- Returns:
- the existing or newly created redefining feature
-
getOrCreateOwnedRedefining
public static Feature getOrCreateOwnedRedefining(Type type, Feature redefined, Supplier<org.eclipse.emf.ecore.EClass> redefiningECLassSupplier) Returns the owned redefining feature, creating one if necessary, using the supplied EClass.- Parameters:
type- the type whose features are modifiedredefined- the feature to redefineredefiningECLassSupplier- supplier for the redefining feature class- Returns:
- the existing or newly created redefining feature
-
getRedefiningOrSame
Returns the redefining feature of the type, or the feature itself if none exists.- Parameters:
type- the type whose features are inspectedredefined- the feature being redefined- Returns:
- redefining feature or the original feature
-
setFirsRedefined
public static void setFirsRedefined(Feature redefining, List<? extends Feature> redefined, boolean set) Set redefined feature of given redefining feature.- Parameters:
redefining- redefining featureredefined- redefined feature chainset- if set to true, find the firstRedefinitionand update it, if false - create newRedefinition
-
setAllRedefined
public static void setAllRedefined(Feature redefiningFeature, List<List<Feature>> redefined, boolean set) Set redefined features of given redefining feature.- Parameters:
redefiningFeature- redefining featureredefined- redefined features chainsset- if set to true, replace all existing redefined with given one, if false, append given ones
-