KickJava   Java API By Example, From Geeks To Geeks.

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


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 LitDouble extends Literal
31 {
32
33     private static final String JavaDoc RCSRevision = "$Revision: 1.4 $";
34     private static final String JavaDoc RCSName = "$Name: $";
35
36     private Double JavaDoc _value;
37
38     /**
39      * @param value
40      * @roseuid 3B277B3700C3
41      */

42     public LitDouble(Double JavaDoc value)
43     {
44         _value = value ;
45     }
46
47     public LitDouble(double value)
48     {
49         _value = new Double JavaDoc(value) ;
50     }
51
52 // synchronized Object clone(Map clonedExprs) throws CloneNotSupportedException
53
// {
54
// Trace.enter(this, "clone(Map clonedExprs)");
55
// LitDouble retVal = (LitDouble)super.clone();
56
// retVal.setValue((getValue() == null) ? null : new Double(getValue().floatValue()));
57
// clonedExpr.put(this, retVal);Trace.exit(this, "clone(Map clonedExprs)");return retVal;
58
// return retVal;
59
// }
60

61     synchronized Object JavaDoc clone(Map JavaDoc clonedExprs) throws CloneNotSupportedException JavaDoc
62     {
63         //Trace.enter(this, "clone(Map clonedExprs)");
64

65         LitDouble retVal = (LitDouble)super.clone(clonedExprs);
66         retVal.setValue((getValue() == null) ? null : new Double JavaDoc(getValue().doubleValue()));
67
68         clonedExprs.put(this, retVal);
69         //Trace.exit(this, "clone(Map clonedExprs)");
70
return retVal;
71     }
72
73     /**
74      * Access method for the _value property.
75      *
76      * @return the current value of the _value property
77      */

78     public Double JavaDoc getValue()
79     {
80         return _value;
81     }
82
83     /**
84      * Sets the value of the _value property.
85      *
86      * @param aValue the new value of the _value property
87      */

88     public void setValue(Double JavaDoc aValue)
89     {
90         _value = aValue;
91     }
92
93     public String JavaDoc pprint()
94     {
95         return _value.toString();
96     }
97
98     public SqlExpression accept (GenSqlVisitor visitor) throws SqlWrapperException
99     {
100         return visitor.visit(this);
101     }
102
103     public void accept (AlgebraVisitor visitor) throws SqlWrapperException
104     {
105         visitor.visit(this);
106     }
107
108     /**
109      * @see Expression#deepEquals(Object)
110      */

111     public boolean deepEquals(Object JavaDoc o)
112     {
113         if (o instanceof LitDouble)
114         {
115             LitDouble cast = (LitDouble)o;
116             return _value.equals(cast.getValue());
117         }
118         return false;
119     }
120 }
121
Popular Tags