KickJava   Java API By Example, From Geeks To Geeks.

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


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

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