FileDocCategorySizeDatePackage
NumberEval.javaAPI DocApache Poi 3.0.12184Sun Mar 11 12:59:28 GMT 2007org.apache.poi.hssf.record.formula.eval

NumberEval

public class NumberEval extends Object implements NumericValueEval, StringValueEval
author
Amol S. Deshmukh < amolweb at ya hoo dot com >

Fields Summary
public static final NumberEval
ZERO
private double
value
private String
stringValue
Constructors Summary
public NumberEval(Ptg ptg)


       
        if (ptg instanceof IntPtg) {
            this.value = ((IntPtg) ptg).getValue();
        }
        else if (ptg instanceof NumberPtg) {
            this.value = ((NumberPtg) ptg).getValue();
        }
    
public NumberEval(double value)

        this.value = value;
    
Methods Summary
public doublegetNumberValue()

        return value;
    
public java.lang.StringgetStringValue()

 // TODO: limit to 15 decimal places
        if (stringValue == null)
            makeString();
        return stringValue;
    
protected voidmakeString()

        if (!Double.isNaN(value)) {
            long lvalue = Math.round(value);
            if (lvalue == value) {
                stringValue = String.valueOf(lvalue);
            }
            else {
                stringValue = String.valueOf(value);
            }
        }