Package org.faktorips.runtime
Class CardinalityRange
- java.lang.Object
-
- org.faktorips.valueset.DefaultRange<java.lang.Integer>
-
- org.faktorips.valueset.IntegerRange
-
- org.faktorips.runtime.CardinalityRange
-
- All Implemented Interfaces:
java.io.Serializable,org.faktorips.valueset.Range<java.lang.Integer>,org.faktorips.valueset.ValueSet<java.lang.Integer>
public class CardinalityRange extends org.faktorips.valueset.IntegerRangeA Range class for cardinalities. ACardinalityRangeis defined by a lower and an upper bound as well as a default value.- Author:
- Stefan Widmaier
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static CardinalityRangeEXCLUDEDA cardinality that describes the empty range.static CardinalityRangeFULL_RANGEA cardinality that describes the full range from 0 to * with default 0.static CardinalityRangeMANDATORYA cardinality that describes the obligatory range 1 to 1 with default 1.static CardinalityRangeOPTIONALA cardinality that describes the optional range from 0 to 1 with default 0.
-
Constructor Summary
Constructors Constructor Description CardinalityRange(java.lang.Integer lower, java.lang.Integer upper, java.lang.Integer def)Constructs aCardinalityRangewith the given lower and upper bounds as well as the given default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.IntegergetDefaultCardinality()inthashCode()java.lang.StringtoString()-
Methods inherited from class org.faktorips.valueset.IntegerRange
checkIfValueCompliesToStepIncrement, empty, getNextValue, getNullValue, sizeForDiscreteValuesExcludingNull, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf
-
-
-
-
Field Detail
-
OPTIONAL
public static final CardinalityRange OPTIONAL
A cardinality that describes the optional range from 0 to 1 with default 0.
-
MANDATORY
public static final CardinalityRange MANDATORY
A cardinality that describes the obligatory range 1 to 1 with default 1.
-
FULL_RANGE
public static final CardinalityRange FULL_RANGE
A cardinality that describes the full range from 0 to * with default 0.
-
EXCLUDED
public static final CardinalityRange EXCLUDED
A cardinality that describes the empty range. It is used to mark associations as excluded in product variants.
-
-
Constructor Detail
-
CardinalityRange
public CardinalityRange(java.lang.Integer lower, java.lang.Integer upper, java.lang.Integer def)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:
java.lang.IllegalArgumentException- if the default value is not in the range.
-
-
Method Detail
-
getDefaultCardinality
public java.lang.Integer getDefaultCardinality()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classorg.faktorips.valueset.DefaultRange<java.lang.Integer>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classorg.faktorips.valueset.DefaultRange<java.lang.Integer>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classorg.faktorips.valueset.DefaultRange<java.lang.Integer>
-
-