Search in sources :

Example 1 with InputFilter

use of org.knime.core.node.util.filter.InputFilter in project knime-core by knime.

the class EditNominalDomainDicConfiguration method guessDefaultColumnFilter.

/**
 * Sets default in the filter configuration: Columns in common (name & type) go to the include list, others to
 * the exclude list.
 * @param origSpec ...
 * @param valueSpec ...
 */
void guessDefaultColumnFilter(final DataTableSpec origSpec, final DataTableSpec valueSpec) {
    // includes all column which are present in both DTS; also have to have the same type.
    InputFilter<DataColumnSpec> defaultGuessFilter = new InputFilter<DataColumnSpec>() {

        @Override
        public boolean include(final DataColumnSpec valueColumnSpec) {
            DataColumnSpec columnSpec = origSpec.getColumnSpec(valueColumnSpec.getName());
            return columnSpec == null ? false : columnSpec.getType().equals(valueColumnSpec.getType());
        }
    };
    m_filterConfiguration.loadDefault(valueSpec, defaultGuessFilter, true);
}
Also used : InputFilter(org.knime.core.node.util.filter.InputFilter) DataColumnSpec(org.knime.core.data.DataColumnSpec)

Aggregations

DataColumnSpec (org.knime.core.data.DataColumnSpec)1 InputFilter (org.knime.core.node.util.filter.InputFilter)1