use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class AggregationColumnPanel method excludeColsChange.
/**
* @param excludeColNames the name of all columns that should be
* excluded from the aggregation panel
*/
public void excludeColsChange(final Collection<String> excludeColNames) {
final Set<String> excludeColNameSet = new HashSet<>(excludeColNames);
final List<DataColumnSpec> newList = new LinkedList<>();
// include all columns that are not in the exclude list
for (final DataColumnSpec colSpec : m_avAggrColSpecs) {
if (!excludeColNameSet.contains(colSpec.getName())) {
newList.add(colSpec);
}
}
final List<ColumnAggregator> oldAggregators = getTableModel().getRows();
final List<ColumnAggregator> newAggregators = new LinkedList<>();
for (final ColumnAggregator aggregator : oldAggregators) {
if (!excludeColNameSet.contains(aggregator.getOriginalColName())) {
newAggregators.add(aggregator);
}
}
initialize(newList, newAggregators, getInputTableSpec());
}
use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class AggregationColumnPanel method initialize.
/**
* Initializes the panel.
* @param spec the {@link DataTableSpec} of the input table
* @param colAggrs the {@link List} of {@link ColumnAggregator}s that are
* initially used
*/
public void initialize(final DataTableSpec spec, final List<ColumnAggregator> colAggrs) {
m_avAggrColSpecs.clear();
final List<DataColumnSpec> listElements = new LinkedList<>();
for (final DataColumnSpec colSpec : spec) {
m_avAggrColSpecs.add(colSpec);
listElements.add(colSpec);
}
// remove all invalid column aggregator
final List<ColumnAggregator> colAggrs2Use = new ArrayList<>(colAggrs.size());
for (final ColumnAggregator colAggr : colAggrs) {
final DataColumnSpec colSpec = spec.getColumnSpec(colAggr.getOriginalColName());
final boolean valid;
if (colSpec != null && colSpec.getType().equals(colAggr.getOriginalDataType())) {
valid = true;
} else {
valid = false;
}
colAggr.setValid(valid);
colAggrs2Use.add(colAggr);
}
initialize(listElements, colAggrs2Use, spec);
}
use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class AggregationColumnTableModel method removeColumns.
/**
* @param colNames the names of the columns to remove
*/
@Deprecated
protected void removeColumns(final Collection<String> colNames) {
if (colNames == null || colNames.isEmpty()) {
return;
}
final Set<String> colNameSet = new HashSet<>(colNames);
final Collection<ColumnAggregator> colAggr2Remove = new LinkedList<>();
for (final ColumnAggregator colAggr : getRows()) {
if (colNameSet.contains(colAggr.getOriginalColName())) {
colAggr2Remove.add(colAggr);
}
}
remove(colAggr2Remove);
}
use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class AggregationColumnPanel method excludeColsChange.
/**
* @param excludeColNames the name of all columns that should be
* excluded from the aggregation panel
*/
public void excludeColsChange(final Collection<String> excludeColNames) {
final Set<String> excludeColNameSet = new HashSet<>(excludeColNames);
final List<DataColumnSpec> newList = new LinkedList<>();
// include all columns that are not in the exclude list
for (final DataColumnSpec colSpec : m_avAggrColSpecs) {
if (!excludeColNameSet.contains(colSpec.getName())) {
newList.add(colSpec);
}
}
final List<ColumnAggregator> oldAggregators = getTableModel().getRows();
final List<ColumnAggregator> newAggregators = new LinkedList<>();
for (final ColumnAggregator aggregator : oldAggregators) {
if (!excludeColNameSet.contains(aggregator.getOriginalColName())) {
newAggregators.add(aggregator);
}
}
initialize(newList, newAggregators, getInputTableSpec());
}
use of org.knime.base.data.aggregation.ColumnAggregator in project knime-core by knime.
the class AggregationColumnTableModel method addColumn.
/**
* @param specs the {@link DataColumnSpec}s of the columns to add
* @see #add(List)
*/
@Deprecated
protected void addColumn(final DataColumnSpec... specs) {
if (specs == null || specs.length < 1) {
return;
}
final List<ColumnAggregator> aggregators = new ArrayList<>(specs.length);
for (final DataColumnSpec spec : specs) {
final AggregationMethod defaultMethod = AggregationMethods.getDefaultMethod(spec);
aggregators.add(new ColumnAggregator(spec, defaultMethod));
}
add(aggregators);
}
Aggregations