FileDocCategorySizeDatePackage
NumericFunction.javaAPI DocApache Poi 3.0.13969Sun Mar 11 12:59:30 GMT 2007org.apache.poi.hssf.record.formula.functions

NumericFunction

public abstract class NumericFunction extends Object implements Function
author
Amol S. Deshmukh < amolweb at ya hoo dot com >

Fields Summary
protected static final double
E
protected static final double
PI
private static final org.apache.poi.hssf.record.formula.eval.ValueEvalToNumericXlator
DEFAULT_NUM_XLATOR
private static final int
DEFAULT_MAX_NUM_OPERANDS
Constructors Summary
Methods Summary
protected org.apache.poi.hssf.record.formula.eval.ValueEvalToNumericXlatorgetXlator()
this is the default impl of the factory(ish) method getXlator. Subclasses can override this method if they desire to return a different ValueEvalToNumericXlator instance than the default.


                                    
       
        return DEFAULT_NUM_XLATOR;
    
protected org.apache.poi.hssf.record.formula.eval.ValueEvalsingleOperandEvaluate(org.apache.poi.hssf.record.formula.eval.Eval eval, int srcRow, short srcCol)

        ValueEval retval;
        if (eval instanceof AreaEval) {
            AreaEval ae = (AreaEval) eval;
            if (ae.contains(srcRow, srcCol)) { // circular ref!
                retval = ErrorEval.CIRCULAR_REF_ERROR;
            }
            else if (ae.isRow()) {
                if (ae.containsColumn(srcCol)) {
                    ValueEval ve = ae.getValueAt(ae.getFirstRow(), srcCol);
                    ve = getXlator().attemptXlateToNumeric(ve);
                    retval = getXlator().attemptXlateToNumeric(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
            }
            else if (ae.isColumn()) {
                if (ae.containsRow(srcRow)) {
                    ValueEval ve = ae.getValueAt(srcRow, ae.getFirstColumn());
                    retval = getXlator().attemptXlateToNumeric(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
            }
            else {
                retval = ErrorEval.VALUE_INVALID;
            }
        }
        else {
            retval = getXlator().attemptXlateToNumeric((ValueEval) eval);
        }
        return retval;