public class BasicNumberStatistics extends Object
Modifier and Type | Field and Description |
---|---|
protected AtomicLong |
count |
protected AtomicMaxLong |
max |
protected AtomicMinLong |
min |
protected AtomicLong |
sum |
Constructor and Description |
---|
BasicNumberStatistics() |
Modifier and Type | Method and Description |
---|---|
protected void |
ensureDataExists()
检查是否供统计的数据存在,如果没有则抛异常
|
double |
getAvg()
取得平均值。如果此前并没有提供任何值给统计用,则会抛出异常。
|
long |
getCount()
取得已经提供给统计的值的个数。如果此前并没有提供任何值给统计用,则返回0。
|
long |
getMax()
取得最大值。如果此前并没有提供任何值给统计用,则会抛出异常。
|
long |
getMin()
取得最小值。如果此前并没有提供任何值给统计用,则会抛出异常。
|
long |
getSum()
取得加总值。如果此前并没有提供任何值给统计用,则返回0。
|
void |
merge(BasicNumberStatistics other)
Merge the statistics from another object into this one
|
void |
put(long value)
把一个值提供给统计
|
void |
reset()
Reset to initial status.
回复到初始状态。 |
String |
toString() |
protected AtomicMinLong min
protected AtomicMaxLong max
protected AtomicLong sum
protected AtomicLong count
public void merge(BasicNumberStatistics other)
other
- public void put(long value)
value
- 需要提供给统计的值protected void ensureDataExists()
public double getAvg()
public long getMin()
public long getMax()
public long getSum()
public long getCount()
public void reset()
Copyright © 2014. All Rights Reserved.