1 10 11 package com.triactive.jdo.store; 12 13 14 class ExistsExpression extends BooleanExpression 15 { 16 private final QueryStatement subquery; 17 private final boolean truthTest; 18 19 public ExistsExpression(QueryStatement qs, QueryStatement subquery) 20 { 21 this(qs, subquery, true); 22 } 23 24 public ExistsExpression(QueryStatement qs, QueryStatement subquery, boolean truthTest) 25 { 26 super(qs); 27 28 this.subquery = subquery; 29 this.truthTest = truthTest; 30 31 if (!truthTest) 32 st.append("NOT "); 33 34 st.append("EXISTS (").append(subquery.toStatementText()).append(')'); 35 36 } 37 38 public BooleanExpression not() 39 { 40 return new ExistsExpression(qs, subquery, !truthTest); 41 } 42 } 43 | Popular Tags |