use of org.knime.ext.sun.nodes.script.calculator.ColumnCalculator in project knime-core by knime.
the class StringManipulationNodeModel method createColumnRearranger.
private ColumnRearranger createColumnRearranger(final DataTableSpec spec) throws InvalidSettingsException {
if (m_settings == null || m_settings.getExpression() == null) {
throw new InvalidSettingsException("No expression has been set.");
}
boolean isReplace = m_settings.isReplace();
String colName = m_settings.getColName();
JavaScriptingSettings settings = m_settings.createJavaScriptingSettings();
try {
settings.setInputAndCompile(spec);
ColumnCalculator cc = new ColumnCalculator(settings, this);
ColumnRearranger result = new ColumnRearranger(spec);
if (isReplace) {
result.replace(cc, colName);
} else {
result.append(cc);
}
return result;
} catch (Exception e) {
throw new InvalidSettingsException(e.getMessage(), e);
}
}
Aggregations