01: package org.drools.brms.client.modeldriven.brl;
02:
03: /**
04: * Represents first order logic like Or, Not, Exists.
05: *
06: * @author Michael Neale
07: */
08: public class CompositeFactPattern implements IPattern {
09: public static final String COMPOSITE_TYPE_NOT = "not";
10: public static final String COMPOSITE_TYPE_EXISTS = "exists";
11: public static final String COMPOSITE_TYPE_OR = "or";
12:
13: /**
14: * this will one of: [Not, Exist, Or]
15: */
16: public String type;
17:
18: /**
19: * The patterns.
20: */
21: public FactPattern[] patterns;
22:
23: /**
24: * This type should be from the contants in this class of course.
25: */
26: public CompositeFactPattern(final String type) {
27: this .type = type;
28: }
29:
30: public CompositeFactPattern() {
31: }
32:
33: public void addFactPattern(final FactPattern pat) {
34: if (this .patterns == null) {
35: this .patterns = new FactPattern[0];
36: }
37:
38: final FactPattern[] list = this .patterns;
39: final FactPattern[] newList = new FactPattern[list.length + 1];
40:
41: for (int i = 0; i < list.length; i++) {
42: newList[i] = list[i];
43: }
44: newList[list.length] = pat;
45:
46: this.patterns = newList;
47: }
48:
49: }
|