Package dev.nm.stat.descriptive
Class SynchronizedStatistic
- java.lang.Object
-
- dev.nm.stat.descriptive.SynchronizedStatistic
-
- All Implemented Interfaces:
Statistic
public class SynchronizedStatistic extends Object implements Statistic
This is a thread-safe wrapper ofStatistic
by synchronizing all public methods so that only one thread at a time can access the instance. This is essentially the same principle used by Java's synchronized collection class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addData(double... data)
Recompute the statistic with more data, incrementally if possible.long
N()
Get the size of the sample.double
value()
Get the value of the statistic.
-