Search in sources :

Example 1 with ThreeDEval

use of org.apache.poi.ss.formula.ThreeDEval in project poi by apache.

the class MultiOperandNumericFunction method collectValues.

/**
	 * Collects values from a single argument
	 */
private void collectValues(ValueEval operand, DoubleList temp) throws EvaluationException {
    if (operand instanceof ThreeDEval) {
        ThreeDEval ae = (ThreeDEval) operand;
        for (int sIx = ae.getFirstSheetIndex(); sIx <= ae.getLastSheetIndex(); sIx++) {
            int width = ae.getWidth();
            int height = ae.getHeight();
            for (int rrIx = 0; rrIx < height; rrIx++) {
                for (int rcIx = 0; rcIx < width; rcIx++) {
                    ValueEval ve = ae.getValue(sIx, rrIx, rcIx);
                    if (!isSubtotalCounted() && ae.isSubTotal(rrIx, rcIx))
                        continue;
                    collectValue(ve, true, temp);
                }
            }
        }
        return;
    }
    if (operand instanceof TwoDEval) {
        TwoDEval ae = (TwoDEval) operand;
        int width = ae.getWidth();
        int height = ae.getHeight();
        for (int rrIx = 0; rrIx < height; rrIx++) {
            for (int rcIx = 0; rcIx < width; rcIx++) {
                ValueEval ve = ae.getValue(rrIx, rcIx);
                if (!isSubtotalCounted() && ae.isSubTotal(rrIx, rcIx))
                    continue;
                collectValue(ve, true, temp);
            }
        }
        return;
    }
    if (operand instanceof RefEval) {
        RefEval re = (RefEval) operand;
        for (int sIx = re.getFirstSheetIndex(); sIx <= re.getLastSheetIndex(); sIx++) {
            collectValue(re.getInnerValueEval(sIx), true, temp);
        }
        return;
    }
    collectValue(operand, false, temp);
}
Also used : TwoDEval(org.apache.poi.ss.formula.TwoDEval) ThreeDEval(org.apache.poi.ss.formula.ThreeDEval) RefEval(org.apache.poi.ss.formula.eval.RefEval) NumericValueEval(org.apache.poi.ss.formula.eval.NumericValueEval) ValueEval(org.apache.poi.ss.formula.eval.ValueEval) StringValueEval(org.apache.poi.ss.formula.eval.StringValueEval)

Aggregations

ThreeDEval (org.apache.poi.ss.formula.ThreeDEval)1 TwoDEval (org.apache.poi.ss.formula.TwoDEval)1 NumericValueEval (org.apache.poi.ss.formula.eval.NumericValueEval)1 RefEval (org.apache.poi.ss.formula.eval.RefEval)1 StringValueEval (org.apache.poi.ss.formula.eval.StringValueEval)1 ValueEval (org.apache.poi.ss.formula.eval.ValueEval)1