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 SQLOrExpr extends SimpleNode {
10: public SQLOrExpr(int id) {
11: super (id);
12: }
13:
14: public void write(Writer out) throws IOException {
15: boolean or = false;
16: for (int i = 0; i < children.length; i++) {
17: if (or)
18: out.write(" OR ");
19: children[i].write(out);
20: or = true;
21: }
22: }
23:
24: public Object execute(Object context) {
25: Boolean result = Boolean.FALSE;
26: for (int i = 0; i < children.length; i++) {
27: if (((Boolean) children[i].execute(context)).booleanValue()) {
28: result = Boolean.TRUE;
29: break;
30: }
31: }
32: return result;
33: }
34: }
|