Adding config file for sharing.
[iot2.git] / iotjava / iotpolicy / tree / DeclarationHandler.java
1 package iotpolicy.tree;
2
3 import java.util.HashMap;
4 import java.util.Map;
5 import java.util.Set;
6
7 /** Abstract class Declaration is a parent class of InterfaceDecl,
8  *  CapabilityDecl, and RequiresDecl
9  *
10  * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
11  * @version     1.0
12  * @since       2016-09-30
13  */
14 public class DeclarationHandler {
15
16         /**
17          * Class properties
18          */
19         private Map<String,Declaration> mapInt2IntfaceDecl;
20         private Map<String,Declaration> mapInt2CapabDecl;
21         private Map<String,Declaration> mapInt2ReqDecl;
22         private Map<String,Declaration> mapInt2EnumDecl;
23         private Map<String,Declaration> mapInt2StructDecl;
24
25         /**
26          * Class constructors
27          */
28         public DeclarationHandler() {
29
30                 mapInt2IntfaceDecl = new HashMap<String,Declaration>();
31                 mapInt2CapabDecl = new HashMap<String,Declaration>();
32                 mapInt2ReqDecl = new HashMap<String,Declaration>();
33                 mapInt2EnumDecl = new HashMap<String,Declaration>();
34                 mapInt2StructDecl = new HashMap<String,Declaration>();
35         }
36
37
38         /**
39          * Setters/adders
40          */
41         public void addInterfaceDecl(String origInt, Declaration intDecl) {
42
43                 mapInt2IntfaceDecl.put(origInt, intDecl);
44         }
45
46
47         public void addCapabilityDecl(String origInt, Declaration capDecl) {
48
49                 mapInt2CapabDecl.put(origInt, capDecl);
50         }
51
52
53         public void addRequiresDecl(String origInt, Declaration reqDecl) {
54
55                 mapInt2ReqDecl.put(origInt, reqDecl);
56         }
57
58
59         public void addEnumDecl(String origInt, Declaration enumDecl) {
60
61                 mapInt2EnumDecl.put(origInt, enumDecl);
62         }
63
64
65         public void addStructDecl(String origInt, Declaration structDecl) {
66
67                 mapInt2StructDecl.put(origInt, structDecl);
68         }
69
70
71         /**
72          * Getters
73          */
74         public Declaration getInterfaceDecl(String origInt) {
75
76                 return mapInt2IntfaceDecl.get(origInt);
77         }
78
79
80         public Declaration getCapabilityDecl(String origInt) {
81
82                 return mapInt2CapabDecl.get(origInt);
83         }
84
85
86         public Declaration getRequiresDecl(String origInt) {
87
88                 return mapInt2ReqDecl.get(origInt);
89         }
90
91
92         public Declaration getEnumDecl(String origInt) {
93
94                 return mapInt2EnumDecl.get(origInt);
95         }
96
97
98         public Declaration getStructDecl(String origInt) {
99
100                 return mapInt2StructDecl.get(origInt);
101         }
102 }