Package org.apache.poi.ss.formula.eval

Examples of org.apache.poi.ss.formula.eval.StringEval


          default:
            // never matches (also inconsistent with above three cases).
            // for example '>5' does not match '6',
            return false;
        }
        StringEval se = (StringEval)x;
        Double val = OperandResolver.parseDouble(se.getStringValue());
        if(val == null) {
          // x is text that is not a number
          return false;
        }
        return _value == val.doubleValue();
View Full Code Here


        if (true) { // change to false to observe more intuitive behaviour
          // Note - Unlike with numbers, it seems that COUNTIF never matches
          // boolean values when the target(x) is a string
          return false;
        }
        StringEval se = (StringEval)x;
        Boolean val = parseBoolean(se.getStringValue());
        if(val == null) {
          // x is text that is not a boolean
          return false;
        }
        testValue = boolToInt(val.booleanValue());
View Full Code Here

    // Error handling for lookup_range arg is also unusual
    if(eval instanceof NumericValueEval) {
      throw new EvaluationException(ErrorEval.NA);
    }
    if (eval instanceof StringEval) {
      StringEval se = (StringEval) eval;
      Double d = OperandResolver.parseDouble(se.getStringValue());
      if(d == null) {
        // plain string
        throw new EvaluationException(ErrorEval.VALUE_INVALID);
      }
      // else looks like a number
View Full Code Here

    if(match_type instanceof NumericValueEval) {
      NumericValueEval ne = (NumericValueEval) match_type;
      return ne.getNumberValue();
    }
    if (match_type instanceof StringEval) {
      StringEval se = (StringEval) match_type;
      Double d = OperandResolver.parseDouble(se.getStringValue());
      if(d == null) {
        // plain string
        throw new EvaluationException(ErrorEval.VALUE_INVALID);
      }
      // if the string parses as a number, it is OK
View Full Code Here

           switch(srcCell.getCachedFormulaResultType()) {
             case Cell.CELL_TYPE_NUMERIC:
               result = new NumberEval(srcCell.getNumericCellValue());
               break;
             case Cell.CELL_TYPE_STRING:
               result =  new StringEval(srcCell.getStringCellValue());
               break;
             case Cell.CELL_TYPE_BLANK:
               result = BlankEval.instance;
               break;
             case Cell.CELL_TYPE_BOOLEAN:
View Full Code Here

    int cellType = cell.getCellType();
    switch (cellType) {
      case Cell.CELL_TYPE_NUMERIC:
        return new NumberEval(cell.getNumericCellValue());
      case Cell.CELL_TYPE_STRING:
        return new StringEval(cell.getStringCellValue());
      case Cell.CELL_TYPE_BOOLEAN:
        return BoolEval.valueOf(cell.getBooleanCellValue());
      case Cell.CELL_TYPE_BLANK:
        return BlankEval.instance;
      case Cell.CELL_TYPE_ERROR:
View Full Code Here

       }
       if (ptg instanceof NumberPtg) {
           return new NumberEval(((NumberPtg)ptg).getValue());
       }
       if (ptg instanceof StringPtg) {
           return new StringEval(((StringPtg) ptg).getValue());
       }
       if (ptg instanceof BoolPtg) {
           return BoolEval.valueOf(((BoolPtg) ptg).getValue());
       }
       if (ptg instanceof ErrPtg) {
View Full Code Here

        if (strb.toString().length() > 32767) {
            return ErrorEval.VALUE_INVALID;
        }

        return new StringEval(strb.toString());
    }
View Full Code Here

        //If DEC2BIN requires more than places characters, it returns the #NUM! error value.
        if (binary.length() > placesNumber) {
            return ErrorEval.NUM_ERROR;
        }

        return new StringEval(binary);
    }
View Full Code Here

        }
        if (number > 3999) {
            return ErrorEval.VALUE_INVALID;
        }
        if (number == 0) {
            return new StringEval("");
        }

        int form = 0;
        try {
            ValueEval ve = OperandResolver.getSingleValue(formVE, srcRowIndex, srcColumnIndex);
            form = OperandResolver.coerceValueToInt(ve);
        } catch (EvaluationException e) {
            return ErrorEval.NUM_ERROR;
        }

        if (form > 4 || form < 0) {
            return ErrorEval.VALUE_INVALID;
        }

        String result = this.integerToRoman(number);

        if (form == 0) {
            return new StringEval(result);
        }

        return new StringEval(makeConcise(result, form));
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.formula.eval.StringEval

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.