Package org.faktorips.runtime
Class CardinalityRange
java.lang.Object
org.faktorips.valueset.DefaultRange<Integer>
org.faktorips.valueset.IntegerRange
org.faktorips.runtime.CardinalityRange
- All Implemented Interfaces:
Serializable,org.faktorips.valueset.Range<Integer>,org.faktorips.valueset.ValueSet<Integer>
public class CardinalityRange
extends org.faktorips.valueset.IntegerRange
A Range class for cardinalities. A
CardinalityRange is defined by a lower and an upper
bound as well as a default value.- Author:
- Stefan Widmaier
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CardinalityRangeA cardinality that describes the empty range.static final CardinalityRangeA cardinality that describes the full range from 0 to * with default 0.static final CardinalityRangeA cardinality that describes the obligatory range 1 to 1 with default 1.static final CardinalityRangeA cardinality that describes the optional range from 0 to 1 with default 0.Fields inherited from interface org.faktorips.valueset.Range
PROPERTY_LOWER_BOUND, PROPERTY_STEP, PROPERTY_UPPER_BOUND -
Constructor Summary
ConstructorsConstructorDescriptionCardinalityRange(Integer lower, Integer upper, Integer def) Constructs aCardinalityRangewith the given lower and upper bounds as well as the given default value. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanisEmpty()ACardinalityRangeis considered empty when its upper bound is 0.toString()Methods inherited from class org.faktorips.valueset.IntegerRange
checkIfValueCompliesToStepIncrement, divisibleWithoutRest, empty, getDatatype, getNextValue, getNullValue, sizeForDiscreteValuesExcludingNull, valueOf, valueOf, valueOf, valueOf, valueOf, valueOfMethods inherited from class org.faktorips.valueset.DefaultRange
checkIfStepFitsIntoBounds, contains, containsNull, getLowerBound, getStep, getUpperBound, getValues, isDiscrete, isRange, isSubsetOf, isUnrestricted, size
-
Field Details
-
OPTIONAL
A cardinality that describes the optional range from 0 to 1 with default 0. -
MANDATORY
A cardinality that describes the obligatory range 1 to 1 with default 1. -
FULL_RANGE
A cardinality that describes the full range from 0 to * with default 0. -
EXCLUDED
A cardinality that describes the empty range. It is used to mark associations as excluded in product variants.
-
-
Constructor Details
-
CardinalityRange
Constructs aCardinalityRangewith the given lower and upper bounds as well as the given default value. The default value must be in between the lower and upper bound or equal to one of them (though not Integer.MAX_VALUE).- Parameters:
lower- the lowest possible cardinalityupper- the highest possible cardinalitydef- the default cardinality, must be in between or equal to one of the bounds- Throws:
IllegalArgumentException- if the default value is not in the range.
-
-
Method Details
-
isEmpty
public boolean isEmpty()ACardinalityRangeis considered empty when its upper bound is 0. -
getDefaultCardinality
-
equals
- Overrides:
equalsin classorg.faktorips.valueset.DefaultRange<Integer>
-
hashCode
public int hashCode()- Overrides:
hashCodein classorg.faktorips.valueset.DefaultRange<Integer>
-
toString
- Overrides:
toStringin classorg.faktorips.valueset.DefaultRange<Integer>
-