use of com.genericworkflownodes.knime.parameter.IntegerListParameter in project GenericKnimeNodes by genericworkflownodes.
the class CTDConfigurationWriter method addIntegerListParameterRestrictions.
private void addIntegerListParameterRestrictions(Parameter<?> p, StringBuffer restriction) {
IntegerListParameter ilp = (IntegerListParameter) p;
boolean lbSet = Integer.MIN_VALUE != ilp.getLowerBound().doubleValue();
boolean ubSet = Integer.MAX_VALUE != ilp.getUpperBound().doubleValue();
if (lbSet) {
restriction.append(String.format("%d", ilp.getLowerBound()));
}
if (ubSet || lbSet) {
restriction.append(':');
}
if (ubSet) {
restriction.append(String.format("%d", ilp.getUpperBound()));
}
}
use of com.genericworkflownodes.knime.parameter.IntegerListParameter in project GenericKnimeNodes by genericworkflownodes.
the class ListEditorDialogModel method addValue.
public int addValue() {
// choose reasonable value to insert
String newValue = "";
if (parameter instanceof DoubleListParameter) {
DoubleListParameter dlp = (DoubleListParameter) parameter;
if (dlp.getLowerBound() != Double.NEGATIVE_INFINITY || dlp.getUpperBound() != Double.POSITIVE_INFINITY) {
newValue = (dlp.getLowerBound() != Double.NEGATIVE_INFINITY ? dlp.getLowerBound().toString() : dlp.getUpperBound().toString());
} else {
newValue = "0.0";
}
} else if (parameter instanceof IntegerListParameter) {
IntegerListParameter ilp = (IntegerListParameter) parameter;
if (ilp.getLowerBound() != Integer.MIN_VALUE || ilp.getUpperBound() != Integer.MAX_VALUE) {
newValue = (ilp.getLowerBound() != Integer.MIN_VALUE ? ilp.getLowerBound().toString() : ilp.getUpperBound().toString());
} else {
newValue = "0";
}
} else if (parameter instanceof StringListParameter && ((StringListParameter) parameter).getRestrictions() != null) {
String[] validValues = ((StringListParameter) parameter).getRestrictions();
int i = 0;
while ("".equals(newValue) && i < validValues.length) {
newValue = validValues[i];
++i;
}
}
values.add(newValue);
fireTableRowsInserted(values.size(), values.size());
return values.size() - 1;
}
Aggregations