public class IntervalConstraint extends Object implements ParameterConstraint<Number>
NumberParameter
) tested has to be greater than (or equal to, if specified) than the
specified low constraint value and less than (or equal to, if specified) than
the specified high constraint value.Modifier and Type | Class and Description |
---|---|
static class |
IntervalConstraint.IntervalBoundary
Available interval boundary types types:
IntervalConstraint.IntervalBoundary.OPEN denotes an opend interval,
i.e. less than (or greater than) comparison
IntervalConstraint.IntervalBoundary.CLOSE denotes a closed
interval, i.e. an equal to or less than (or equal to or greater than)
comparison |
Modifier and Type | Field and Description |
---|---|
private IntervalConstraint.IntervalBoundary |
highBoundary
The interval boundary for the high constraint value (@see IntervalBoundary)
|
private Number |
highConstraintValue
The high constraint value (right interval boundary).
|
private IntervalConstraint.IntervalBoundary |
lowBoundary
The interval boundary for the low constraint value (@see IntervalBoundary)
|
private Number |
lowConstraintValue
The low constraint value (left interval boundary).
|
Constructor and Description |
---|
IntervalConstraint(Number lowConstraintValue,
IntervalConstraint.IntervalBoundary lowBoundary,
Number highConstraintValue,
IntervalConstraint.IntervalBoundary highBoundary)
Creates an IntervalConstraint parameter constraint.
|
Modifier and Type | Method and Description |
---|---|
String |
getDescription(String parameterName)
Returns a description of this constraint.
|
void |
test(Number t)
Checks if the number value given by the number parameter is greater equal
than the constraint value.
|
private final Number lowConstraintValue
private final IntervalConstraint.IntervalBoundary lowBoundary
private final Number highConstraintValue
private final IntervalConstraint.IntervalBoundary highBoundary
public IntervalConstraint(Number lowConstraintValue, IntervalConstraint.IntervalBoundary lowBoundary, Number highConstraintValue, IntervalConstraint.IntervalBoundary highBoundary)
lowConstraintValue
- the low constraint value (left interval boundary)lowBoundary
- the interval boundary for the low constraint value (@see
IntervalBoundary)highConstraintValue
- the high constraint value (right interval
boundary)highBoundary
- the interval boundary for the high constraint value
(@see IntervalBoundary)public void test(Number t) throws ParameterException
test
in interface ParameterConstraint<Number>
t
- Value to be checked whether or not it fulfills the underlying
parameter constraint.ParameterException
- if the parameter to be tested does not
fulfill the parameter constraintpublic String getDescription(String parameterName)
ParameterConstraint
getDescription
in interface ParameterConstraint<Number>
parameterName
- the name of the parameter this constraint is used for