KickJava   Java API By Example, From Geeks To Geeks.

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


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  * in_expression.
16  */

17 public class InNode extends Node {
18
19     // todo make sure path is PathNode in annotate
20
private Node path;
21     private boolean not;
22     private Node inList;
23
24     public InNode(Node arg, boolean not, Node inList) {
25         this.path = arg;
26         this.not = not;
27         this.inList = inList;
28     }
29
30     public PathNode getPath() {
31         return (PathNode)path;
32     }
33
34     public boolean isNot() {
35         return not;
36     }
37
38     public Node getInList() {
39         return inList;
40     }
41
42     public Object JavaDoc arrive(NodeVisitor v, Object JavaDoc msg) {
43         return v.arriveInNode(this, msg);
44     }
45
46     public String JavaDoc toStringImp() {
47         StringBuffer JavaDoc s = new StringBuffer JavaDoc();
48         s.append(path);
49         if (not) {
50             s.append(" NOT");
51         }
52         s.append(" IN ");
53         s.append('(');
54         s.append(inList);
55         for (Node e = inList.getNext(); e != null; e = e.getNext()) {
56             s.append(", ");
57             s.append(e);
58         }
59         s.append(')');
60         return s.toString();
61     }
62
63     public void resolve(ResolveContext rc) {
64         path.resolve(rc);
65         resolve(inList, rc);
66     }
67
68 }
69
70
Popular Tags