1 package com.calipso.reportgenerator.reportcalculator.arithmetic;2 3 import com.calipso.reportgenerator.reportcalculator.arithmetic.ValueArithmeticExp;4 import com.calipso.reportgenerator.reportcalculator.SharedFloat;5 6 import java.util.Map ;7 import java.util.Collection ;8 import java.io.Serializable ;9 10 /**11 * Representa una variable de la expresion a resolver.12 */13 14 public class VariableArithmeticExp extends ValueArithmeticExp implements Serializable {15 private String name;16 17 /**18 * Crea una instancia de <code>VariableArithmeticExp</code>.19 * @param name20 */21 public VariableArithmeticExp(String name) {22 this.name = name;23 }24 25 /**26 * Retorna un valor float a partir de un nombre.27 * @param context28 * @return29 */30 public float value(Map context) {31 return ((SharedFloat) context.get(name)).floatValue();32 }33 34 /**35 * Metodo toString de la clase.36 * @return37 */38 public String toString() {39 return "#" + name;40 }41 42 /**43 * Agrega un nombre a la coleccion.44 * @param variables45 */46 public void getVariables(Collection variables) {47 variables.add(name);48 }49 }50