5 Vector ruleconjunctions;
7 public DNFRule(Expr e) {
8 ruleconjunctions=new Vector();
9 ruleconjunctions.add(new RuleConjunction(new DNFExpr(false,e)));
12 public DNFRule(RuleConjunction conj) {
13 ruleconjunctions=new Vector();
14 ruleconjunctions.add(conj);
17 public DNFRule(Vector conj) {
18 ruleconjunctions=conj;
22 ruleconjunctions=new Vector();
26 return ruleconjunctions.size();
29 RuleConjunction get(int i) {
30 return (RuleConjunction)ruleconjunctions.get(i);
33 void add(RuleConjunction c) {
34 ruleconjunctions.add(c);
37 public DNFRule copy() {
38 Vector vector=new Vector();
39 for (int i=0;i<size();i++) {
40 vector.add(get(i).copy());
42 return new DNFRule(vector);
45 public DNFRule and(DNFRule c) {
46 DNFRule newdnf=new DNFRule();
47 for(int i=0;i<size();i++) {
48 for(int j=0;j<c.size();j++) {
49 newdnf.add(get(i).append(c.get(j))); //Cross product
55 public DNFRule or(DNFRule c) {
57 for(int i=0;i<c.size();i++) {
58 copy.add(c.get(i).copy()); //Add in other conjunctions
63 public DNFRule not() {
65 for (int i=0;i<size();i++) {
66 RuleConjunction conj=copy.get(i);
67 for (int j=0;j<conj.size();j++) {
68 DNFExpr dp=conj.get(j);