FileDocCategorySizeDatePackage
AverageRangeStatisticImpl.javaAPI DocGlassfish v2 API6662Fri May 04 22:25:48 BST 2007com.sun.enterprise.admin.monitor.stats

AverageRangeStatisticImpl

public class AverageRangeStatisticImpl extends Object implements AverageRangeStatistic
author
lwhite

Fields Summary
private BoundedRangeStatisticImpl
boundedRangeStatistic
private long
numberOfSamples
private long
runningTotal
Constructors Summary
public AverageRangeStatisticImpl(long curVal, long highMark, long lowMark, long upper, long lower, String name, String unit, String desc, long startTime, long sampleTime, long numberOfSamples, long runningTotal)
Constructs an immutable instance of AverageRangeStatisticImpl.

param
curVal The current value of this statistic
param
highMark The highest value of this statistic, since measurement started
param
lowMark The lowest value of this statistic, since measurement started
param
upper The upper limit of this statistic
param
lower The lower limit of this statistic
param
name The name of the statistic
param
unit The unit of measurement for this statistic
param
desc A brief description of the statistic
param
startTime Time in milliseconds at which the measurement was started
param
sampleTime Time at which the last measurement was done.
param
numberOfSamples number of samples at present
param
runningTotal running total of sampled data at present

    
    
    
	                                                                                                                                                                                          
	      
                                          
                                          
                                        
                                       
                                         
        boundedRangeStatistic = new BoundedRangeStatisticImpl(curVal, highMark, lowMark,
                                     upper, lower, name,
                                     unit, desc, startTime,
                                     sampleTime);                                 
                                         
        this.numberOfSamples = numberOfSamples;
        this.runningTotal = runningTotal;
    
public AverageRangeStatisticImpl(BoundedRangeStatisticImpl stats, long numberOfSamples, long runningTotal)
Constructs an immutable instance of AverageRangeStatisticImpl.

param
stats a BoundedRangeStatisticImpl
param
numberOfSamples number of samples at present
param
runningTotal running total of sampled data at present

                                         
        boundedRangeStatistic = stats;                                                                          
        this.numberOfSamples = numberOfSamples;
        this.runningTotal = runningTotal;
    
Methods Summary
public longgetAverage()

        if(numberOfSamples == 0) {
            return -1;
        } else {
            return runningTotal / numberOfSamples;
        }        
    
public longgetCurrent()

        return boundedRangeStatistic.getCurrent();
    
public java.lang.StringgetDescription()

        return boundedRangeStatistic.getDescription();
    
public longgetHighWaterMark()

        return boundedRangeStatistic.getHighWaterMark();
    
public longgetLastSampleTime()

        return boundedRangeStatistic.getLastSampleTime();
    
public longgetLowWaterMark()

        return boundedRangeStatistic.getLowWaterMark();
    
public java.lang.StringgetName()

        return boundedRangeStatistic.getName();
    
public longgetStartTime()

        return boundedRangeStatistic.getStartTime();
    
public java.lang.StringgetUnit()

        return boundedRangeStatistic.getUnit();
    
public voidsetDescription(java.lang.String desc)
This is a hack. This method allows us to internatinalize the descriptions. See bug Id: 5045413

        this.boundedRangeStatistic.setDescription(desc);