use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class ColumnFuntionSettings method validateSettings.
/**
* @param settings the {@link NodeSettingsRO} to read the settings from
* @throws InvalidSettingsException if the settings are invalid
*/
public void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
final String val = ((SettingsModelString) m_column.createCloneWithValidatedValue(settings)).getStringValue();
validateColumn(val);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class NumericScorerSettings method createFlowPrefixModel.
/**
* @param useNamePrefixModel TODO
* @return A new {@link SettingsModelString} for the flow variable prefix
*/
private SettingsModelString createFlowPrefixModel(final SettingsModelBoolean useNamePrefixModel) {
final SettingsModelString result = new SettingsModelString("name prefix for flowvars", "");
useNamePrefixModel.addChangeListener(new ChangeListener() {
/**
* {@inheritDoc}
*/
@Override
public void stateChanged(final ChangeEvent e) {
result.setEnabled(useNamePrefixModel.getBooleanValue());
}
});
result.setEnabled(useNamePrefixModel.getBooleanValue());
return result;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class NaiveBayesLearnerNodeModel2 method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
final SettingsModelString colName = m_classifyColumnName.createCloneWithValidatedValue(settings);
if (colName == null || colName.getStringValue() == null || colName.getStringValue().trim().length() < 1) {
throw new InvalidSettingsException("No class column selected");
}
final SettingsModelIntegerBounded maxNoOfNomVals = m_maxNoOfNominalVals.createCloneWithValidatedValue(settings);
if (maxNoOfNomVals.getIntValue() < 0) {
throw new InvalidSettingsException("Maximum number of unique nominal values should be a positive number");
}
m_pmmlCompatible.validateSettings(settings);
m_threshold.validateSettings(settings);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class HierarchicalClusterNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_numClustersForOutput.validateSettings(settings);
m_distFunctionName.validateSettings(settings);
m_selectedColumns.validateSettings(settings);
m_cacheDistances.validateSettings(settings);
SettingsModelString linkageType = m_linkageType.createCloneWithValidatedValue(settings);
// check linkage method
boolean valid = false;
for (Linkage link : Linkage.values()) {
if (link.name().equals(linkageType.getStringValue())) {
valid = true;
break;
}
}
if (!valid) {
throw new InvalidSettingsException("Linkage Type must either be " + Linkage.SINGLE + ", " + Linkage.AVERAGE + " or " + Linkage.COMPLETE);
}
settings.getBoolean(USE_CACHE_KEY, false);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class DecisionTreeLearnerNodeModel2 method validateSettings.
/**
* This method validates the settings. That is:
* <ul>
* <li>The number of the class column must be an integer > 0</li>
* <li>The positive value <code>DataCell</code> must not be null</li>
* </ul>
* {@inheritDoc}
*
* @see NodeModel#validateSettings(NodeSettingsRO)
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
SettingsModelString classifyColumn = m_classifyColumn.createCloneWithValidatedValue(settings);
if (classifyColumn.getStringValue() == null || classifyColumn.getStringValue().equals("")) {
throw new InvalidSettingsException("Classification column not set.");
}
m_averageSplitpoint.validateSettings(settings);
m_binaryNominalSplitMode.validateSettings(settings);
m_pruningMethod.validateSettings(settings);
try {
m_reducedErrorPruning.validateSettings(settings);
} catch (InvalidSettingsException ise) {
// add with KNIME 2.8
}
m_numberRecordsStoredForView.validateSettings(settings);
// m_pruningConfidenceThreshold.validateSettings(settings);
m_minNumberRecordsPerNode.validateSettings(settings);
m_splitQualityMeasureType.validateSettings(settings);
m_maxNumNominalsForCompleteComputation.validateSettings(settings);
m_parallelProcessing.validateSettings(settings);
// added in v2.5.3, bug 3124
if (settings.containsKey(KEY_FILTER_NOMINAL_VALUES_FROM_PARENT)) {
m_filterNominalValuesFromParent.validateSettings(settings);
}
/* Added with 2.5 to avoid running out of heap space with columns
* that have too many nominal values. */
if (settings.containsKey(KEY_SKIP_COLUMNS)) {
m_skipColumns.validateSettings(settings);
}
/* Added with 2.8 to include missing values strategy and no true child strategy. */
if (settings.containsKey(KEY_NOTRUECHILD) && settings.containsKey(KEY_MISSINGSTRATEGY)) {
m_noTrueChild.validateSettings(settings);
// added true child with missing values, so when one of them is in, both are in
m_missingValues.validateSettings(settings);
}
/* Added with 3.2 to allow the specification of the first column to split on */
if (settings.containsKey(KEY_USE_FIRST_SPLIT_COL)) {
m_useFirstSplitCol.validateSettings(settings);
m_firstSplitCol.validateSettings(settings);
}
}
Aggregations