Search in sources :

Example 1 with CommandLineFile

use of com.genericworkflownodes.knime.commandline.impl.CommandLineFile in project GenericKnimeNodes by genericworkflownodes.

the class CLICommandGenerator method handleNonListParameter.

private void handleNonListParameter(final List<List<? extends CommandLineElement>> extractedParameterValues, final Parameter<?> p) {
    final List<CommandLineElement> l = new ArrayList<CommandLineElement>();
    final CommandLineElement commandLineElement;
    if (p instanceof FileParameter) {
        commandLineElement = new CommandLineFile((FileParameter) p);
    } else {
        commandLineElement = new CommandLineParameter(p);
    }
    l.add(commandLineElement);
    extractedParameterValues.add(l);
}
Also used : CommandLineParameter(com.genericworkflownodes.knime.commandline.impl.CommandLineParameter) ArrayList(java.util.ArrayList) CommandLineFile(com.genericworkflownodes.knime.commandline.impl.CommandLineFile) CommandLineElement(com.genericworkflownodes.knime.commandline.CommandLineElement) FileParameter(com.genericworkflownodes.knime.parameter.FileParameter) IFileParameter(com.genericworkflownodes.knime.parameter.IFileParameter)

Example 2 with CommandLineFile

use of com.genericworkflownodes.knime.commandline.impl.CommandLineFile in project GenericKnimeNodes by genericworkflownodes.

the class CLICommandGenerator method handleListParameter.

private void handleListParameter(final List<List<? extends CommandLineElement>> extractedParameterValues, final ListParameter listParameter) {
    final int nValues = listParameter.getStrings().size();
    final String key = ((Parameter<?>) listParameter).getKey();
    final List<CommandLineElement> tmpList = new LinkedList<CommandLineElement>();
    // there's only one element in the list
    if (nValues > 1) {
        int sequence = 0;
        for (final String value : listParameter.getStrings()) {
            final CommandLineElement commandLineElement;
            if (listParameter instanceof IFileParameter) {
                commandLineElement = new CommandLineFile(new FileParameter(key, value));
            } else {
                commandLineElement = new CommandLineParameter(new StringParameter(key, value));
            }
            commandLineElement.setSequenceNumber(sequence++);
            tmpList.add(commandLineElement);
        }
    } else {
        // only one value in the list, no need to use sequence numbers
        final String value = listParameter.getStrings().get(0);
        if (listParameter instanceof IFileParameter) {
            tmpList.add(new CommandLineFile(new FileParameter(key, value)));
        } else {
            tmpList.add(new CommandLineParameter(new StringParameter(key, value)));
        }
    }
    extractedParameterValues.add(tmpList);
}
Also used : IFileParameter(com.genericworkflownodes.knime.parameter.IFileParameter) StringParameter(com.genericworkflownodes.knime.parameter.StringParameter) CommandLineParameter(com.genericworkflownodes.knime.commandline.impl.CommandLineParameter) CommandLineFile(com.genericworkflownodes.knime.commandline.impl.CommandLineFile) ListParameter(com.genericworkflownodes.knime.parameter.ListParameter) BoolParameter(com.genericworkflownodes.knime.parameter.BoolParameter) FileParameter(com.genericworkflownodes.knime.parameter.FileParameter) CommandLineParameter(com.genericworkflownodes.knime.commandline.impl.CommandLineParameter) StringParameter(com.genericworkflownodes.knime.parameter.StringParameter) Parameter(com.genericworkflownodes.knime.parameter.Parameter) IFileParameter(com.genericworkflownodes.knime.parameter.IFileParameter) CommandLineFixedString(com.genericworkflownodes.knime.commandline.impl.CommandLineFixedString) CommandLineElement(com.genericworkflownodes.knime.commandline.CommandLineElement) FileParameter(com.genericworkflownodes.knime.parameter.FileParameter) IFileParameter(com.genericworkflownodes.knime.parameter.IFileParameter) LinkedList(java.util.LinkedList)

Aggregations

CommandLineElement (com.genericworkflownodes.knime.commandline.CommandLineElement)2 CommandLineFile (com.genericworkflownodes.knime.commandline.impl.CommandLineFile)2 CommandLineParameter (com.genericworkflownodes.knime.commandline.impl.CommandLineParameter)2 FileParameter (com.genericworkflownodes.knime.parameter.FileParameter)2 IFileParameter (com.genericworkflownodes.knime.parameter.IFileParameter)2 CommandLineFixedString (com.genericworkflownodes.knime.commandline.impl.CommandLineFixedString)1 BoolParameter (com.genericworkflownodes.knime.parameter.BoolParameter)1 ListParameter (com.genericworkflownodes.knime.parameter.ListParameter)1 Parameter (com.genericworkflownodes.knime.parameter.Parameter)1 StringParameter (com.genericworkflownodes.knime.parameter.StringParameter)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1