X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=blobdiff_plain;f=src%2Fedu%2Fuci%2Feecs%2FspecCompiler%2FspecExtraction%2FSpecConstruct.java;h=95650ccdf0a9420f2cea428831683f638e96d043;hp=84249e818b9a1f3ee2f3e10726f610426ef30885;hb=570d67c87af73f80a04e584ffacf2c395c570450;hpb=809787d83de53a464887c48b0a083d4903e0734e diff --git a/src/edu/uci/eecs/specCompiler/specExtraction/SpecConstruct.java b/src/edu/uci/eecs/specCompiler/specExtraction/SpecConstruct.java index 84249e8..95650cc 100644 --- a/src/edu/uci/eecs/specCompiler/specExtraction/SpecConstruct.java +++ b/src/edu/uci/eecs/specCompiler/specExtraction/SpecConstruct.java @@ -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(); + + } }