1 |
|
package com.dreamcatcher.bicycle.dataset; |
2 |
|
|
3 |
|
import java.util.ArrayList; |
4 |
|
import java.util.HashMap; |
5 |
|
|
6 |
|
import com.dreamcatcher.bicycle.vo.BicycleStationInfo; |
7 |
|
|
|
|
| 50% |
Uncovered Elements: 18 (36) |
Complexity: 13 |
Complexity Density: 0,68 |
|
8 |
|
public class BicycleDataset { |
9 |
|
private HashMap<Integer, BicycleStationInfo> mBicycleMap = null; |
10 |
|
private static BicycleDataset mInstance = null; |
11 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
12 |
1
|
private BicycleDataset(){... |
13 |
1
|
mBicycleMap = new HashMap<Integer, BicycleStationInfo>(); |
14 |
|
} |
15 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
16 |
9
|
public synchronized static BicycleDataset getInstance(){... |
17 |
9
|
if(mInstance == null){ |
18 |
1
|
mInstance = new BicycleDataset(); |
19 |
|
} |
20 |
9
|
return mInstance; |
21 |
|
} |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
@param |
26 |
|
@param |
27 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
28 |
186
|
public synchronized void addBicycleInfo(int id, BicycleStationInfo BicycleInfo){... |
29 |
|
|
30 |
186
|
if(!mBicycleMap.containsKey(id)){ |
31 |
186
|
mBicycleMap.put(id, BicycleInfo); |
32 |
|
}else { |
33 |
0
|
mBicycleMap.remove(id); |
34 |
0
|
mBicycleMap.put(id, BicycleInfo); |
35 |
|
} |
36 |
|
} |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@param |
41 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
42 |
0
|
public synchronized void delBicycleInfo(int id){... |
43 |
0
|
if(mBicycleMap.containsKey(id)){ |
44 |
0
|
mBicycleMap.remove(id); |
45 |
|
} |
46 |
|
} |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
@param |
51 |
|
@param |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
53 |
0
|
public synchronized void updateBicycleInfo(int id, BicycleStationInfo newBicycleInfo){... |
54 |
0
|
if(mBicycleMap.containsKey(id)){ |
55 |
0
|
mBicycleMap.remove(id); |
56 |
|
} |
57 |
0
|
mBicycleMap.put(id, newBicycleInfo); |
58 |
|
} |
59 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
0
|
public synchronized BicycleStationInfo getBicycleInfo(int id){... |
61 |
0
|
return mBicycleMap.get(id); |
62 |
|
} |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
0
|
public synchronized int getBicycleCount(){... |
65 |
0
|
return mBicycleMap.keySet().size(); |
66 |
|
} |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
68 |
2
|
public synchronized void clearData(){... |
69 |
2
|
mBicycleMap.clear(); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
|
72 |
15
|
public synchronized ArrayList<BicycleStationInfo> getBicycleStationInfos(){... |
73 |
15
|
ArrayList<BicycleStationInfo> arrayList = new ArrayList<BicycleStationInfo>(); |
74 |
15
|
arrayList.addAll(mBicycleMap.values()); |
75 |
15
|
return arrayList; |
76 |
|
} |
77 |
|
} |