|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jabb.util.stat.BasicNumberStatistics
public class BasicNumberStatistics
提供基本的统计信息,包括: 最大值、最小值、平均值、总计、个数。 它是多线程安全的。
| Field Summary | |
|---|---|
protected AtomicLong |
count
|
protected AtomicMaxLong |
max
|
protected AtomicMinLong |
min
|
protected AtomicLong |
sum
|
| Constructor Summary | |
|---|---|
BasicNumberStatistics()
|
|
| Method Summary | |
|---|---|
protected void |
ensureDataExists()
检查是否供统计的数据存在,如果没有则抛异常 |
double |
getAvg()
取得平均值。如果此前并没有提供任何值给统计用,则会抛出异常。 |
long |
getCount()
取得已经提供给统计的值的个数。如果此前并没有提供任何值给统计用,则返回0。 |
long |
getMax()
取得最大值。如果此前并没有提供任何值给统计用,则会抛出异常。 |
long |
getMin()
取得最小值。如果此前并没有提供任何值给统计用,则会抛出异常。 |
long |
getSum()
取得加总值。如果此前并没有提供任何值给统计用,则返回0。 |
void |
put(long value)
把一个值提供给统计 |
void |
reset()
Reset to initial status. 回复到初始状态。 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AtomicMinLong min
protected AtomicMaxLong max
protected AtomicLong sum
protected AtomicLong count
| Constructor Detail |
|---|
public BasicNumberStatistics()
| Method Detail |
|---|
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||