Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/mobicents/slee/container/management/jmx/SampleStatisticsImpl.java


1   /*
2    * SampleStatisticsImpl.java
3    * 
4    * Created on Jan 12, 2005
5    * 
6    * Created by: M. Ranganathan
7    *
8    * The Mobicents Open SLEE project
9    * 
10   * A SLEE for the people!
11   *
12   * The source code contained in this file is in in the public domain.          
13   * It can be used in any project or product without prior permission,         
14   * license or royalty payments. There is  NO WARRANTY OF ANY KIND,
15   * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION,
16   * THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 
17   * AND DATA ACCURACY.  We do not warrant or make any representations 
18   * regarding the use of the software or the  results thereof, including 
19   * but not limited to the correctness, accuracy, reliability or 
20   * usefulness of the software.
21   */
22  
23  package org.mobicents.slee.container.management.jmx;
24  
25  import java.io.Serializable;
26  
27  import javax.slee.usage.SampleStatistics;
28  
29  import org.jboss.logging.Logger;
30  
31  /**
32   * The implementation of the sample statistics class.
33   * 
34   * @author M. Ranganathan
35   */
36  public class SampleStatisticsImpl implements SampleStatistics, Serializable {
37      private static Logger logger = Logger.getLogger(SampleStatisticsImpl.class);
38  
39      private long sampleCount;
40  
41      private long minimum;
42  
43      private long maximum;
44  
45      private double mean;
46  
47      public SampleStatisticsImpl(double mean, long minimum, long maximum,
48              long sampleCount) {
49          //new Exception().printStackTrace();
50          this.sampleCount = sampleCount;
51          this.minimum = minimum;
52          this.maximum = maximum;
53          /*if (sampleCount != 0) {
54              this.mean = (double) ((double) sum / (double) sampleCount);
55          } else
56              this.mean = 0;*/
57          this.mean = mean;
58              
59          if (logger.isDebugEnabled()) {
60              logger.debug("Generating SampleSatisticsImpl ... ");
61              logger.debug("sampleCount = " + sampleCount);
62              logger.debug("minimum = " + minimum);
63              logger.debug("maximum = " + maximum);
64              logger.debug("mean = " + mean);
65          }
66      }
67  
68      /*
69       * (non-Javadoc)
70       * 
71       * @see javax.slee.usage.SampleStatistics#getSampleCount()
72       */
73      public long getSampleCount() {
74  
75          return sampleCount;
76      }
77  
78      /*
79       * (non-Javadoc)
80       * 
81       * @see javax.slee.usage.SampleStatistics#getMinimum()
82       */
83      public long getMinimum() {
84  
85          return this.minimum;
86      }
87  
88      /*
89       * (non-Javadoc)
90       * 
91       * @see javax.slee.usage.SampleStatistics#getMaximum()
92       */
93      public long getMaximum() {
94  
95          return this.maximum;
96      }
97  
98      /*
99       * (non-Javadoc)
100      * 
101      * @see javax.slee.usage.SampleStatistics#getMean()
102      */
103     public double getMean() {
104 
105         return this.mean;
106     }
107 
108 }
109