Package org.apache.poi.hssf.record.formula.eval

Examples of org.apache.poi.hssf.record.formula.eval.ValueEval


public class Pv extends FinanceFunction {

    public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
        double rate = 0, fv = 0, nper = 0, pmt = 0, d = 0;
        boolean type = false;
        ValueEval retval = null;
        ValueEval ve = null;
       
        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
View Full Code Here


     * recursively evaluate any RefEvals
     * @param reval
     * @return
     */
    protected ValueEval xlateRefEval(RefEval reval) {
        ValueEval retval = (ValueEval) reval.getInnerValueEval();
       
        if (retval instanceof RefEval) {
            RefEval re = (RefEval) retval;
            retval = xlateRefEval(re);
        }
View Full Code Here

*/
public class And extends BooleanFunction {

    public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
        ValueEval retval = null;
        boolean b = true;
        boolean atleastOneNonBlank = false;
       
        /*
         * Note: do not abort the loop if b is false, since we could be
         * dealing with errorevals later.
         */
        outer:
        for (int i=0, iSize=operands.length; i<iSize; i++) {
            if (operands[i] instanceof AreaEval) {
                AreaEval ae = (AreaEval) operands[i];
                ValueEval[] values = ae.getValues();
                for (int j=0, jSize=values.length; j<jSize; j++) {
                    ValueEval tempVe = singleOperandEvaluate(values[j], srcRow, srcCol, true);
                    if (tempVe instanceof BoolEval) {
                        b = b && ((BoolEval) tempVe).getBooleanValue();
                        atleastOneNonBlank = true;
                    }
                    else if (tempVe instanceof ErrorEval) {
                        retval = tempVe;
                        break outer;
                    }
                }
            }
            else {
                ValueEval tempVe = singleOperandEvaluate(operands[i], srcRow, srcCol, false);
                if (tempVe instanceof BoolEval) {
                    b = b && ((BoolEval) tempVe).getBooleanValue();
                    atleastOneNonBlank = true;
                }
                else if (tempVe instanceof StringEval) {
View Full Code Here

                 * of RefEvals as the "values" array.
                 */
                RefEval re = (values[j] instanceof RefEval)
                        ? new Ref2DEval(null, ((RefEval) values[j]).getInnerValueEval(), true)
                        : new Ref2DEval(null, values[j], false);
                ValueEval ve = singleOperandEvaluate(re, srcRow, srcCol);
               
                if (ve instanceof NumericValueEval) {
                    NumericValueEval nve = (NumericValueEval) ve;
                    retval = putInArray(retval, count++, nve.getNumberValue());
                }
                else if (ve instanceof BlankEval) {} // ignore operand
                else {
                    retval = null; // null => indicate to calling subclass that error occurred
                    break;
                }
            }
        }
        else { // for ValueEvals other than AreaEval
            retval = new double[1];
            ValueEval ve = singleOperandEvaluate(operand, srcRow, srcCol);
           
            if (ve instanceof NumericValueEval) {
                NumericValueEval nve = (NumericValueEval) ve;
                retval = putInArray(retval, count++, nve.getNumberValue());
            }
View Full Code Here

public class Pmt extends FinanceFunction {

    public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
        double rate = 0, fv = 0, nper = 0, pv = 0, d = 0;
        boolean type = false;
        ValueEval retval = null;
        ValueEval ve = null;
       
        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
View Full Code Here

*/
public class Sign extends NumericFunction {
   
    public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
        double d = 0;
        ValueEval retval = null;
       
        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
        case 1:
            ValueEval ve = singleOperandEvaluate(operands[0], srcRow, srcCol);
            if (ve instanceof NumericValueEval) {
                NumericValueEval ne = (NumericValueEval) ve;
                d = ne.getNumberValue();
            }
            else if (ve instanceof BlankEval) {
View Full Code Here

*
*/
public class Row implements Function {

    public Eval evaluate(Eval[] evals, int srcCellRow, short srcCellCol) {
        ValueEval retval = null;
        int rnum = -1;
       
        switch (evals.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
View Full Code Here

public class Nper extends FinanceFunction {

    public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
        double rate = 0, fv = 0, pmt = 0, pv = 0, d = 0;
        boolean type = false;
        ValueEval retval = null;
        ValueEval ve = null;
       
        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
View Full Code Here

* @author
*
*/
public class Column implements Function {
    public Eval evaluate(Eval[] evals, int srcCellRow, short srcCellCol) {
        ValueEval retval = null;
        int cnum = -1;
       
        switch (evals.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
View Full Code Here

public class Rounddown extends NumericFunction {

    public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
        double d0 = 0;
        double d1 = 0;
        ValueEval retval = null;

        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
        case 2:
            ValueEval ve = singleOperandEvaluate(operands[0], srcRow, srcCol);
            if (ve instanceof NumericValueEval) {
                NumericValueEval ne = (NumericValueEval) ve;
                d0 = ne.getNumberValue();
            }
            else if (ve instanceof BlankEval) {
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.eval.ValueEval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.