5 public class Constraint implements Quantifiers {
7 private static int count = 1;
10 boolean crash = false;
11 SymbolTable st = new SymbolTable();
12 Vector quantifiers = new Vector();
13 LogicStatement logicstatement = null;
14 DNFConstraint dnfconstraint;
19 label = new String("c" + count++);
22 public String toString() {
24 for(int i=0;i<numQuantifiers();i++) {
25 name+=getQuantifier(i).toString()+",";
27 name+=logicstatement.name();
35 public int numQuantifiers() {
36 return quantifiers.size();
39 public Quantifier getQuantifier(int i) {
40 return (Quantifier) quantifiers.get(i);
43 public String getLabel() {
47 public SymbolTable getSymbolTable() {
51 public void addQuantifier(Quantifier q) {
52 quantifiers.addElement(q);
55 public void setLogicStatement(LogicStatement ls) {
57 // Construct DNF form for analysis
58 dnfconstraint=logicstatement.constructDNF();
61 public LogicStatement getLogicStatement() {
62 return logicstatement;
65 public void setCrash(boolean crash) {
69 public ListIterator quantifiers() {
70 return quantifiers.listIterator();
73 public Set getRequiredDescriptorsFromQuantifiers() {
75 HashSet topdescriptors = new HashSet();
77 for (int i = 0; i < quantifiers.size(); i++) {
78 Quantifier q = (Quantifier) quantifiers.elementAt(i);
79 topdescriptors.addAll(q.getRequiredDescriptors());
82 return SetDescriptor.expand(topdescriptors);
85 public Set getRequiredDescriptorsFromLogicStatement() {
87 HashSet topdescriptors = new HashSet();
89 topdescriptors.addAll(logicstatement.getRequiredDescriptors());
91 return SetDescriptor.expand(topdescriptors);
94 public Set getRequiredDescriptors() {
95 Set set = getRequiredDescriptorsFromQuantifiers();
96 set.addAll(getRequiredDescriptorsFromLogicStatement());