2 import java.util.Vector;
7 public DNFFlag(FlagNode flag) {
8 DNFFlagAtom dfa=new DNFFlagAtom(flag, false);
9 conjunctions=new Vector();
10 Vector conjunct=new Vector();
12 conjunctions.add(conjunct);
15 conjunctions=new Vector();
18 /** This method negates a DNFFlag expression. */
20 public DNFFlag not() {
22 for (int i=0;i<conjunctions.size();i++) {
23 Vector conj=(Vector)conjunctions.get(i);
25 for (int j=0;j<conj.size();j++) {
26 DNFFlagAtom dfa=(DNFFlagAtom) conj.get(j);
27 DNFFlagAtom negdfa=new DNFFlagAtom(dfa.flag,!dfa.negated);
28 DNFFlag tmp=new DNFFlag();
29 Vector v=new Vector();
30 tmp.conjunctions.add(v);
36 newflag=newflag.or(tmp);
41 notflag=notflag.and(newflag);
46 /** This method or's two DNFFlag expressions together. */
47 public DNFFlag or(DNFFlag dnf2) {
48 DNFFlag result=new DNFFlag();
49 for(int i=0;i<conjunctions.size();i++) {
50 Vector conjunct=(Vector)conjunctions.get(i);
51 Vector newvector=new Vector();
52 result.conjunctions.add(newvector);
53 for(int j=0;j<conjunct.size();j++) {
54 newvector.add(conjunct.get(j));
58 for(int i=0;i<dnf2.conjunctions.size();i++) {
59 Vector conjunct=(Vector)dnf2.conjunctions.get(i);
60 Vector newvector=new Vector();
61 result.conjunctions.add(newvector);
62 for(int j=0;j<conjunct.size();j++) {
63 newvector.add(conjunct.get(j));
69 /** This method and's two DNFFlag expressions together. */
70 public DNFFlag and(DNFFlag dnf2) {
71 DNFFlag result=new DNFFlag();
72 for(int i=0;i<conjunctions.size();i++) {
73 for(int i2=0;i2<dnf2.conjunctions.size();i2++) {
74 Vector conjunct=(Vector)conjunctions.get(i);
75 Vector conjunct2=(Vector)conjunctions.get(i2);
76 Vector newconjunct=new Vector();
77 result.conjunctions.add(newconjunct);
78 for(int j=0;j<conjunct.size();j++) {
79 newconjunct.add(conjunct.get(j));
81 for(int j2=0;j2<conjunct2.size();j2++) {
82 newconjunct.add(conjunct2.get(j2));