b8b8689512fb9a104efe069104704069b9283e0e
[cdsspec-compiler.git] / src / edu / uci / eecs / specCompiler / specExtraction / ActionSubConstruct.java
1 package edu.uci.eecs.specCompiler.specExtraction;
2
3 import java.util.ArrayList;
4
5 public class ActionSubConstruct {
6         public static class DefineVar {
7                 public final String varType;
8                 public final String varName;
9                 public final String varExpr;
10                 
11                 public DefineVar(String varType, String varName, String varExpr) {
12                         this.varType = varType;
13                         this.varName = varName;
14                         this.varExpr = varExpr;
15                 }
16                 
17                 public String toString() {
18                         return varType + " " + varName + " = " + varExpr;
19                 }
20         }
21         
22         public final ArrayList<DefineVar> defineVars;
23         public final String code;
24         
25         public ActionSubConstruct(ArrayList<DefineVar> defineVars, String code) {
26                 this.code = code;
27                 this.defineVars = defineVars;
28         }
29         
30         public void addDefineVar(DefineVar defineVar) {
31                 defineVars.add(defineVar);
32         }
33         
34         public String toString() {
35                 StringBuilder sb = new StringBuilder();
36                 sb.append("@Action:\n");
37                 for (DefineVar defineVar : defineVars) {
38                         sb.append("\t@DefineVar: " + defineVar + "\n");
39                 }
40                 sb.append("\t@Code: " + code);
41                 return sb.toString();
42         }
43 }