Examples of ValueEval


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

public abstract class TextFunction implements Function {
   
    protected static final String EMPTY_STRING = "";
   
    protected ValueEval singleOperandEvaluate(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);
                    retval = attemptXlateToText(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
            }
            else if (ae.isColumn()) {
                if (ae.containsRow(srcRow)) {
                    ValueEval ve = ae.getValueAt(srcRow, ae.getFirstColumn());
                    retval = attemptXlateToText(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
View Full Code Here

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

     * the returned value is ErrorEval.VALUE_INVALID
     * @param ve
     * @return
     */
    protected ValueEval attemptXlateToText(ValueEval ve) {
        ValueEval retval;
        if (ve instanceof StringValueEval) {
            retval = ve;
        }
        else if (ve instanceof RefEval) {
            RefEval re = (RefEval) ve;
            ValueEval ive = re.getInnerValueEval();
            if (ive instanceof StringValueEval) {
                retval = ive;
            }
            else if (ive instanceof BlankEval) {
                retval = ive;
View Full Code Here

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

            else {
                Eval ptgEval = getEvalForPtg(ptgs[i]);
                stack.push(ptgEval);
            }
        }
        ValueEval value = ((ValueEval) stack.pop());
        if (value instanceof RefEval) {
            RefEval rv = (RefEval) value;
            value = rv.getInnerValueEval();
        }
        else if (value instanceof AreaEval) {
View Full Code Here

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

     * @param sheet
     * @param workbook
     * @return
     */
    protected static ValueEval getEvalForCell(HSSFCell cell, HSSFRow row, HSSFSheet sheet, HSSFWorkbook workbook) {
        ValueEval retval = BlankEval.INSTANCE;
        if (cell != null) {
            switch (cell.getCellType()) {
            case HSSFCell.CELL_TYPE_NUMERIC:
                retval = new NumberEval(cell.getNumericCellValue());
                break;
View Full Code Here

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

*/
public class Ln 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

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

    }

   
   
    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
        ValueEval retval = null;
        double[] values = getNumberArray(operands, srcCellRow, srcCellCol);
        if (values == null) {
            retval = ErrorEval.VALUE_INVALID;
        }
        else {
View Full Code Here

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

*/
public class Sqrt 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

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

        return DEFAULT_NUM_XLATOR;
    }

   
    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
        ValueEval retval = null;
        double[] values = getNumberArray(operands, srcCellRow, srcCellCol);
        if (values == null) {
            retval = ErrorEval.VALUE_INVALID;
        }
        else {
View Full Code Here

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

    public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
        double d = 0;
        double base = DEFAULT_BASE;
        double num = 0;
        ValueEval retval = null;

        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
        case 2: // second arg is base
            ValueEval ve = singleOperandEvaluate(operands[1], srcRow, srcCol);
            if (ve instanceof NumericValueEval) {
                NumericValueEval ne = (NumericValueEval) ve;
                base = ne.getNumberValue();
            }
            else if (ve instanceof BlankEval) {
                // do nothing
            }
            else {
                retval = ErrorEval.NUM_ERROR;
            }

        case 1: // first arg is number
            if (retval == null) {
                ValueEval vev = singleOperandEvaluate(operands[0], srcRow, srcCol);
                if (vev instanceof NumericValueEval) {
                    NumericValueEval ne = (NumericValueEval) vev;
                    num = ne.getNumberValue();
                }
                else if (vev instanceof BlankEval) {
View Full Code Here

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

    }

   
   
    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
        ValueEval retval = null;
        double[] ops = getNumberArray(operands, srcCellRow, srcCellCol);
        if (ops == null || ops.length < 2) {
            retval = ErrorEval.VALUE_INVALID;
        }
        else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.