01: /*
02: * Copyright 2002 (C) TJDO.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the TJDO License version 1.0.
06: * See the terms of the TJDO License in the documentation provided with this software.
07: *
08: * $Id: ExistsExpression.java,v 1.2 2002/10/17 21:00:55 pierreg0 Exp $
09: */
10:
11: package com.triactive.jdo.store;
12:
13: class ExistsExpression extends BooleanExpression {
14: private final QueryStatement subquery;
15: private final boolean truthTest;
16:
17: public ExistsExpression(QueryStatement qs, QueryStatement subquery) {
18: this (qs, subquery, true);
19: }
20:
21: public ExistsExpression(QueryStatement qs, QueryStatement subquery,
22: boolean truthTest) {
23: super (qs);
24:
25: this .subquery = subquery;
26: this .truthTest = truthTest;
27:
28: if (!truthTest)
29: st.append("NOT ");
30:
31: st.append("EXISTS (").append(subquery.toStatementText())
32: .append(')');
33:
34: }
35:
36: public BooleanExpression not() {
37: return new ExistsExpression(qs, subquery, !truthTest);
38: }
39: }
|