Class Multiplicities

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

@OpenApiAll public class Multiplicities extends Object
Utility class to work with Multiplicity
  • Field Details

    • NULL_AS_INT

      public static final int NULL_AS_INT
      Integer value representing a null multiplicity bound.
      See Also:
    • INFINITIVE_AS_INT

      public static final int INFINITIVE_AS_INT
      Integer value representing a null multiplicity bound.
      See Also:
    • LOWER_UPPER_MULTIPLICITY_REGEX

      public static final String LOWER_UPPER_MULTIPLICITY_REGEX
      ^ - Anchors the pattern to the start of the string. \\d+ - Matches one or more digits (natural number). \\.\\. - Matches two literal dots. Since . is a special character in regex, it's escaped with double backslashes. ( ) - Captures the part after the two dots. \\d+ - Matches one or more digits (natural number). | - Acts as an "OR" operator, allowing for an alternative match. \\* - Matches the literal * symbol. The asterisk is also a special character in regex, so it is escaped. $ - Anchors the pattern to the end of the string.
      See Also:
    • SINGLE_MULTIPLICITY_REGEX

      public static final String SINGLE_MULTIPLICITY_REGEX
      ^ - Anchors the pattern to the start of the string. \\d+ - Matches one or more digits (natural number). | - Acts as an "OR" operator, allowing for an alternative match. \\* - Matches the literal * symbol. The asterisk is also a special character in regex, so it is escaped. $ - Anchors the pattern to the end of the string.
      See Also:
  • Constructor Details

    • Multiplicities

      public Multiplicities()
  • Method Details

    • getOwnedOrInheritedMultiplicity

      @CheckForNull public static Multiplicity getOwnedOrInheritedMultiplicity(Type type)
      Returns the owned or inherited multiplicity of the given type.
      Parameters:
      type - the type whose multiplicity is requested
      Returns:
      owned or inherited multiplicity, or null if none exists
    • createMultiplicity

      public static Multiplicity createMultiplicity(Type type)
      Creates a new Multiplicity owned by the given type.
      Parameters:
      type - the owning type
      Returns:
      the created multiplicity
    • createMultiplicityRange

      public static MultiplicityRange createMultiplicityRange(Type type)
      Creates a new MultiplicityRange owned by the given type.
      Parameters:
      type - the owning type
      Returns:
      the created multiplicity range
    • isPositive

      public static boolean isPositive(Object value)
      Checks whether the given value represents a positive multiplicity bound.
      Parameters:
      value - the value to check
      Returns:
      true if the value is non-negative or infinite
    • isNullValue

      public static boolean isNullValue(Object value)
      Checks whether the given value represents a null multiplicity.
      Parameters:
      value - the value to check
      Returns:
      true if the value represents a null bound
    • isInfinitive

      public static boolean isInfinitive(Object value)
      Checks whether the given value represents an infinite multiplicity.
      Parameters:
      value - the value to check
      Returns:
      true if the value represents infinity
    • getMultiplicityRangesOf

      public static List<MultiplicityRange> getMultiplicityRangesOf(Type type)
      Returns all multiplicity ranges associated with the given type.
      Parameters:
      type - the type to inspect
      Returns:
      list of multiplicity ranges
    • getEffectiveMultiplicityRange

      @CheckForNull public static MultiplicityRange getEffectiveMultiplicityRange(Multiplicity multiplicity)
      Returns the effective multiplicity range for the given multiplicity. If the multiplicity is itself a range, it is returned directly.
      Parameters:
      multiplicity - the multiplicity to inspect
      Returns:
      effective multiplicity range, or null if none found
    • isImplicitMultiplicity

      public static boolean isImplicitMultiplicity(Multiplicity multiplicity)
      Checks whether the multiplicity is implicit (i.e., has no explicit subsettings).
      Parameters:
      multiplicity - the multiplicity to inspect
      Returns:
      true if the multiplicity is implicit
    • isMultiplicityRangeZero

      public static boolean isMultiplicityRangeZero(MultiplicityRange range)
      Checks whether the multiplicity range represents exactly zero.
      Parameters:
      range - the multiplicity range
      Returns:
      true if both bounds evaluate to zero
    • isExactlyOne

      public static boolean isExactlyOne(Multiplicity multiplicity)
      Checks whether the multiplicity represents exactly one.
      Parameters:
      multiplicity - the multiplicity to inspect
      Returns:
      true if the multiplicity is exactly one
    • isMultiple

      public static boolean isMultiple(Type feature)
      Checks whether the given type has a multiplicity greater than one.
      Parameters:
      feature - the type to inspect
      Returns:
      true if the multiplicity is multiple
    • isMultiple

      public static boolean isMultiple(MultiplicityRange range)
      Checks whether the multiplicity range allows more than one value.
      Parameters:
      range - the multiplicity range
      Returns:
      true if the upper bound is infinite or greater than one
    • setMultiplicity

      public static void setMultiplicity(Type type, String stringValue)
      Sets the multiplicity of the given type from a string value. Supports both "lower..upper" and single-value formats.
      Parameters:
      type - the type to modify
      stringValue - the multiplicity string