Moving struct and enum declaration into interface declaration
[iot2.git] / iotjava / iotpolicy / tree / ParseTreeHandler.java
index c5d0be7cba407ffbdb91dd001bf8ab26b11da5b8..0d2b1c524e8c8062f7220d58ac1adb00ccfbe94f 100644 (file)
@@ -13,9 +13,11 @@ import java.util.ArrayList;
  *  parser (and lexer) from the policy file. 
  *  This class accepts the AST in the form of ParseNode and
  *  ParseNodeVector class objects.
- *  It gives interfaces to extract the 2 types of policy file:
+ *  It gives interfaces to extract the 4 types of policy file:
  *  1) Interface and capabilities definition
  *  2) Generated interface list ("requires" statements)
+ *  3) Enum declaration
+ *  4) Struct declaration
  *
  * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
  * @version     1.0
@@ -31,6 +33,8 @@ public final class ParseTreeHandler {
        private InterfaceDecl intDecl;
        private CapabilityDecl capDecl;
        private RequiresDecl reqDecl;
+       private EnumDecl enumDecl;
+       private StructDecl structDecl;
 
 
        /**
@@ -43,6 +47,8 @@ public final class ParseTreeHandler {
                intDecl = new InterfaceDecl();
                capDecl = new CapabilityDecl();
                reqDecl = new RequiresDecl();
+               enumDecl = new EnumDecl();
+               structDecl = new StructDecl();
        }
 
 
@@ -53,6 +59,8 @@ public final class ParseTreeHandler {
                intDecl = new InterfaceDecl(_intFace);
                capDecl = new CapabilityDecl(_intFace);
                reqDecl = new RequiresDecl(_intFace);
+               enumDecl = new EnumDecl();
+               structDecl = new StructDecl();
        }
 
 
@@ -223,6 +231,24 @@ public final class ParseTreeHandler {
        }
 
 
+       /**
+        * getEnumDecl() returns EnumDecl object
+        */
+       public EnumDecl getEnumDecl() {
+
+               return enumDecl;
+       }
+
+
+       /**
+        * getStructDecl() returns StructDecl object
+        */
+       public StructDecl getStructDecl() {
+
+               return structDecl;
+       }
+
+
        /**
         * getOrigIntface() returns the original interface in policy, e.g. Camera
         * <p>