KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > el > parser > AstFloatingPoint


1 /* Generated By:JJTree: Do not edit this line. AstFloatingPoint.java */
2
3 package org.apache.el.parser;
4
5 import java.math.BigDecimal JavaDoc;
6
7 import javax.el.ELException;
8
9 import org.apache.el.lang.EvaluationContext;
10
11
12 /**
13  * @author Jacob Hookom [jacob@hookom.net]
14  * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: markt $
15  */

16 public final class AstFloatingPoint extends SimpleNode {
17     public AstFloatingPoint(int id) {
18         super(id);
19     }
20
21     private Number JavaDoc number;
22
23     public Number JavaDoc getFloatingPoint() {
24         if (this.number == null) {
25             try {
26                 this.number = new Double JavaDoc(this.image);
27             } catch (ArithmeticException JavaDoc e0) {
28                 this.number = new BigDecimal JavaDoc(this.image);
29             }
30         }
31         return this.number;
32     }
33
34     public Object JavaDoc getValue(EvaluationContext ctx)
35             throws ELException {
36         return this.getFloatingPoint();
37     }
38
39     public Class JavaDoc getType(EvaluationContext ctx)
40             throws ELException {
41         return this.getFloatingPoint().getClass();
42     }
43 }
44
Popular Tags