Class Redefinitions

java.lang.Object
com.dassault_systemes.modeler.kerml.model.Redefinitions

@OpenApiAll public class Redefinitions extends Object
Utility class to work with Redefinition
  • Constructor Details

    • Redefinitions

      public Redefinitions()
  • Method Details

    • firstRedefined

      @CheckForNull public static Feature firstRedefined(Feature redefining)
      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

      public static void removeRedefined(Collection<? extends Feature> features)
      Removes all redefined features from the given collection.
      Parameters:
      features - the features to modify
    • isSameOrRedefined

      public static boolean isSameOrRedefined(Feature redefining, Feature redefined)
      Checks whether the redefining feature is the same as or redefines the given feature.
      Parameters:
      redefining - the redefining feature
      redefined - 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 feature
      redefined - collection of features to check
      Returns:
      true if any match
    • isRedefined

      public static boolean isRedefined(Feature redefining, Feature redefined)
      Checks whether the redefining feature redefines the given feature.
      Parameters:
      redefining - the redefining feature
      redefined - the feature being checked
      Returns:
      true if redefining redefines redefined
    • collectRedefinedWithSelf

      public static Collection<Feature> collectRedefinedWithSelf(Feature feature)
      Returns all redefined features including the feature itself.
      Parameters:
      feature - the feature to inspect
      Returns:
      collection of redefined features including self
    • collectRedefined

      public static <T extends Collection<Feature>> void collectRedefined(Feature redefining, T result)
      Collects all redefined features of the given feature into the provided collection.
      Type Parameters:
      T - collection type
      Parameters:
      redefining - the redefining feature
      result - the collection to fill
    • getRedefined

      public static List<Feature> getRedefined(Feature redefining)
      Returns all redefined features of the given feature.
      Parameters:
      redefining - the redefining feature
      Returns:
      list of redefined features
    • getDirectlyRedefined

      public static List<Feature> getDirectlyRedefined(Feature redefining)
      Returns the directly redefined features of the given feature.
      Parameters:
      redefining - the redefining feature
      Returns:
      list of directly redefined features
    • setRedefined

      public static void setRedefined(Feature redefining, @CheckForNull Feature redefined)
      Sets the redefined feature of the given redefining feature.
      Parameters:
      redefining - the redefining feature
      redefined - the redefined feature, or null
    • setRedefined

      public static void setRedefined(Feature redefining, List<Feature> redefined)
      Sets the redefined features of the given redefining feature.
      Parameters:
      redefining - the redefining feature
      redefined - list of redefined features
    • addRedefined

      public static void addRedefined(Feature redefining, Feature redefined)
      Adds a redefined feature to the given redefining feature.
      Parameters:
      redefining - the redefining feature
      redefined - the feature to add as redefined
    • forEachRedefined

      public static void forEachRedefined(Feature redefining, Consumer<Feature> consumer)
      Applies the given consumer to each redefined feature of the redefining feature.
      Parameters:
      redefining - the redefining feature
      consumer - action applied to each redefined feature
    • createRedefining

      public static Feature createRedefining(Feature redefined, Namespace namespace)
      Creates a new redefining feature for the given redefined feature.
      Parameters:
      redefined - the feature to redefine
      namespace - 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 feature
      filter - 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

      @CheckForNull public static Feature getOwnedRedefining(Type type, Feature redefined)
      Returns the owned feature of the type that redefines the given feature.
      Parameters:
      type - the type whose features are inspected
      redefined - the feature being redefined
      Returns:
      the redefining feature, or null if none found
    • getOrCreateOwnedRedefining

      public static Feature getOrCreateOwnedRedefining(Type type, Feature redefined)
      Returns the owned redefining feature, creating one if necessary.
      Parameters:
      type - the type whose features are modified
      redefined - 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 modified
      redefined - the feature to redefine
      redefiningECLassSupplier - supplier for the redefining feature class
      Returns:
      the existing or newly created redefining feature
    • getRedefiningOrSame

      @CheckForNull public static Feature getRedefiningOrSame(Type type, Feature redefined)
      Returns the redefining feature of the type, or the feature itself if none exists.
      Parameters:
      type - the type whose features are inspected
      redefined - 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 feature
      redefined - redefined feature chain
      set - if set to true, find the first Redefinition and update it, if false - create new Redefinition
    • setAllRedefined

      public static void setAllRedefined(Feature redefiningFeature, List<List<Feature>> redefined, boolean set)
      Set redefined features of given redefining feature.
      Parameters:
      redefiningFeature - redefining feature
      redefined - redefined features chains
      set - if set to true, replace all existing redefined with given one, if false, append given ones