Revision 1396,
1.3 KB
checked in by wojtekp, 11 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[1207] | 1 | package simulator.stats; |
---|
| 2 | |
---|
| 3 | import java.util.ArrayList; |
---|
| 4 | import java.util.HashMap; |
---|
| 5 | import java.util.List; |
---|
| 6 | import java.util.Map; |
---|
| 7 | |
---|
| 8 | import simulator.stats.implementation.MetricsStats; |
---|
| 9 | |
---|
[1299] | 10 | public abstract class AbstractMetricsCalculator implements MetricsCalculator{ |
---|
[1207] | 11 | |
---|
| 12 | protected static final double MILLI_SEC = 1000; |
---|
| 13 | protected static final double SEC_IN_HOUR = 3600; |
---|
| 14 | |
---|
[1396] | 15 | protected Map<String, List<DCwormsAccumulator>> metricsData = new HashMap<String, List<DCwormsAccumulator>>(); |
---|
[1299] | 16 | |
---|
[1207] | 17 | protected long startTime; |
---|
| 18 | protected long endTime; |
---|
[1299] | 19 | protected long timestamp; |
---|
| 20 | |
---|
| 21 | public AbstractMetricsCalculator(long startTime, long endTime, long timestamp) { |
---|
| 22 | super(); |
---|
| 23 | this.startTime = startTime; |
---|
| 24 | this.endTime = endTime; |
---|
[1207] | 25 | this.timestamp = timestamp; |
---|
| 26 | } |
---|
| 27 | |
---|
[1299] | 28 | abstract public List<MetricsStats> calulateMetrics(); |
---|
| 29 | |
---|
[1396] | 30 | public void addMetricsData(String resourceTypeName, DCwormsAccumulator resourceEnergyAccumulator){ |
---|
| 31 | List<DCwormsAccumulator> resourceEnergyAccumulatorList = metricsData.get(resourceTypeName); |
---|
[1207] | 32 | if(resourceEnergyAccumulatorList == null){ |
---|
[1396] | 33 | resourceEnergyAccumulatorList = new ArrayList<DCwormsAccumulator>(); |
---|
[1207] | 34 | } |
---|
| 35 | resourceEnergyAccumulatorList.add(resourceEnergyAccumulator); |
---|
| 36 | metricsData.put(resourceTypeName, resourceEnergyAccumulatorList); |
---|
| 37 | } |
---|
| 38 | |
---|
[1396] | 39 | public Map<String, List<DCwormsAccumulator>> getMetricsData(){ |
---|
[1207] | 40 | return metricsData; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.