/** * (Re)generate the config string. * * @return the config string. */ public String toConfigString() { String out = ""; for (Iterator<CommandArgument> iterator = arguments.iterator(); iterator.hasNext(); ) { CommandArgument comp = iterator.next(); out += comp.toConfigString(); if (comp.followedBySpace()) { out += " "; } } return out; }
/** * Generate a formatted string. Note that a file name for each input and output must have already * been set with: {@code setPreparedPathForInput(int, String)} or {@code * setPreparedPathForOutput(int,String)}. * * @return The formatted string. * @throws IllegalArgumentException Thrown if a path hasn't been set fo one of the input or output * files. */ public String toFormattedString() throws IllegalArgumentException { String out = ""; for (Iterator<CommandArgument> iterator = arguments.iterator(); iterator.hasNext(); ) { CommandArgument comp = iterator.next(); out += comp.toFormattedString(); if (comp.followedBySpace()) { out += " "; } } return out; }
/** * Set the list of argument components. * * @param arguments the list of argument components to set. */ public void setArguments(List<CommandArgument> arguments) { this.arguments = arguments; for (Iterator iterator = arguments.iterator(); iterator.hasNext(); ) { CommandArgument commandArgument = (CommandArgument) iterator.next(); if (commandArgument.getClass().equals(FileCommandArgument.class)) { FileCommandArgument fileArg = (FileCommandArgument) commandArgument; if (fileArg.isOutput()) { this.outputs.put(fileArg.ioIndex, fileArg); } else { this.inputs.put(fileArg.ioIndex, fileArg); } } } }