use of org.knime.base.node.preproc.columntrans2.BinaryCellFactory 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;
}
Aggregations