Examples of Eval


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

        }
        return numval;
    }
   
    protected Eval xlateRefEval(RefEval reval) {
        Eval retval = reval.getInnerValueEval();
       
        if (retval instanceof RefEval) {
            retval = xlateRefEval((RefEval) retval);
        }
        return retval;
View Full Code Here

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

*
*/
public class Left extends TextFunction {

    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
        Eval retval = ErrorEval.VALUE_INVALID;
        int index = 1;
        switch (operands.length) {
        default:
            break;
        case 2:
            Eval indexEval = operands[1];
            index = evaluateAsInteger(indexEval);
            if (index < 0) {
                break;
            }
        case 1:
View Full Code Here

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

        }
        return numval;
    }
   
    protected Eval xlateRefEval(RefEval reval) {
        Eval retval = reval.getInnerValueEval();
       
        if (retval instanceof RefEval) {
            retval = xlateRefEval((RefEval) retval);
        }
        return retval;
View Full Code Here

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

* @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
*
*/
public class Isnumber extends LogicalFunction {
    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
        Eval retval = BoolEval.FALSE;
       
        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
        case 1:
            Eval eval = operands[0];
            if (eval instanceof NumberEval) {
                retval = BoolEval.TRUE;
            }
            else if (eval instanceof RefEval) {
                Eval xlatedEval = xlateRefEval((RefEval) eval);
                if (xlatedEval instanceof NumberEval) {
                    retval = BoolEval.TRUE;
                }
            }
        }
View Full Code Here

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

*
*/
public class If implements Function {

    public Eval evaluate(Eval[] evals, int srcCellRow, short srcCellCol) {
        Eval retval = null;
        Eval evalWhenFalse = BoolEval.FALSE;
        switch (evals.length) {
        case 3:
            evalWhenFalse = evals[2];
        case 2:
            BoolEval beval = (BoolEval) evals[0];
View Full Code Here

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

            retval = null;
        }
        else {
           
            for (int i=0, iSize=xops.length; i<iSize; i++) {
                Eval xEval = xops[i];
                Eval yEval = yops[i];
               
                if (isNumberEval(xEval) && isNumberEval(yEval)) {
                    retval[X] = ensureCapacity(retval[X], count);
                    retval[Y] = ensureCapacity(retval[Y], count);
                    retval[X][count] = getDoubleValue(xEval);
View Full Code Here

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

                int numops = operation.getNumberOfOperands();
                Eval[] ops = new Eval[numops];

                // storing the ops in reverse order since they are popping
                for (int j = numops - 1; j >= 0; j--) {
                    Eval p = (Eval) stack.pop();
                    ops[j] = p;
                }
                Eval opresult = invokeOperation(operation, ops, srcRowNum, srcColNum, workbook, sheet);
                stack.push(opresult);
            }
            else if (ptg instanceof RefPtg) {
                RefPtg refPtg = (RefPtg) ptg;
                int colIx = refPtg.getColumn();
                int rowIx = refPtg.getRow();
                HSSFRow row = sheet.getRow(rowIx);
                HSSFCell cell = (row != null) ? row.getCell(colIx) : null;
                stack.push(createRef2DEval(refPtg, cell, row, sheet, workbook));
            }
            else if (ptg instanceof Ref3DPtg) {
                Ref3DPtg refPtg = (Ref3DPtg) ptg;
                int colIx = refPtg.getColumn();
                int rowIx = refPtg.getRow();
                Workbook wb = workbook.getWorkbook();
                HSSFSheet xsheet = workbook.getSheetAt(wb.getSheetIndexFromExternSheetIndex(refPtg.getExternSheetIndex()));
                HSSFRow row = xsheet.getRow(rowIx);
                HSSFCell cell = (row != null) ? row.getCell(colIx) : null;
                stack.push(createRef3DEval(refPtg, cell, row, xsheet, workbook));
            }
            else if (ptg instanceof AreaPtg) {
                AreaPtg ap = (AreaPtg) ptg;
                AreaEval ae = evaluateAreaPtg(sheet, workbook, ap);
                stack.push(ae);
            }
            else if (ptg instanceof Area3DPtg) {
                Area3DPtg a3dp = (Area3DPtg) ptg;
                AreaEval ae = evaluateArea3dPtg(workbook, a3dp);
                stack.push(ae);
            }
            else {
                Eval ptgEval = getEvalForPtg(ptg);
                stack.push(ptgEval);
            }
        }

        ValueEval value = ((ValueEval) stack.pop());
View Full Code Here

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

     * passed here!
     *
     * @param ptg
     */
    protected static Eval getEvalForPtg(Ptg ptg) {
        Eval retval = null;

        Class clazz = (Class) VALUE_EVALS_MAP.get(ptg.getClass());
        try {
            if (ptg instanceof Area3DPtg) {
                Constructor constructor = clazz.getConstructor(AREA3D_CONSTRUCTOR_CLASS_ARRAY);
View Full Code Here

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

* @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
*
*/
public final class Isref implements Function {
    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {
        Eval retval = BoolEval.FALSE;

        switch (operands.length) {
        default:
            retval = ErrorEval.VALUE_INVALID;
            break;
        case 1:
            Eval eval = operands[0];
            if (eval instanceof RefEval || eval instanceof AreaEval) {
                retval = BoolEval.TRUE;
            }
        }

View Full Code Here

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

  public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) {
    if(args.length != 1) {
      return ErrorEval.VALUE_INVALID;
    }
    Eval arg = args[0];

    ValueEval singleCellValue;
    try {
      singleCellValue = OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
    } catch (EvaluationException e) {
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.