1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.monitoring.statistics;
16  
17  /**
18   * <a href="BaseStatistics.java.html"><b><i>View Source</i></b></a>
19   *
20   * @author Rajesh Thiagarajan
21   * @author Brian Wing Shun Chan
22   */
23  public class BaseStatistics implements Statistics {
24  
25      public BaseStatistics(String name) {
26          _name = name;
27          _startTime = System.currentTimeMillis();
28      }
29  
30      public String getDescription() {
31          return _description;
32      }
33  
34      public long getLastSampleTime() {
35          return _lastSampleTime;
36      }
37  
38      public long getLastTime() {
39          return _lastTime;
40      }
41  
42      public long getLowerBound() {
43          return _lowerBound;
44      }
45  
46      public long getMaxTime() {
47          return _maxTime;
48      }
49  
50      public long getMinTime() {
51          return _minTime;
52      }
53  
54      public String getName() {
55          return _name;
56      }
57  
58      public long getStartTime() {
59          return _startTime;
60      }
61  
62      public long getUpperBound() {
63          return _upperBound;
64      }
65  
66      public long getUptime() {
67          return System.currentTimeMillis() - _startTime;
68      }
69  
70      public void reset() {
71          _maxTime = 0;
72          _minTime = 0;
73          _lastTime = 0;
74          _startTime = System.currentTimeMillis();
75          _lastSampleTime = _startTime;
76      }
77  
78      public void setDescription(String description) {
79          _description = description;
80      }
81  
82      public void setLastSampleTime(long lastSampleTime) {
83          _lastSampleTime = lastSampleTime;
84      }
85  
86      public void setLastTime(long lastTime) {
87          _lastTime = lastTime;
88      }
89  
90      public void setLowerBound(long lowerBound) {
91          _lowerBound = lowerBound;
92      }
93  
94      public void setMaxTime(long maxTime) {
95          _maxTime = maxTime;
96      }
97  
98      public void setMinTime(long minTime) {
99          _minTime = minTime;
100     }
101 
102     public void setStartTime(long startTime) {
103         _startTime = startTime;
104     }
105 
106     public void setUpperBound(long upperBound) {
107         _upperBound = upperBound;
108     }
109 
110     private String _description;
111     private long _lastSampleTime;
112     private long _lastTime;
113     private long _lowerBound;
114     private long _maxTime;
115     private long _minTime;
116     private String _name;
117     private long _startTime;
118     private long _upperBound;
119 
120 }