Cleaning up; Adding new files
[iot2.git] / iotjava / iotpolicy / tree / DeclarationHandler.java
1 package iotpolicy.tree;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 /** Abstract class Declaration is a parent class of InterfaceDecl,
7  *  CapabilityDecl, and RequiresDecl
8  *
9  * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
10  * @version     1.0
11  * @since       2016-09-30
12  */
13 public class DeclarationHandler {
14
15         /**
16          * Class properties
17          */
18         private Map<String,Declaration> mapInt2IntfaceDecl;
19         private Map<String,Declaration> mapInt2CapabDecl;
20         private Map<String,Declaration> mapInt2ReqDecl;
21
22         /**
23          * Class constructors
24          */
25         public DeclarationHandler() {
26
27                 mapInt2IntfaceDecl = new HashMap<String,Declaration>();
28                 mapInt2CapabDecl = new HashMap<String,Declaration>();
29                 mapInt2ReqDecl = new HashMap<String,Declaration>();
30         }
31
32
33         /**
34          * Setters/adders
35          */
36         public void addInterfaceDecl(String origInt, Declaration intDecl) {
37
38                 mapInt2IntfaceDecl.put(origInt, intDecl);
39         }
40
41
42         public void addCapabilityDecl(String origInt, Declaration capDecl) {
43
44                 mapInt2CapabDecl.put(origInt, capDecl);
45         }
46
47
48         public void addRequiresDecl(String origInt, Declaration reqDecl) {
49
50                 mapInt2ReqDecl.put(origInt, reqDecl);
51         }
52
53
54         /**
55          * Getters
56          */
57         public Declaration getInterfaceDecl(String origInt) {
58
59                 return mapInt2IntfaceDecl.get(origInt);
60         }
61
62
63         public Declaration getCapabilityDecl(String origInt) {
64
65                 return mapInt2CapabDecl.get(origInt);
66         }
67
68
69         public Declaration getRequiresDecl(String origInt) {
70
71                 return mapInt2ReqDecl.get(origInt);
72         }
73 }