use of org.knime.base.data.aggregation.AggregationMethod in project knime-core by knime.
the class NumericOutliersIntervalsCalculator method getAggretators.
/**
* Creates column aggregators for each of the outlier columns.
*
* @param inSpec the input data table spec
* @param gSettings the global settings
* @return an array of column aggregators
*/
private ColumnAggregator[] getAggretators(final DataTableSpec inSpec, final GlobalSettings gSettings) {
final ColumnAggregator[] aggregators = new ColumnAggregator[m_outlierColNames.length * 2];
int pos = 0;
// for each outlier column name create the aggregators
for (final String outlierColName : m_outlierColNames) {
// the operator column settings
final OperatorColumnSettings cSettings = new OperatorColumnSettings(INCL_MISSING_CELLS, inSpec.getColumnSpec(outlierColName));
// setting
for (final double percentile : PERCENTILES) {
final AggregationMethod method;
if (m_useHeuristic) {
method = new PSquarePercentileOperator(gSettings, cSettings, 100 * percentile);
} else {
method = new QuantileOperator(new OperatorData("Quantile", true, false, DoubleValue.class, INCL_MISSING_CELLS), gSettings, cSettings, percentile, m_estimationType.name());
}
aggregators[pos++] = new ColumnAggregator(cSettings.getOriginalColSpec(), method);
}
}
// return the aggregators
return aggregators;
}
use of org.knime.base.data.aggregation.AggregationMethod in project knime-core by knime.
the class AggregationColumnTableModel method setValue.
/**
* {@inheritDoc}
*/
@Override
public void setValue(final Object aValue, final int row, final int columnIdx) {
if (aValue == null) {
return;
}
if (aValue instanceof AggregationMethod) {
assert columnIdx == 1;
final AggregationMethod newMethod = (AggregationMethod) aValue;
updateMethod(row, newMethod);
}
}
use of org.knime.base.data.aggregation.AggregationMethod in project knime-core by knime.
the class AggregationColumnTableModel method updateMethod.
/**
* @param row the row to update
* @param method the {@link AggregationMethod} to use
*/
private void updateMethod(final int row, final AggregationMethod method) {
final ColumnAggregator old = getRow(row);
if (old.getMethodTemplate().equals(method)) {
// check if the method has changed
return;
}
// create a new operator each time it is updated to guarantee that
// each column has its own operator instance
AggregationMethod methodClone = AggregationMethods.getMethod4Id(method.getId());
updateRow(row, new ColumnAggregator(old.getOriginalColSpec(), methodClone, old.inclMissingCells()));
}
use of org.knime.base.data.aggregation.AggregationMethod 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);
}
use of org.knime.base.data.aggregation.AggregationMethod in project knime-core by knime.
the class AggregationMethodListCellRenderer method getListCellRendererComponent.
/**
* {@inheritDoc}
*/
@Override
public Component getListCellRendererComponent(final JList<?> list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
final Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
assert (c == this);
if (value instanceof AggregationMethod) {
final AggregationMethod aggregationMeth = (AggregationMethod) value;
setText(aggregationMeth.getLabel());
setToolTipText(aggregationMeth.getDescription());
}
return this;
}
Aggregations