KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > extractor > algebra > LitString


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.extractor.algebra;
24
25 import java.util.Map JavaDoc;
26
27 import org.xquark.extractor.common.SqlWrapperException;
28 import org.xquark.extractor.sql.SqlExpression;
29
30 public final class LitString extends Literal
31 {
32     private static final String JavaDoc RCSRevision = "$Revision: 1.4 $";
33     private static final String JavaDoc RCSName = "$Name: $";
34     private String JavaDoc _value;
35
36     /**
37      * @param value
38      * @roseuid 3B277B3800C4
39      */

40     public LitString(String JavaDoc value)
41     {
42         _value = value ;
43     }
44
45
46
47     synchronized Object JavaDoc clone(Map JavaDoc clonedExprs) throws CloneNotSupportedException JavaDoc
48     {
49         //Trace.enter(this, "clone(Map clonedExprs)");
50

51         LitString retVal = (LitString)super.clone(clonedExprs);
52         clonedExprs.put(this, retVal);
53         //Trace.exit(this, "clone(Map clonedExprs)");
54
return retVal;
55     }
56
57     /**
58      * Access method for the _value property.
59      *
60      * @return the current value of the _value property
61      */

62     public String JavaDoc getValue()
63     {
64         return _value;
65     }
66
67     /**
68      * Sets the value of the _value property.
69      *
70      * @param aValue the new value of the _value property
71      */

72     public void setValue(String JavaDoc aValue)
73     {
74         _value = aValue;
75     }
76
77     public String JavaDoc pprint ( )
78     {
79         return "'" + _value + "'" ;
80     }
81
82     public SqlExpression accept (GenSqlVisitor visitor) throws SqlWrapperException
83     {
84         return visitor.visit(this);
85     }
86
87     public void accept (AlgebraVisitor visitor) throws SqlWrapperException
88     {
89         visitor.visit(this);
90     }
91
92     /**
93      * @see Expression#deepEquals(Object)
94      */

95     public boolean deepEquals(Object JavaDoc o)
96     {
97         if (o instanceof LitString)
98         {
99             LitString cast = (LitString)o;
100             return _value.equals(cast.getValue());
101         }
102         return false;
103     }
104 }
105
Popular Tags