Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints
Class IntervalConstraint

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.constraints.IntervalConstraint
All Implemented Interfaces:
Loggable, ParameterConstraint<Number>

public class IntervalConstraint
extends AbstractLoggable
implements ParameterConstraint<Number>

Represents an interval parameter constraint testing if a given value lies within the specified interval. The value of the number parameter (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.

Author:
Steffi Wanka

Nested Class Summary
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
 
Field Summary
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).
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
IntervalConstraint(Number lowConstraintValue, IntervalConstraint.IntervalBoundary lowBoundary, Number highConstraintValue, IntervalConstraint.IntervalBoundary highBoundary)
          Creates an IntervalConstraint parameter constraint.
 
Method Summary
 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.
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.logging.Loggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, verbose, verbose, warning
 

Field Detail

lowConstraintValue

private final Number lowConstraintValue
The low constraint value (left interval boundary).


lowBoundary

private final IntervalConstraint.IntervalBoundary lowBoundary
The interval boundary for the low constraint value (@see IntervalBoundary)


highConstraintValue

private final Number highConstraintValue
The high constraint value (right interval boundary).


highBoundary

private final IntervalConstraint.IntervalBoundary highBoundary
The interval boundary for the high constraint value (@see IntervalBoundary)

Constructor Detail

IntervalConstraint

public IntervalConstraint(Number lowConstraintValue,
                          IntervalConstraint.IntervalBoundary lowBoundary,
                          Number highConstraintValue,
                          IntervalConstraint.IntervalBoundary highBoundary)
Creates an IntervalConstraint parameter constraint.

That is, the value of the number parameter given 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.

Parameters:
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)
Method Detail

test

public void test(Number t)
          throws ParameterException
Checks if the number value given by the number parameter is greater equal than the constraint value. If not, a parameter exception is thrown.

Specified by:
test in interface ParameterConstraint<Number>
Parameters:
t - Value to be checked whether or not it fulfills the underlying parameter constraint.
Throws:
ParameterException - if the parameter to be tested does not fulfill the parameter constraint
See Also:
ParameterConstraint.test(Object)

getDescription

public String getDescription(String parameterName)
Description copied from interface: ParameterConstraint
Returns a description of this constraint.

Specified by:
getDescription in interface ParameterConstraint<Number>
Parameters:
parameterName - the name of the parameter this constraint is used for
Returns:
a description of this constraint
See Also:
ParameterConstraint.getDescription(String)

Release 0.1 (2008-07-10_1838)