1 package iotpolicy.tree;
3 import java.util.HashMap;
7 /** Abstract class Declaration is a parent class of InterfaceDecl,
8 * CapabilityDecl, and RequiresDecl
10 * @author Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
14 public class DeclarationHandler {
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;
28 public DeclarationHandler() {
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>();
41 public void addInterfaceDecl(String origInt, Declaration intDecl) {
43 mapInt2IntfaceDecl.put(origInt, intDecl);
47 public void addCapabilityDecl(String origInt, Declaration capDecl) {
49 mapInt2CapabDecl.put(origInt, capDecl);
53 public void addRequiresDecl(String origInt, Declaration reqDecl) {
55 mapInt2ReqDecl.put(origInt, reqDecl);
59 public void addEnumDecl(String origInt, Declaration enumDecl) {
61 mapInt2EnumDecl.put(origInt, enumDecl);
65 public void addStructDecl(String origInt, Declaration structDecl) {
67 mapInt2StructDecl.put(origInt, structDecl);
74 public Declaration getInterfaceDecl(String origInt) {
76 return mapInt2IntfaceDecl.get(origInt);
80 public Declaration getCapabilityDecl(String origInt) {
82 return mapInt2CapabDecl.get(origInt);
86 public Declaration getRequiresDecl(String origInt) {
88 return mapInt2ReqDecl.get(origInt);
92 public Declaration getEnumDecl(String origInt) {
94 return mapInt2EnumDecl.get(origInt);
98 public Declaration getStructDecl(String origInt) {
100 return mapInt2StructDecl.get(origInt);