@Equality public abstract class Combiner extends Object
Instances of this class can produce Container
and BinList
objects into which values can be accumulated.
Once populated, those objects can be interrogated to find
combined values.
Note that in general those accumulated results
should be multiplied by the result of calling
Combiner.Type.getBinFactor(double)
before use.
Note that the SUM
mode is usually sensible for unweighted values,
but if the values are weighted it may be more revealing to use
one of the others (like MEAN
).
Modifier and Type | Class and Description |
---|---|
static interface |
Combiner.Container
Defines an object that can be used to accumulate values and
retrieve a result.
|
static class |
Combiner.Type
Defines the scaling properties of a combiner.
|
Modifier and Type | Field and Description |
---|---|
static Combiner |
COUNT
Calculate the number of submitted values.
|
static Combiner |
DENSITY
Calculate the density of all submitted values.
|
static Combiner |
HIT
Return 1 if any value submitted, 0 otherwise.
|
static Combiner |
MAX
Calculate the maximum of all submitted values.
|
static Combiner |
MEAN
Calculate the mean of all submitted values.
|
static Combiner |
MEDIAN
Calculate the median of all submitted values (slow).
|
static Combiner |
MIN
Calculate the minimum of all submitted values.
|
static Combiner |
POP_STDEV
Calculate the population standard deviation of all submitted values.
|
static Combiner |
Q01
Calculate the 1st percentile of all submitted values (slow).
|
static Combiner |
Q1
Calculate the first quartile of all submitted values (slow).
|
static Combiner |
Q3
Calculate the third quartile of all submitted values (slow).
|
static Combiner |
Q99
Calculate the 99th percentile of all submitted values (slow).
|
static Combiner |
SAMPLE_STDEV
Calculate the sample standard deviation of all submitted values.
|
static Combiner |
SUM
Calculate the sum of all submitted values.
|
static Combiner |
WEIGHTED_DENSITY
Calculate the weighted density of all submitted values.
|
Modifier | Constructor and Description |
---|---|
protected |
Combiner(String name,
String description,
Combiner.Type type,
boolean hasBigBin)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract ArrayBinList |
createArrayBinList(int size)
May be able to create a bin list suitable for non-sparse,
moderate-sized index ranges.
|
abstract ValueInfo |
createCombinedInfo(ValueInfo info,
Unit scaleUnit)
Returns a metadata object that describes the result of applying
this combiner to data described by a given metadata object.
|
abstract Combiner.Container |
createContainer()
Creates an object which can be used to accumulate values.
|
static Combiner |
createQuantileCombiner(String name,
String descrip,
double quantile)
Creates a combiner that calculates a given quantile.
|
String |
getDescription()
Returns a short textual description of this combiner.
|
static Combiner[] |
getKnownCombiners()
Returns a list of the known general purpose instances of this class.
|
String |
getName()
Returns this combiner's name.
|
Combiner.Type |
getType()
Indicates the aggregation type.
|
boolean |
hasBigBin()
Indicates whether the bin objects used by this combiner are large.
|
String |
toString() |
public static final Combiner COUNT
public static final Combiner DENSITY
public static final Combiner SUM
public static final Combiner WEIGHTED_DENSITY
public static final Combiner MEAN
public static final Combiner MEDIAN
public static final Combiner Q1
public static final Combiner Q3
public static final Combiner SAMPLE_STDEV
public static final Combiner POP_STDEV
public static final Combiner MIN
public static final Combiner MAX
public static final Combiner HIT
public static final Combiner Q01
public static final Combiner Q99
protected Combiner(String name, String description, Combiner.Type type, boolean hasBigBin)
name
- namedescription
- short textual descriptiontype
- defines the kind of aggregation performed;
note the implementation of this class does not
use this value to affect the bin results
calculated by this combiner, but users of this
class should make use of it to interpret the
bin resultshasBigBin
- indicates whether the bins used by this combiner
are large
(take more memory than a double
)public abstract Combiner.Container createContainer()
Note: Since many container instances may by generated (when using a HashBinList) it is desirable to keep the returned objects as small as possible. In particular, it's a good idea to make the returned objects instances of a static class, to avoid an unncecessary reference to the owner object, unless there's a really compelling reason to do otherwise.
public abstract ArrayBinList createArrayBinList(int size)
size
- index range of required bin listpublic String getName()
public String getDescription()
public Combiner.Type getType()
public boolean hasBigBin()
double
.
This flag may be used to decide whether to compact bin list results.public abstract ValueInfo createCombinedInfo(ValueInfo info, Unit scaleUnit)
info
- metadata for values to be combined, usually numeric;
may be null if metadata unknownscaleUnit
- unit of bin extent by which bin values
are divided for density-like combiners;
may be null for unknown/natural unitspublic static Combiner[] getKnownCombiners()
public static Combiner createQuantileCombiner(String name, String descrip, double quantile)
name
- combiner namedescrip
- minimal description, or nullquantile
- quantile point, between 0 and 1Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.