Search in sources :

Example 1 with RegExpCellFactory

use of org.knime.base.node.preproc.columntrans2.RegExpCellFactory in project knime-core by knime.

the class Many2OneCol2PMMLNodeModel method getCellFactory.

private AbstractMany2OneCellFactory getCellFactory(final DataTableSpec spec) {
    AbstractMany2OneCellFactory cellFactory;
    IncludeMethod method = IncludeMethod.valueOf(m_includeMethod.getStringValue());
    FilterResult filterResult = m_includedColumns.applyTo(spec);
    String[] includes = filterResult.getIncludes();
    int[] includedColIndices = new int[includes.length];
    int index = 0;
    for (String colName : includes) {
        includedColIndices[index++] = spec.findColumnIndex(colName);
    }
    String newColName = DataTableSpec.getUniqueColumnName(spec, m_appendedColumnName.getStringValue());
    m_appendedColumnName.setStringValue(newColName);
    if (method.equals(IncludeMethod.RegExpPattern)) {
        cellFactory = new RegExpCellFactory(spec, newColName, includedColIndices, m_pattern.getStringValue());
    } else if (method.equals(IncludeMethod.Minimum)) {
        cellFactory = new MinMaxCellFactory(spec, newColName, includedColIndices, false);
    } else if (method.equals(IncludeMethod.Binary)) {
        cellFactory = new BinaryCellFactory(spec, newColName, includedColIndices);
    } else {
        cellFactory = new MinMaxCellFactory(spec, newColName, includedColIndices, true);
    }
    return cellFactory;
}
Also used : RegExpCellFactory(org.knime.base.node.preproc.columntrans2.RegExpCellFactory) BinaryCellFactory(org.knime.base.node.preproc.columntrans2.BinaryCellFactory) AbstractMany2OneCellFactory(org.knime.base.node.preproc.columntrans2.AbstractMany2OneCellFactory) FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) MinMaxCellFactory(org.knime.base.node.preproc.columntrans2.MinMaxCellFactory)

Aggregations

AbstractMany2OneCellFactory (org.knime.base.node.preproc.columntrans2.AbstractMany2OneCellFactory)1 BinaryCellFactory (org.knime.base.node.preproc.columntrans2.BinaryCellFactory)1 MinMaxCellFactory (org.knime.base.node.preproc.columntrans2.MinMaxCellFactory)1 RegExpCellFactory (org.knime.base.node.preproc.columntrans2.RegExpCellFactory)1 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)1 FilterResult (org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)1