1   package examples.bookTrading;
2   
3   import java.util.TreeMap;
4   import java.util.concurrent.ConcurrentHashMap;
5   
6   /**
7    * This class stores and retrieves information about the communicating vehicles such as map of ranked list of routes, 
8    * map of vehicles for every route and saved route choices.
9    * @author prajakta
10   *
11   */
12  public class CommunicatingVehicles {
13      
14      
15      public CommunicatingVehicles(String commString){
16          this.commID = commString;
17          routeRankMapForCommID = new ConcurrentHashMap();
18          setRouteRankMapForCommID(routeRankMapForCommID);
19          masterMapForCommID = new ConcurrentHashMap<String,TreeMap>();
20          setMasterMapForCommID(masterMapForCommID);
21          System.out.println("Creating saved map "+commString);
22          savedPathMap = new ConcurrentHashMap<String,ConcurrentHashMap>();
23          setSavedPathMap(savedPathMap);
24      }
25      
26      public CommunicatingVehicles(String commString,String pathString){
27          this.commID = commString;
28          this.pathID = pathString;
29          routeRankMapForCommID = new ConcurrentHashMap();
30          setRouteRankMapForCommID(routeRankMapForCommID);
31          masterMapForCommID = new ConcurrentHashMap<String,TreeMap>();
32          setMasterMapForCommID(masterMapForCommID);
33          savedPathMap = new ConcurrentHashMap<String,ConcurrentHashMap>();
34          setSavedPathMap(savedPathMap);      
35      }
36  
37      private ConcurrentHashMap<String,ConcurrentHashMap> savedPathMap;
38      
39      public ConcurrentHashMap<String,ConcurrentHashMap>  getSavedPathMap() {
40          return savedPathMap;
41      }
42      public void setSavedPathMap(ConcurrentHashMap<String,ConcurrentHashMap> savedPathMap) {
43          this.savedPathMap = savedPathMap;
44      }
45  
46      private ConcurrentHashMap routeRankMapForCommID;
47      public ConcurrentHashMap getRouteRankMapForCommID() {
48          return routeRankMapForCommID;
49      }
50      public void setRouteRankMapForCommID(ConcurrentHashMap routeRankMapForCommID) {
51          this.routeRankMapForCommID = routeRankMapForCommID;
52      }
53      
54      
55      private ConcurrentHashMap<String,TreeMap> masterMapForCommID;
56      public ConcurrentHashMap<String,TreeMap> getMasterMapForCommID() {
57          return masterMapForCommID;
58      }
59      public void setMasterMapForCommID(ConcurrentHashMap<String,TreeMap> masterMapForCommID) {
60          this.masterMapForCommID = masterMapForCommID;
61      }
62      
63      private String commID;
64      public String getCommID() {
65          return commID;
66      }
67  
68      public void setCommID(String commID) {
69          this.commID = commID;
70      }
71      
72      private boolean simNoticeFlag = false;
73  
74      public boolean isSimNoticeFlag() {
75          return simNoticeFlag;
76      }
77      public void setSimNoticeFlag(boolean simNoticeFlag) {
78          this.simNoticeFlag = simNoticeFlag;
79      }
80      
81      private String pathID;
82  
83      public String getPathID() {
84          return pathID;
85      }
86      public void setPathID(String pathID) {
87          this.pathID = pathID;
88      }   
89  }
90