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

Examples of org.apache.poi.hssf.record.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

    if (startNum > strBuff.length()) {
      strBuff.append(newStr);
    } else {
      strBuff.insert(startNum - 1, newStr);
    }
    return new StringEval(strBuff.toString());
  }
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

    if (eval instanceof BoolEval) {
      BoolEval be = (BoolEval) eval;
      return CellValue.valueOf(be.getBooleanValue());
    }
    if (eval instanceof StringEval) {
      StringEval ne = (StringEval) eval;
      return new CellValue(ne.getStringValue());
    }
    if (eval instanceof ErrorEval) {
      return CellValue.getError(((ErrorEval)eval).getErrorCode());
    }
    throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");
View Full Code Here

      if (_isLeft) {
        result = arg.substring(0, Math.min(arg.length(), index));
      } else {
        result = arg.substring(Math.max(0, arg.length()-index));
      }
      return new StringEval(result);
    }
View Full Code Here

      // All errors get translated to #REF!
      throw EvaluationException.invalidRef();
    }
    int oneBasedIndex;
    if(veRowColIndexArg instanceof StringEval) {
      StringEval se = (StringEval) veRowColIndexArg;
      String strVal = se.getStringValue();
      Double dVal = OperandResolver.parseDouble(strVal);
      if(dVal == null) {
        // String does not resolve to a number. Raise #REF! error.
        throw EvaluationException.invalidRef();
        // This includes text booleans "TRUE" and "FALSE".  They are not valid.
View Full Code Here

    protected StringLookupComparer(StringEval se) {
      super(se);
      _value = se.getStringValue();
    }
    protected CompareResult compareSameType(ValueEval other) {
      StringEval se = (StringEval) other;
      return CompareResult.valueOf(_value.compareToIgnoreCase(se.getStringValue()));
    }
View Full Code Here

        result = replaceOneOccurrence(oldStr, searchStr, newStr, instanceNumber);
        break;
      case 3:
        result = replaceAllOccurrences(oldStr, searchStr, newStr);
    }
    return new StringEval(result);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.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.