summaryrefslogtreecommitdiffstats
path: root/src/test/util/Timer.java
blob: 5a45cc0a05314395070fa0dbf0142a9f1e1470f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package test.util;

import java.util.HashMap;

public class Timer {

	private static HashMap<String, Double> mapValue = new HashMap<String, Double>(); 
	
	public static void addTime(int index, long value) {
		addTime(String.valueOf(index), value);
	}

	public static double getTime(int index) {
		return mapValue.get(String.valueOf(index));
	}

	public static void addTime(String index, double value) {
		Double val = mapValue.get(index);
		if(val != null) {
			value+=val.doubleValue();
		}  
		mapValue.put(index, value);
	}

	public static double getTime(String index) {
		Double value = mapValue.get(index);
		return value==null?0:value.doubleValue();
	}
	
}