java.lang.Object
ro.nolimits.rue.util.HitPerTimeCounter
- All Implemented Interfaces:
- java.io.Serializable
- public class HitPerTimeCounter
- extends java.lang.Object
- implements java.io.Serializable
Used to count life-time.
Given a time period, it tracks the number of cals of the hit()
method durring that time period.
- Version:
- $Revision: 0.5.1.1 $ $Date: 2000/08/01 10:52:41 $
|
Method Summary |
private void |
cleanFIFO(long curr_time)
That's the way we count hits, we put the time of the hit in a fifo
then we only have to care to keep in the fifo only the values which
are in our time interval. |
long |
getCount()
Returns the number of hits occured during the last x milliseconds
specified with setTimeInterval |
long |
getTimeInterval()
With this method we can set the time interval used for counting hits |
void |
hit()
The main method for anouncing another hit |
void |
setTimeInterval(long time_int)
With this method we can set the time interval used for counting hits |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_timePeriod
private long _timePeriod
- The time (in ms) durring which a hit will be considered as active
_fifo
private java.util.Vector _fifo
HitPerTimeCounter
public HitPerTimeCounter()
- Default constructor
HitPerTimeCounter
public HitPerTimeCounter(long time_int)
setTimeInterval
public void setTimeInterval(long time_int)
- With this method we can set the time interval used for counting hits
cleanFIFO
private void cleanFIFO(long curr_time)
- That's the way we count hits, we put the time of the hit in a fifo
then we only have to care to keep in the fifo only the values which
are in our time interval.
We would only have to call this when a getCount is received, but in
for not getting too big without reasons we will call it also in hit()
getTimeInterval
public long getTimeInterval()
- With this method we can set the time interval used for counting hits
hit
public void hit()
- The main method for anouncing another hit
getCount
public long getCount()
- Returns the number of hits occured during the last x milliseconds
specified with setTimeInterval