net.sf.jabb.util.stat
Class PackagedFrequencyCounter

java.lang.Object
  extended by net.sf.jabb.util.stat.FrequencyCounter
      extended by net.sf.jabb.util.stat.PackagedFrequencyCounter

public class PackagedFrequencyCounter
extends FrequencyCounter

打包封装好的频次计数工具

Author:
Zhengmao HU (James)

Field Summary
protected  Map<Object,BasicFrequencyCounter> counters
           
 
Constructor Summary
PackagedFrequencyCounter(Collection<FrequencyCounterDefinition> counterDefinitions)
          创建包含多个BasicFrequencyCounter对象的计数器组合
PackagedFrequencyCounter(FrequencyCounterDefinition... counterDefinitions)
          创建包含多个BasicFrequencyCounter对象的计数器组合
 
Method Summary
 void count(long when, int times)
          记录在某时刻发生了多少次
 long getCount(long when)
          获得某时刻的统计数
 long getCount(long fromWhen, long toWhen, boolean fromInclusive, boolean toInclusive)
          获得在某时段内的总统计数
 BasicFrequencyCounter getCounter(Object id)
          根据ID,获取ID所对应的BasicFrequencyCounter
 void purge(long tillWhen)
          清除过旧的历史数据
 String toString()
          转为字符串
 
Methods inherited from class net.sf.jabb.util.stat.FrequencyCounter
count, count, count, count, count, getCount, getCount, getCount, getCount, getCount, getCount, getCount, purge, purge, purge, purge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

counters

protected Map<Object,BasicFrequencyCounter> counters
Constructor Detail

PackagedFrequencyCounter

public PackagedFrequencyCounter(Collection<FrequencyCounterDefinition> counterDefinitions)
创建包含多个BasicFrequencyCounter对象的计数器组合

Parameters:
counterDefinitions - 各个BasicFrequencyCounter的配置信息,请注意它们的ID必须设置

PackagedFrequencyCounter

public PackagedFrequencyCounter(FrequencyCounterDefinition... counterDefinitions)
创建包含多个BasicFrequencyCounter对象的计数器组合

Parameters:
counterDefinitions - 各个BasicFrequencyCounter的配置信息,请注意它们的ID必须设置
Method Detail

getCounter

public BasicFrequencyCounter getCounter(Object id)
根据ID,获取ID所对应的BasicFrequencyCounter

Parameters:
id - 要获得的BasicFrequencyCounter的ID
Returns:
与指定ID所对应的BasicFrequencyCounter

purge

public void purge(long tillWhen)
Description copied from class: FrequencyCounter
清除过旧的历史数据

Specified by:
purge in class FrequencyCounter
Parameters:
tillWhen - 清除到哪个时间点为止

count

public void count(long when,
                  int times)
Description copied from class: FrequencyCounter
记录在某时刻发生了多少次

Specified by:
count in class FrequencyCounter
Parameters:
when - 发生的时刻
times - 发生的次数

getCount

public long getCount(long when)
Description copied from class: FrequencyCounter
获得某时刻的统计数

Specified by:
getCount in class FrequencyCounter
Parameters:
when - 时刻
Returns:
统计数

getCount

public long getCount(long fromWhen,
                     long toWhen,
                     boolean fromInclusive,
                     boolean toInclusive)
Description copied from class: FrequencyCounter
获得在某时段内的总统计数

Specified by:
getCount in class FrequencyCounter
Parameters:
fromWhen - 开始时间
toWhen - 结束时间
fromInclusive - 是否包含开始时间
toInclusive - 是否包含结束时间
Returns:
统计数

toString

public String toString()
转为字符串

Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.