Clover Coverage Report - Main Coverage Report
Coverage timestamp: ven dic 19 2014 16:47:52 EST
../../../../img/srcFileCovDistChart5.png 64% of files have more coverage
19   77   13   2,11
8   50   0,68   9
9     1,44  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  BicycleDataset       Line # 8 19 13 50% 0.5
 
No Tests
 
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   
 
8    public class BicycleDataset {
9    private HashMap<Integer, BicycleStationInfo> mBicycleMap = null;
10    private static BicycleDataset mInstance = null;
11   
 
12  1 toggle private BicycleDataset(){
13  1 mBicycleMap = new HashMap<Integer, BicycleStationInfo>();
14    }
15   
 
16  9 toggle public synchronized static BicycleDataset getInstance(){
17  9 if(mInstance == null){
18  1 mInstance = new BicycleDataset();
19    }
20  9 return mInstance;
21    }
22   
23    /**
24    * add bicycle station info to map, if already in map, update it
25    * @param id
26    * @param BicycleInfo
27    */
 
28  186 toggle 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    * remove a bicycle station info from map
40    * @param id
41    */
 
42  0 toggle public synchronized void delBicycleInfo(int id){
43  0 if(mBicycleMap.containsKey(id)){
44  0 mBicycleMap.remove(id);
45    }
46    }
47   
48    /**
49    * update a bicycle station info
50    * @param id
51    * @param newBicycleInfo
52    */
 
53  0 toggle 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   
 
60  0 toggle public synchronized BicycleStationInfo getBicycleInfo(int id){
61  0 return mBicycleMap.get(id);
62    }
63   
 
64  0 toggle public synchronized int getBicycleCount(){
65  0 return mBicycleMap.keySet().size();
66    }
67   
 
68  2 toggle public synchronized void clearData(){
69  2 mBicycleMap.clear();
70    }
71   
 
72  15 toggle 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    }