KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > reportcalculator > arithmetic > ValueArithmeticExp


1 package com.calipso.reportgenerator.reportcalculator.arithmetic;
2
3 import com.calipso.reportgenerator.reportcalculator.arithmetic.ArithmeticExpression;
4 import com.calipso.reportgenerator.reportcalculator.arithmetic.ConstantArithmeticExp;
5
6 import java.io.Serializable JavaDoc;
7
8
9 /**
10  * Representa un valor de la expresion.
11  */

12
13 public abstract class ValueArithmeticExp extends ArithmeticExpression implements Serializable JavaDoc{
14
15   /**
16    * Crea una variable o una constante dependiendo del String
17    * recibido por parametro.
18    * @param token
19    * @return
20    */

21   public static ArithmeticExpression newValueExpFrom(String JavaDoc token) {
22     if (token.charAt(0) == '#') {
23       return new VariableArithmeticExp(token.substring(1, token.length()));
24     } else {
25       return new ConstantArithmeticExp(Float.valueOf(token).floatValue());
26     }
27   }
28 }
29
Popular Tags