Class Combiner
- Direct Known Subclasses:
QuantileCombiner
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).
- Since:
- 20 Sep 2015
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines an object that can be used to accumulate values and retrieve a result.static enumDefines the scaling properties of a combiner. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CombinerCalculate the number of submitted values.static final CombinerCalculate the density of all submitted values.static final CombinerReturn 1 if any value submitted, 0 otherwise.static final CombinerCalculate the maximum of all submitted values.static final CombinerCalculate the mean of all submitted values.static final CombinerCalculate the median of all submitted values (slow).static final CombinerCalculate the minimum of all submitted values.static final CombinerCalculate the population standard deviation of all submitted values.static final CombinerCalculate the 1st percentile of all submitted values (slow).static final CombinerCalculate the first quartile of all submitted values (slow).static final CombinerCalculate the third quartile of all submitted values (slow).static final CombinerCalculate the 99th percentile of all submitted values (slow).static final CombinerCalculate the sample standard deviation of all submitted values.static final CombinerCalculate the sum of all submitted values.static final CombinerCalculate the weighted density of all submitted values. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCombiner(String name, String description, Combiner.Type type, boolean hasBigBin) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract ArrayBinListcreateArrayBinList(int size) May be able to create a bin list suitable for non-sparse, moderate-sized index ranges.abstract uk.ac.starlink.table.ValueInfocreateCombinedInfo(uk.ac.starlink.table.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.ContainerCreates an object which can be used to accumulate values.static CombinercreateQuantileCombiner(String name, String descrip, double quantile) Creates a combiner that calculates a given quantile.Returns a short textual description of this combiner.static Combiner[]Returns a list of the known general purpose instances of this class.getName()Returns this combiner's name.getType()Indicates the aggregation type.booleanIndicates whether the bin objects used by this combiner are large.toString()
-
Field Details
-
COUNT
Calculate the number of submitted values. -
DENSITY
Calculate the density of all submitted values. -
SUM
Calculate the sum of all submitted values. -
WEIGHTED_DENSITY
Calculate the weighted density of all submitted values. -
MEAN
Calculate the mean of all submitted values. -
MEDIAN
Calculate the median of all submitted values (slow). -
Q1
Calculate the first quartile of all submitted values (slow). -
Q3
Calculate the third quartile of all submitted values (slow). -
SAMPLE_STDEV
Calculate the sample standard deviation of all submitted values. -
POP_STDEV
Calculate the population standard deviation of all submitted values. -
MIN
Calculate the minimum of all submitted values. -
MAX
Calculate the maximum of all submitted values. -
HIT
Return 1 if any value submitted, 0 otherwise. -
Q01
Calculate the 1st percentile of all submitted values (slow). -
Q99
Calculate the 99th percentile of all submitted values (slow).
-
-
Constructor Details
-
Combiner
Constructor.- Parameters:
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 adouble)
-
-
Method Details
-
createContainer
Creates an object which can be used to accumulate values.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.
- Returns:
- new container
-
createArrayBinList
May be able to create a bin list suitable for non-sparse, moderate-sized index ranges. If a combiner implementation is able to provide an ArrayBinList implementation that should be significantly more efficient than a HashBinList, this method should return it. If not, it can return null.- Parameters:
size- index range of required bin list- Returns:
- array-based bin list, or null
-
getName
-
getDescription
Returns a short textual description of this combiner.- Returns:
- short description
-
getType
Indicates the aggregation type. This value should be used to make sense of the output bin list results.- Returns:
- aggregation type
-
hasBigBin
public boolean hasBigBin()Indicates whether the bin objects used by this combiner are large. Large means, roughly, take more memory than adouble. This flag may be used to decide whether to compact bin list results.- Returns:
- true if this combiner uses big bins
-
createCombinedInfo
public abstract uk.ac.starlink.table.ValueInfo createCombinedInfo(uk.ac.starlink.table.ValueInfo info, Unit scaleUnit) Returns a metadata object that describes the result of applying this combiner to data described by a given metadata object.- Parameters:
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 units- Returns:
- metadata for combined values; the content class must be be a primitive numeric wrapper class
-
toString
-
getKnownCombiners
Returns a list of the known general purpose instances of this class.- Returns:
- combiner list
-
createQuantileCombiner
-