import IR.*;
public class DNFFlag {
- Vector conjunctions;
+ private Vector conjunctions;
public DNFFlag(FlagNode flag) {
DNFFlagAtom dfa=new DNFFlagAtom(flag, false);
conjunctions=new Vector();
conjunctions=new Vector();
}
+ /** Returns the number of conjunctions in the DNF form. */
+
+ public int size() {
+ return conjunctions.size();
+ }
+
+ /** Returns a Vector containing the terms in the n'th conjunction. */
+
+ public Vector get(int n) {
+ return (Vector) conjunctions.get(n);
+ }
+
/** This method negates a DNFFlag expression. */
public DNFFlag not() {
DNFFlag newflag=null;
for (int j=0;j<conj.size();j++) {
DNFFlagAtom dfa=(DNFFlagAtom) conj.get(j);
- DNFFlagAtom negdfa=new DNFFlagAtom(dfa.flag,!dfa.negated);
+ DNFFlagAtom negdfa=new DNFFlagAtom(dfa.getFlagNode(),!dfa.getNegated());
DNFFlag tmp=new DNFFlag();
Vector v=new Vector();
tmp.conjunctions.add(v);
for(int i=0;i<conjunctions.size();i++) {
for(int i2=0;i2<dnf2.conjunctions.size();i2++) {
Vector conjunct=(Vector)conjunctions.get(i);
- Vector conjunct2=(Vector)conjunctions.get(i2);
+ Vector conjunct2=(Vector)dnf2.conjunctions.get(i2);
Vector newconjunct=new Vector();
result.conjunctions.add(newconjunct);
for(int j=0;j<conjunct.size();j++) {
}
return result;
}
+
+ public String toString() {
+ String value="";
+ for(int i=0;i<conjunctions.size();i++) {
+ if (i!=0)
+ value+=" || ";
+ Vector conjunct=(Vector)conjunctions.get(i);
+ for(int j=0;j<conjunct.size();j++) {
+ if (j!=0)
+ value+="&&";
+ value+=conjunct.get(j);
+ }
+ }
+ return value;
+ }
}