Search in sources :

Example 26 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class PolyRegLearnerSettings method createFakeSettings.

/**
 * Creates a fake configuration to help migrating the old configuration.
 *
 * @param configName Name of the {@link NodeSettings} to create.
 * @param included The included column names.
 * @param excluded The excluded column names.
 * @param includeAll Should we include all columns that are not in the exclude list ({@code true}), or use the include list ({@code false})?
 * @return The fake {@link NodeSettings}.
 */
static NodeSettings createFakeSettings(final String configName, final String[] included, final String[] excluded, final boolean includeAll) {
    NodeSettings fakeSettings = new NodeSettings("FakeRoot");
    NodeSettings filterSettings = (NodeSettings) fakeSettings.addNodeSettings(configName);
    filterSettings.addString("filter-type", "STANDARD");
    filterSettings.addStringArray("included_names", included);
    filterSettings.addStringArray("excluded_names", excluded);
    filterSettings.addString("enforce_option", (includeAll ? EnforceOption.EnforceExclusion : EnforceOption.EnforceInclusion).name());
    NodeSettings datatypeSettings = (NodeSettings) filterSettings.addNodeSettings("datatype");
    NodeSettingsWO typelist = datatypeSettings.addNodeSettings("typelist");
    typelist.addBoolean(DoubleValue.class.getName(), true);
    return fakeSettings;
}
Also used : NodeSettings(org.knime.core.node.NodeSettings) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) DoubleValue(org.knime.core.data.DoubleValue)

Example 27 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class SettingsModelPCADimensions method saveSettingsForModel.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsForModel(final NodeSettingsWO settings) {
    final NodeSettingsWO set = settings.addNodeSettings(m_configName);
    set.addBoolean("choice", m_dimensionsSelected);
    set.addDouble("doubleVal", m_minQuality);
    set.addInt("intVal", m_dimensions);
    set.addDoubleArray("eigenvalues", m_eigenvalues);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 28 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class DataValidatorConfiguration method saveSettings.

/**
 * Called from dialog's and model's save method.
 *
 * @param settings Arg settings.
 */
void saveSettings(final NodeSettingsWO settings) {
    NodeSettingsWO individuals = settings.addNodeSettings(CFG_INDIVDUALS);
    int counter = 0;
    for (DataValidatorColConfiguration config : m_individualConfigurations) {
        NodeSettingsWO addNodeSettings = individuals.addNodeSettings("" + counter++);
        config.save(addNodeSettings);
    }
    addEnum(settings, CFG_REMOVE_UNKOWN_COLUMNS, m_removeUnkownColumns);
    addEnum(settings, CFG_REJECTING_BEHAVIOR, m_failingBehavior);
    if (m_referenceSpecNeedet) {
        m_referenceTableSpec.save(settings.addNodeSettings(CFG_SPEC));
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 29 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class EditNominalDomainConfiguration method saveSettings.

/**
 * Called from dialog's and model's save method.
 *
 * @param settings Arg settings.
 */
void saveSettings(final NodeSettingsWO settings) {
    settings.addBoolean(IGNORE_NOT_MATHING_TYPES, m_ignoreWrongTypes);
    settings.addBoolean(IGNORE_NOT_PRESENT_COLS, m_ignoreNotExistingColumns);
    NodeSettingsWO cols = settings.addNodeSettings(COLUMNS);
    for (Map.Entry<String, List<DataCell>> entry : m_colMapping.entrySet()) {
        NodeSettingsWO col = cols.addNodeSettings(entry.getKey());
        col.addDataCellArray(COLUMN_ORDERING, entry.getValue().toArray(new DataCell[entry.getValue().size()]));
        Set<DataCell> createdValues = m_createdDomainValues.get(entry.getKey());
        if (createdValues != null && !createdValues.isEmpty()) {
            // 
            col.addDataCellArray(// 
            COLUMN_CREATED_VALS, createdValues.toArray(new DataCell[createdValues.size()]));
        }
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO) DataCell(org.knime.core.data.DataCell) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 30 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class Joiner2NodeModel method saveInternals.

/**
 * {@inheritDoc}
 */
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
    NodeSettings internalSettings = new NodeSettings("joiner");
    NodeSettingsWO leftMapSet = internalSettings.addNodeSettings("leftHiliteMapping");
    ((DefaultHiLiteMapper) m_leftTranslator.getMapper()).save(leftMapSet);
    NodeSettingsWO rightMapSet = internalSettings.addNodeSettings("rightHiliteMapping");
    ((DefaultHiLiteMapper) m_rightTranslator.getMapper()).save(rightMapSet);
    File f = new File(nodeInternDir, "joinerInternalSettings");
    FileOutputStream out = new FileOutputStream(f);
    internalSettings.saveToXML(out);
}
Also used : NodeSettings(org.knime.core.node.NodeSettings) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) FileOutputStream(java.io.FileOutputStream) DefaultHiLiteMapper(org.knime.core.node.property.hilite.DefaultHiLiteMapper) File(java.io.File)

Aggregations

NodeSettingsWO (org.knime.core.node.NodeSettingsWO)111 NodeSettings (org.knime.core.node.NodeSettings)16 Map (java.util.Map)11 File (java.io.File)9 FileOutputStream (java.io.FileOutputStream)9 LinkedHashMap (java.util.LinkedHashMap)9 HashMap (java.util.HashMap)8 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)8 RowKey (org.knime.core.data.RowKey)6 DataCell (org.knime.core.data.DataCell)5 BufferedOutputStream (java.io.BufferedOutputStream)4 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)4 HashSet (java.util.HashSet)3 GZIPOutputStream (java.util.zip.GZIPOutputStream)3 DataRow (org.knime.core.data.DataRow)3 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)3 AbstractQuickFormConfiguration (org.knime.core.quickform.AbstractQuickFormConfiguration)3 AbstractQuickFormValueInConfiguration (org.knime.core.quickform.AbstractQuickFormValueInConfiguration)3 QuickFormInputNode (org.knime.core.quickform.in.QuickFormInputNode)3 MutableInteger (org.knime.core.util.MutableInteger)3