1 package iotpolicy.tree;
3 import java.util.HashMap;
6 /** Abstract class Declaration is a parent class of InterfaceDecl,
7 * CapabilityDecl, and RequiresDecl
9 * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
13 public class DeclarationHandler {
18 private Map<String,Declaration> mapInt2IntfaceDecl;
19 private Map<String,Declaration> mapInt2CapabDecl;
20 private Map<String,Declaration> mapInt2ReqDecl;
21 private Map<String,Declaration> mapInt2EnumDecl;
22 private Map<String,Declaration> mapInt2StructDecl;
27 public DeclarationHandler() {
29 mapInt2IntfaceDecl = new HashMap<String,Declaration>();
30 mapInt2CapabDecl = new HashMap<String,Declaration>();
31 mapInt2ReqDecl = new HashMap<String,Declaration>();
32 mapInt2EnumDecl = new HashMap<String,Declaration>();
33 mapInt2StructDecl = new HashMap<String,Declaration>();
40 public void addInterfaceDecl(String origInt, Declaration intDecl) {
42 mapInt2IntfaceDecl.put(origInt, intDecl);
46 public void addCapabilityDecl(String origInt, Declaration capDecl) {
48 mapInt2CapabDecl.put(origInt, capDecl);
52 public void addRequiresDecl(String origInt, Declaration reqDecl) {
54 mapInt2ReqDecl.put(origInt, reqDecl);
58 public void addEnumDecl(String origInt, Declaration enumDecl) {
60 mapInt2EnumDecl.put(origInt, enumDecl);
64 public void addStructDecl(String origInt, Declaration structDecl) {
66 mapInt2StructDecl.put(origInt, structDecl);
73 public Declaration getInterfaceDecl(String origInt) {
75 return mapInt2IntfaceDecl.get(origInt);
79 public Declaration getCapabilityDecl(String origInt) {
81 return mapInt2CapabDecl.get(origInt);
85 public Declaration getRequiresDecl(String origInt) {
87 return mapInt2ReqDecl.get(origInt);
91 public Declaration getEnumDecl(String origInt) {
93 return mapInt2EnumDecl.get(origInt);
97 public Declaration getStructDecl(String origInt) {
99 return mapInt2StructDecl.get(origInt);