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 DNFConstraint getDNFConstraint() {
26 public String toString() {
28 for(int i=0;i<numQuantifiers();i++) {
29 name+=getQuantifier(i).toString()+",";
31 name+=logicstatement.name();
39 public int numQuantifiers() {
40 return quantifiers.size();
43 public Quantifier getQuantifier(int i) {
44 return (Quantifier) quantifiers.get(i);
47 public String getLabel() {
51 public SymbolTable getSymbolTable() {
55 public void addQuantifier(Quantifier q) {
56 quantifiers.addElement(q);
59 public void setLogicStatement(LogicStatement ls) {
61 // Construct DNF form for analysis
62 dnfconstraint=logicstatement.constructDNF();
65 public LogicStatement getLogicStatement() {
66 return logicstatement;
69 public void setCrash(boolean crash) {
73 public ListIterator quantifiers() {
74 return quantifiers.listIterator();
77 public Set getRequiredDescriptorsFromQuantifiers() {
79 HashSet topdescriptors = new HashSet();
81 for (int i = 0; i < quantifiers.size(); i++) {
82 Quantifier q = (Quantifier) quantifiers.elementAt(i);
83 topdescriptors.addAll(q.getRequiredDescriptors());
86 return SetDescriptor.expand(topdescriptors);
89 public Set getRequiredDescriptorsFromLogicStatement() {
91 HashSet topdescriptors = new HashSet();
93 topdescriptors.addAll(logicstatement.getRequiredDescriptors());
95 return SetDescriptor.expand(topdescriptors);
98 public Set getRequiredDescriptors() {
99 Set set = getRequiredDescriptorsFromQuantifiers();
100 set.addAll(getRequiredDescriptorsFromLogicStatement());