use of org.knime.core.node.defaultnodesettings.SettingsModelFilterString in project knime-core by knime.
the class CAIMDiscretizationNodeModel method createModelSpec.
/**
* Creates a table spec including the columns used. In order to specify
* included names and types a data table spec is created that contains the
* included columns.
*
* @param cols the names of the columns to include.
* @param inSpec the input spec the specified columns are taken from and
* included into the result.
* @return a table spec containing the columns with the specified names
* @throws InvalidSettingsException if a name is specified that is not
* included in the input spec.
*/
private DataTableSpec createModelSpec(final SettingsModelFilterString cols, final DataTableSpec inSpec) throws InvalidSettingsException {
DataColumnSpec[] colSpecs = new DataColumnSpec[cols.getIncludeList().size()];
int c = 0;
for (String colName : cols.getIncludeList()) {
int colIdx = inSpec.findColumnIndex(colName);
if (colIdx < 0) {
throw new InvalidSettingsException("Specified column name (" + colName + ") not in input table.");
}
colSpecs[c] = inSpec.getColumnSpec(colIdx);
c++;
}
return new DataTableSpec(colSpecs);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelFilterString in project knime-core by knime.
the class PMCCNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
// FIX bug 5040: potential problem with clone settings method when in-/exclude list contain same elements
SettingsModelFilterString clone = createNewSettingsObject();
clone.loadSettingsFrom(settings);
if (clone.getIncludeList().isEmpty()) {
throw new InvalidSettingsException("No column selected");
}
m_maxPossValueCountModel.validateSettings(settings);
}
Aggregations