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 if this accumulator is zero value or not.
|
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 boolean isZero()
AccumulatorV2
isZero
in class AccumulatorV2<Double,Double>
public DoubleAccumulator copy()
AccumulatorV2
copy
in class AccumulatorV2<Double,Double>
public void reset()
AccumulatorV2
isZero
must
return true.reset
in class AccumulatorV2<Double,Double>
public void add(Double v)
add
in class AccumulatorV2<Double,Double>
v
- (undocumented)public void add(double v)
v
- (undocumented)public long count()
public double sum()
public double avg()
public void merge(AccumulatorV2<Double,Double> other)
AccumulatorV2
merge
in class AccumulatorV2<Double,Double>
other
- (undocumented)public Double value()
AccumulatorV2
value
in class AccumulatorV2<Double,Double>