parser checked
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / SpecConstruct.java
index 84249e818b9a1f3ee2f3e10726f610426ef30885..95650ccdf0a9420f2cea428831683f638e96d043 100644 (file)
@@ -12,33 +12,45 @@ import java.io.File;
  *
  */
 public class SpecConstruct {
  *
  */
 public class SpecConstruct {
-       public enum ConstructType {
-               GLOBAL, INTERFACE, POTENTIAL_CP, CP_DEFINE, CP_DEFINE_CHECK
-       };
-       public ConstructType type;
        public final String plainText;
        public final File file;
        public final int beginLineNum;
        public final int endLineNum;
        public final String interfaceDeclBody;
        public final String plainText;
        public final File file;
        public final int beginLineNum;
        public final int endLineNum;
        public final String interfaceDeclBody;
+       public final Construct construct;
        
        
-       public SpecConstruct(ConstructType type, String plainText, File file,
-                       int beginLineNum, int endLineNum) {
-               this.type = type;
+       public SpecConstruct(String plainText, File file,
+                       int beginLineNum, int endLineNum, Construct construct) {
                this.plainText = plainText;
                this.file = file;
                this.beginLineNum = beginLineNum;
                this.endLineNum = endLineNum;
                this.plainText = plainText;
                this.file = file;
                this.beginLineNum = beginLineNum;
                this.endLineNum = endLineNum;
+               this.construct = construct;
                this.interfaceDeclBody = ""; 
        }
        
                this.interfaceDeclBody = ""; 
        }
        
-       public SpecConstruct(ConstructType type, String plainText, File file,
-                       int beginLineNum, int endLineNum, String interfaceDeclBody) {
-               this.type = type;
+       public SpecConstruct(String plainText, File file,
+                       int beginLineNum, int endLineNum, Construct construct,
+                       String interfaceDeclBody) {
                this.plainText = plainText;
                this.file = file;
                this.beginLineNum = beginLineNum;
                this.endLineNum = endLineNum;
                this.plainText = plainText;
                this.file = file;
                this.beginLineNum = beginLineNum;
                this.endLineNum = endLineNum;
+               this.construct = construct;
                this.interfaceDeclBody = interfaceDeclBody; 
        }
                this.interfaceDeclBody = interfaceDeclBody; 
        }
+       
+       public String toString() {
+               StringBuilder sb = new StringBuilder();
+               sb.append("File: " + file.getAbsolutePath() + "\n");
+               sb.append("Begin: "
+                               + beginLineNum + "  End: " + endLineNum + "\n");
+               sb.append(construct);
+               if (construct instanceof InterfaceConstruct) {
+                       sb.append("Function declaration: " + interfaceDeclBody);
+               }
+               boolean a = !false, b = 3 > 0 ? a : !a;
+               return sb.toString();
+               
+       }
 }
 }