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

Average

public class Average extends MultiOperandNumericFunction
author
Amol S. Deshmukh < amolweb at ya hoo dot com >

Fields Summary
private static final org.apache.poi.hssf.record.formula.eval.ValueEvalToNumericXlator
DEFAULT_NUM_XLATOR
Constructors Summary
Methods Summary
public org.apache.poi.hssf.record.formula.eval.Evalevaluate(org.apache.poi.hssf.record.formula.eval.Eval[] operands, int srcCellRow, short srcCellCol)

        ValueEval retval = null;
        double[] values = getNumberArray(operands, srcCellRow, srcCellCol);
        if (values == null) {
            retval = ErrorEval.VALUE_INVALID;
        }
        else {
            double d = MathX.average(values);
            retval = (Double.isNaN(d) || Double.isInfinite(d))
                    ? (ValueEval) ErrorEval.NUM_ERROR
                    : new NumberEval(d);
        }
        
        return retval;
    
protected org.apache.poi.hssf.record.formula.eval.ValueEvalToNumericXlatorgetXlator()
this is the default impl for the factory method getXlator of the super class NumericFunction. Subclasses can override this method if they desire to return a different ValueEvalToNumericXlator instance than the default.

    
                                         
       
        return DEFAULT_NUM_XLATOR;