01: package org.obe.sql;
02:
03: import java.io.IOException;
04: import java.io.Writer;
05:
06: /**
07: * @author Adrian Price
08: */
09: public class SQLAndExpr extends SimpleNode {
10: public SQLAndExpr(int id) {
11: super (id);
12: }
13:
14: public void write(Writer out) throws IOException {
15: boolean and = false;
16: for (int i = 0; i < children.length; i++) {
17: if (and)
18: out.write(" AND ");
19: children[i].write(out);
20: and = true;
21: }
22: }
23:
24: public Object execute(Object context) {
25: Boolean result = Boolean.TRUE;
26: for (int i = 0; i < children.length; i++) {
27: if (!((Boolean) children[i].execute(context))
28: .booleanValue()) {
29: result = Boolean.FALSE;
30: break;
31: }
32: }
33: return result;
34: }
35: }
|