org.faktorips.runtime
Class CardinalityRange

java.lang.Object
  extended by org.faktorips.valueset.DefaultRange<Integer>
      extended by org.faktorips.valueset.IntegerRange
          extended by 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:
Serialized Form

Field Summary
static CardinalityRange FULL_RANGE
          A cardinality that describes the full range from 0 to * with default 0.
static CardinalityRange MANDATORY
          A cardinality that describes the obligatory range 1 to 1 with default 1.
static CardinalityRange OPTIONAL
          A cardinality that describes the optional range from 0 to 1 with default 0.
 
Constructor Summary
CardinalityRange(Integer lower, Integer upper, Integer def)
          Constructs a CardinalityRange with the given lower and upper bounds as well as the given default value.
 
Method Summary
 boolean equals(Object obj)
           
 Integer getDefaultCardinality()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class org.faktorips.valueset.IntegerRange
checkIfValueCompliesToStepIncrement, getNextValue, getNullValue, sizeForDiscreteValuesExcludingNull, valueOf, valueOf, valueOf, valueOf, valueOf
 
Methods inherited from class org.faktorips.valueset.DefaultRange
checkIfStepFitsIntoBounds, contains, contains, containsNull, getLowerBound, getStep, getUpperBound, getValues, isDiscrete, isEmpty, isRange, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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.

Constructor Detail

CardinalityRange

public CardinalityRange(Integer lower,
                        Integer upper,
                        Integer def)
Constructs a CardinalityRange with 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 cardinality
upper - the highest possible cardinality
def - 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 Detail

getDefaultCardinality

public Integer getDefaultCardinality()

equals

public boolean equals(Object obj)
Overrides:
equals in class org.faktorips.valueset.DefaultRange<Integer>

hashCode

public int hashCode()
Overrides:
hashCode in class org.faktorips.valueset.DefaultRange<Integer>

toString

public String toString()
Overrides:
toString in class org.faktorips.valueset.DefaultRange<Integer>


Copyright © 2015. All rights reserved.