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