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

@OpenApiAll public class Features extends Object
Utility class to work with Feature
  • 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 feature
      nameFunction - function extracting a name from the feature
      Returns:
      effective name, or null if none found
    • getContainingTypeOrContext

      public static Type getContainingTypeOrContext(Type context, Feature feature)
      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 - context
      feature - feature
      Returns:
      type of context to which the given feature belongs
    • isInheritedFromType

      public static boolean isInheritedFromType(Feature feature, Type type)
      Checks whether the feature is inherited from the given type.
      Parameters:
      feature - the feature
      type - the type to check against
      Returns:
      true if the feature is inherited from the type
    • collectAllFeaturingTypes

      public static <T extends Collection<Type>> T collectAllFeaturingTypes(Feature feature, T collected)
      Collects all featuring types of the feature recursively.
      Type Parameters:
      T - collection type
      Parameters:
      feature - the feature
      collected - collection to populate
      Returns:
      the populated collection
    • getRedefiningFeatureInType

      @CheckForNull public static Feature getRedefiningFeatureInType(Feature feature, Type type)
      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 for
      type - type in which to look for provided feature
      Returns:
      feature of a type
    • isAnonymousFeature

      public static boolean isAnonymousFeature(Feature feature)
      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

      @CheckForNull public static Feature getOwningFeatureOfAnonymousFeature(Feature anonymousFeature)
      Returns the owning feature of an anonymous feature.
      Parameters:
      anonymousFeature - anonymous feature
      Returns:
      owning feature, or null