Class Multiplicities
java.lang.Object
com.dassault_systemes.modeler.kerml.model.Multiplicities
Utility class to work with
Multiplicity-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intInteger value representing a null multiplicity bound.static final String^ - Anchors the pattern to the start of the string.static final intInteger value representing a null multiplicity bound.static final String^ - Anchors the pattern to the start of the string. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MultiplicitycreateMultiplicity(Type type) Creates a newMultiplicityowned by the given type.static MultiplicityRangecreateMultiplicityRange(Type type) Creates a newMultiplicityRangeowned by the given type.static MultiplicityRangegetEffectiveMultiplicityRange(Multiplicity multiplicity) Returns the effective multiplicity range for the given multiplicity.static List<MultiplicityRange> getMultiplicityRangesOf(Type type) Returns all multiplicity ranges associated with the given type.static MultiplicityReturns the owned or inherited multiplicity of the given type.static booleanisExactlyOne(Multiplicity multiplicity) Checks whether the multiplicity represents exactly one.static booleanisImplicitMultiplicity(Multiplicity multiplicity) Checks whether the multiplicity is implicit (i.e., has no explicit subsettings).static booleanisInfinitive(Object value) Checks whether the given value represents an infinite multiplicity.static booleanisMultiple(MultiplicityRange range) Checks whether the multiplicity range allows more than one value.static booleanisMultiple(Type feature) Checks whether the given type has a multiplicity greater than one.static booleanChecks whether the multiplicity range represents exactly zero.static booleanisNullValue(Object value) Checks whether the given value represents a null multiplicity.static booleanisPositive(Object value) Checks whether the given value represents a positive multiplicity bound.static voidsetMultiplicity(Type type, String stringValue) Sets the multiplicity of the given type from a string value.
-
Field Details
-
NULL_AS_INT
public static final int NULL_AS_INTInteger value representing a null multiplicity bound.- See Also:
-
INFINITIVE_AS_INT
public static final int INFINITIVE_AS_INTInteger value representing a null multiplicity bound.- See Also:
-
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
^ - 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
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
Creates a newMultiplicityowned by the given type.- Parameters:
type- the owning type- Returns:
- the created multiplicity
-
createMultiplicityRange
Creates a newMultiplicityRangeowned by the given type.- Parameters:
type- the owning type- Returns:
- the created multiplicity range
-
isPositive
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
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
Checks whether the given value represents an infinite multiplicity.- Parameters:
value- the value to check- Returns:
- true if the value represents infinity
-
getMultiplicityRangesOf
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
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
Checks whether the multiplicity range represents exactly zero.- Parameters:
range- the multiplicity range- Returns:
- true if both bounds evaluate to zero
-
isExactlyOne
Checks whether the multiplicity represents exactly one.- Parameters:
multiplicity- the multiplicity to inspect- Returns:
- true if the multiplicity is exactly one
-
isMultiple
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
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
Sets the multiplicity of the given type from a string value. Supports both "lower..upper" and single-value formats.- Parameters:
type- the type to modifystringValue- the multiplicity string
-