summaryrefslogtreecommitdiff
path: root/src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java
diff options
context:
space:
mode:
authorErich Schubert <erich@debian.org>2012-12-14 20:45:15 +0100
committerAndrej Shadura <andrewsh@debian.org>2019-03-09 22:30:35 +0000
commit357b2761a2c0ded8cad5e4d3c1e667b7639ff7a6 (patch)
tree3dd8947bb70a67c221adc3cd4359ba1d385e2f3c /src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java
parent4343785ebed9d4145f417d86d581f18a0d31e4ac (diff)
parentb7b404fd7a726774d442562d11659d7b5368cdb9 (diff)
Import Debian changes 0.5.5-1
elki (0.5.5-1) unstable; urgency=low * New upstream release: 0.5.5 interim release.
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java')
-rw-r--r--src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java b/src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java
index f9e93a5b..db6a1ed8 100644
--- a/src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java
+++ b/src/de/lmu/ifi/dbs/elki/utilities/optionhandling/constraints/IntervalConstraint.java
@@ -37,7 +37,10 @@ import de.lmu.ifi.dbs.elki.utilities.optionhandling.WrongParameterValueException
* @author Steffi Wanka
*
* @apiviz.uses de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.NumberParameter
+ *
+ * @deprecated Use two constraints instead.
*/
+@Deprecated
public class IntervalConstraint implements ParameterConstraint<Number> {
/**
* Available interval boundary types types:
@@ -110,6 +113,56 @@ public class IntervalConstraint implements ParameterConstraint<Number> {
}
/**
+ * Creates an IntervalConstraint parameter constraint.
+ * <p/>
+ * 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.
+ *
+ * @param lowConstraintValue the low constraint value (left interval boundary)
+ * @param lowBoundary the interval boundary for the low constraint value (see {@link IntervalBoundary})
+ * @param highConstraintValue the high constraint value (right interval
+ * boundary)
+ * @param highBoundary the interval boundary for the high constraint value
+ * (see {@link IntervalBoundary})
+ */
+ public IntervalConstraint(int lowConstraintValue, IntervalBoundary lowBoundary, int highConstraintValue, IntervalBoundary highBoundary) {
+ if(lowConstraintValue >= highConstraintValue) {
+ throw new IllegalArgumentException("Left interval boundary is greater than " + "or equal to right interval boundary!");
+ }
+
+ this.lowConstraintValue = Integer.valueOf(lowConstraintValue);
+ this.lowBoundary = lowBoundary;
+ this.highConstraintValue = Integer.valueOf(highConstraintValue);
+ this.highBoundary = highBoundary;
+ }
+
+ /**
+ * Creates an IntervalConstraint parameter constraint.
+ * <p/>
+ * 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.
+ *
+ * @param lowConstraintValue the low constraint value (left interval boundary)
+ * @param lowBoundary the interval boundary for the low constraint value (see {@link IntervalBoundary})
+ * @param highConstraintValue the high constraint value (right interval
+ * boundary)
+ * @param highBoundary the interval boundary for the high constraint value
+ * (see {@link IntervalBoundary})
+ */
+ public IntervalConstraint(double lowConstraintValue, IntervalBoundary lowBoundary, double highConstraintValue, IntervalBoundary highBoundary) {
+ if(lowConstraintValue >= highConstraintValue) {
+ throw new IllegalArgumentException("Left interval boundary is greater than " + "or equal to right interval boundary!");
+ }
+
+ this.lowConstraintValue = Double.valueOf(lowConstraintValue);
+ this.lowBoundary = lowBoundary;
+ this.highConstraintValue = Double.valueOf(highConstraintValue);
+ this.highBoundary = highBoundary;
+ }
+
+ /**
* Checks if the number value given by the number parameter is greater equal
* than the constraint value. If not, a parameter exception is thrown.
*