1 package edu.uci.eecs.specCompiler.specExtraction;
7 * This class represents the plain context for each specification construct.
8 * Besides, it also stores some useful information such as interfaceDeclBody,
9 * which is used in @Interface construct to wrap and rename interface calls.
14 public class SpecConstruct {
15 public final String plainText;
16 public final File file;
17 public final int beginLineNum;
18 public final int endLineNum;
19 public final String interfaceDeclBody;
20 public final Construct construct;
22 public SpecConstruct(String plainText, File file,
23 int beginLineNum, int endLineNum, Construct construct) {
24 this.plainText = plainText;
26 this.beginLineNum = beginLineNum;
27 this.endLineNum = endLineNum;
28 this.construct = construct;
29 this.interfaceDeclBody = "";
32 public SpecConstruct(String plainText, File file,
33 int beginLineNum, int endLineNum, Construct construct,
34 String interfaceDeclBody) {
35 this.plainText = plainText;
37 this.beginLineNum = beginLineNum;
38 this.endLineNum = endLineNum;
39 this.construct = construct;
40 this.interfaceDeclBody = interfaceDeclBody;
43 public String toString() {
44 StringBuilder sb = new StringBuilder();
45 sb.append("File: " + file.getAbsolutePath() + "\n");
47 + beginLineNum + " End: " + endLineNum + "\n");
49 if (construct instanceof InterfaceConstruct
50 || construct instanceof InterfaceDefineConstruct) {
51 sb.append("Function declaration: " + interfaceDeclBody);