Flag absoluteF = new Flag(EIGENPAIR_FILTER_ABSOLUTE);
if(config.grab(absoluteF)) {
absolute = absoluteF.getValue();
}
DoubleParameter deltaP = new DoubleParameter(EIGENPAIR_FILTER_DELTA, new GreaterEqualConstraint(0), DEFAULT_DELTA);
if(config.grab(deltaP)) {
delta = deltaP.getValue();
// TODO: make this a global constraint?
if(absolute && deltaP.tookDefaultValue()) {
config.reportError(new WrongParameterValueException("Illegal parameter setting: " + "Flag " + absoluteF.getName() + " is set, " + "but no value for " + deltaP.getName() + " is specified."));
}
}
// Conditional Constraint:
// delta must be >= 0 and <= 1 if it's a relative value
// Since relative or absolute is dependent on the absolute flag this is a
// global constraint!
List<ParameterConstraint<Number>> cons = new Vector<ParameterConstraint<Number>>();
// TODO: Keep the constraint here - applies to non-conditional case as
// well,
// and is set above.
ParameterConstraint<Number> aboveNull = new GreaterEqualConstraint(0);
cons.add(aboveNull);
ParameterConstraint<Number> underOne = new LessEqualConstraint(1);
cons.add(underOne);
GlobalParameterConstraint gpc = new ParameterFlagGlobalConstraint<Number, Double>(deltaP, cons, absoluteF, false);