Search in sources :

Example 6 with IntegerListParameter

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()));
    }
}
Also used : IntegerListParameter(com.genericworkflownodes.knime.parameter.IntegerListParameter)

Example 7 with IntegerListParameter

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;
}
Also used : StringListParameter(com.genericworkflownodes.knime.parameter.StringListParameter) IntegerListParameter(com.genericworkflownodes.knime.parameter.IntegerListParameter) DoubleListParameter(com.genericworkflownodes.knime.parameter.DoubleListParameter)

Aggregations

IntegerListParameter (com.genericworkflownodes.knime.parameter.IntegerListParameter)7 INodeConfiguration (com.genericworkflownodes.knime.config.INodeConfiguration)3 TestDataSource (com.genericworkflownodes.knime.test.data.TestDataSource)3 Test (org.junit.Test)3 BoolParameter (com.genericworkflownodes.knime.parameter.BoolParameter)2 DoubleListParameter (com.genericworkflownodes.knime.parameter.DoubleListParameter)2 StringChoiceParameter (com.genericworkflownodes.knime.parameter.StringChoiceParameter)2 StringParameter (com.genericworkflownodes.knime.parameter.StringParameter)2 CTDConfigurationReader (com.genericworkflownodes.knime.config.reader.CTDConfigurationReader)1 CTDHandler (com.genericworkflownodes.knime.config.reader.handler.CTDHandler)1 DoubleParameter (com.genericworkflownodes.knime.parameter.DoubleParameter)1 FileParameter (com.genericworkflownodes.knime.parameter.FileParameter)1 IntegerParameter (com.genericworkflownodes.knime.parameter.IntegerParameter)1 StringListParameter (com.genericworkflownodes.knime.parameter.StringListParameter)1 SchemaProvider (com.genericworkflownodes.knime.schemas.SchemaProvider)1 IntegerRangeExtractor (com.genericworkflownodes.util.ranges.IntegerRangeExtractor)1 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileWriter (java.io.FileWriter)1