public class DoubleAccumulator extends AccumulatorV2<Double,Double>
accumulator
for computing sum, count, and averages for double precision
floating numbers.
Constructor and Description |
---|
DoubleAccumulator() |
Modifier and Type | Method and Description |
---|---|
void |
add(double v)
Adds v to the accumulator, i.e.
|
void |
add(Double v)
Adds v to the accumulator, i.e.
|
double |
avg()
Returns the average of elements added to the accumulator.
|
DoubleAccumulator |
copy()
Creates a new copy of this accumulator.
|
long |
count()
Returns the number of elements added to the accumulator.
|
boolean |
isZero()
Returns false if this accumulator has had any values added to it or the sum is non-zero.
|
void |
merge(AccumulatorV2<Double,Double> other)
Merges another same-type accumulator into this one and update its state, i.e.
|
void |
reset()
Resets this accumulator, which is zero value.
|
double |
sum()
Returns the sum of elements added to the accumulator.
|
Double |
value()
Defines the current value of this accumulator
|
copyAndReset, id, isRegistered, name, toString
public void add(Double v)
add
in class AccumulatorV2<Double,Double>
v
- (undocumented)public void add(double v)
v
- (undocumented)public double avg()
public DoubleAccumulator copy()
AccumulatorV2
copy
in class AccumulatorV2<Double,Double>
public long count()
public boolean isZero()
isZero
in class AccumulatorV2<Double,Double>
public void merge(AccumulatorV2<Double,Double> other)
AccumulatorV2
merge
in class AccumulatorV2<Double,Double>
other
- (undocumented)public void reset()
AccumulatorV2
isZero
must
return true.reset
in class AccumulatorV2<Double,Double>
public double sum()
public Double value()
AccumulatorV2
value
in class AccumulatorV2<Double,Double>