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