KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > ejb > query > BetweenNode


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.ejb.query;
13
14 /**
15  * BETWEEN.
16  */

17 public class BetweenNode extends Node {
18
19     private Node arg;
20     private boolean not;
21     private Node from;
22     private Node to;
23
24     public BetweenNode(Node arg, boolean not, Node from,
25             Node to) {
26         this.arg = arg;
27         this.not = not;
28         this.from = from;
29         this.to = to;
30     }
31
32     public Node getArg() {
33         return arg;
34     }
35
36     public boolean isNot() {
37         return not;
38     }
39
40     public Node getFrom() {
41         return from;
42     }
43
44     public Node getTo() {
45         return to;
46     }
47
48     public Object JavaDoc arrive(NodeVisitor v, Object JavaDoc msg) {
49         return v.arriveBetweenNode(this, msg);
50     }
51
52     public String JavaDoc toStringImp() {
53         StringBuffer JavaDoc s = new StringBuffer JavaDoc();
54         s.append(arg);
55         if (not) {
56             s.append(" NOT");
57         }
58         s.append(" BETWEEN ");
59         s.append(from);
60         s.append(" AND ");
61         s.append(to);
62         return s.toString();
63     }
64
65     public void resolve(ResolveContext rc) {
66         arg.resolve(rc);
67         from.resolve(rc);
68         to.resolve(rc);
69     }
70
71 }
72
73
Popular Tags