5 public class Rule implements Quantifiers {
9 Vector quantifiers = new Vector();
10 boolean isstatic = false;
11 boolean isdelay = false;
12 private Expr guard = null;
13 Inclusion inclusion = null;
14 SymbolTable st = new SymbolTable();
15 DNFRule dnfguard=null,dnfnegguard=null;
16 boolean nogenerate=false;
23 label = new String("rule" + count++);
26 public void setnogenerate() {
30 public boolean getnogenerate() {
34 public String toString() {
36 for(int i=0;i<numQuantifiers();i++) {
37 name+=getQuantifier(i).toString()+",";
39 name+=guard.name()+"=>"+inclusion.toString();
43 public int numQuantifiers() {
44 return quantifiers.size();
47 public Quantifier getQuantifier(int i) {
48 return (Quantifier) quantifiers.get(i);
55 public String getLabel() {
59 public void setStatic(boolean val) {
63 public void setDelay(boolean val) {
67 public void addQuantifier(Quantifier q) {
68 quantifiers.addElement(q);
71 public ListIterator quantifiers() {
72 return quantifiers.listIterator();
75 public void setGuardExpr(Expr guard) {
77 dnfguard=guard.constructDNF();
78 OpExpr opexpr=new OpExpr(Opcode.NOT,guard,null);
79 dnfnegguard=opexpr.constructDNF();
82 public Expr getGuardExpr() {
86 public DNFRule getDNFGuardExpr() {
90 public DNFRule getDNFNegGuardExpr() {
94 public void setInclusion(Inclusion inclusion) {
95 this.inclusion = inclusion;
98 public Inclusion getInclusion() {
102 public SymbolTable getSymbolTable() {
106 public Set getQuantifierDescriptors() {
108 HashSet topdescriptors = new HashSet();
110 for (int i = 0; i < quantifiers.size(); i++) {
111 Quantifier q = (Quantifier) quantifiers.elementAt(i);
112 topdescriptors.addAll(q.getRequiredDescriptors());
115 return SetDescriptor.expand(topdescriptors);
119 public Set getRequiredDescriptors() {
121 HashSet topdescriptors = new HashSet();
123 for (int i = 0; i < quantifiers.size(); i++) {
124 Quantifier q = (Quantifier) quantifiers.elementAt(i);
125 topdescriptors.addAll(q.getRequiredDescriptors());
128 assert guard != null;
129 topdescriptors.addAll(guard.getRequiredDescriptors());
131 assert inclusion != null;
132 topdescriptors.addAll(inclusion.getRequiredDescriptors());
134 return SetDescriptor.expand(topdescriptors);