parser checked
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / SpecConstruct.java
index 84249e8..95650cc 100644 (file)
@@ -12,33 +12,45 @@ import java.io.File;
  *
  */
 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 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.construct = construct;
                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.construct = construct;
                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();
+               
+       }
 }