|
|||||||||
| Home >> All >> ro >> nolimits >> rue >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
ro.nolimits.rue.util
Class AveragePerTimeCounter

java.lang.Objectro.nolimits.rue.util.AveragePerTimeCounter
- All Implemented Interfaces:
- java.io.Serializable
- public class AveragePerTimeCounter
- extends java.lang.Object
- implements java.io.Serializable
- extends java.lang.Object
Used to count life-time.
Given a time period, it tracks the number of cals of the hit()
method durring that time period, and makes an average of the values
passed in.
- Version:
- $Revision: 0.5.1.1 $ $Date: 2000/08/01 10:52:45 $
| Field Summary | |
private java.util.Vector |
_fifo
|
private long |
_timePeriod
The time (in ms) durring which a hit will be considered as active |
private java.util.Vector |
_values
|
| Constructor Summary | |
AveragePerTimeCounter()
Default constructor |
|
AveragePerTimeCounter(long time_int)
It constructs the counterand initialize the time interval used to count a set of elements to the time_int value. |
|
| 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. |
float |
getAverage()
Returns the average of the values setted through the hit(float) method durring the specified with setTimeInterval |
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(float value)
Registers another hit and passes the value which will be averaged |
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 |
| Field Detail |
_timePeriod
private long _timePeriod
- The time (in ms) durring which a hit will be considered as active
_fifo
private java.util.Vector _fifo
_values
private java.util.Vector _values
| Constructor Detail |
AveragePerTimeCounter
public AveragePerTimeCounter()
- Default constructor
AveragePerTimeCounter
public AveragePerTimeCounter(long time_int)
- It constructs the counterand initialize the time interval used
to count a set of elements to the time_int value.
| Method Detail |
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(float value)
- Registers another hit and passes the value which will be averaged
getCount
public long getCount()
- Returns the number of hits occured during the last x milliseconds
specified with setTimeInterval
getAverage
public float getAverage()
- Returns the average of the values setted through the hit(float)
method durring the specified with setTimeInterval
|
|||||||||
| Home >> All >> ro >> nolimits >> rue >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
ro.nolimits.rue.util.AveragePerTimeCounter