01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.ejb.query;
12:
13: /**
14: * EXISTS.
15: */
16: public class ExistsNode extends Node {
17:
18: private boolean not;
19: private SelectNode subquery;
20:
21: public ExistsNode(boolean not, SelectNode subquery) {
22: this .not = not;
23: this .subquery = subquery;
24: }
25:
26: public boolean isNot() {
27: return not;
28: }
29:
30: public SelectNode getSubquery() {
31: return subquery;
32: }
33:
34: public Object arrive(NodeVisitor v, Object msg) {
35: return v.arriveExistsNode(this , msg);
36: }
37:
38: public String toStringImp() {
39: StringBuffer s = new StringBuffer();
40: if (not) {
41: s.append("NOT ");
42: }
43: s.append("EXISTS (");
44: s.append(subquery);
45: s.append(')');
46: return s.toString();
47: }
48:
49: public void resolve(ResolveContext rc) {
50: subquery.resolve(rc);
51: }
52:
53: }
|