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

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


  public void testErrors() {
    ValueEval[] xValues = {
        ErrorEval.REF_INVALID,
        new NumberEval(2),
    };
    ValueEval areaEvalX = createAreaEval(xValues);
    ValueEval[] yValues = {
        new NumberEval(2),
        ErrorEval.NULL_INTERSECTION,
    };
    ValueEval areaEvalY = createAreaEval(yValues);
    ValueEval[] zValues = { // wrong size
        new NumberEval(2),
    };
    ValueEval areaEvalZ = createAreaEval(zValues);

    // if either arg is an error, that error propagates
    confirmError(ErrorEval.REF_INVALID, ErrorEval.NAME_INVALID, ErrorEval.REF_INVALID);
    confirmError(areaEvalX, ErrorEval.NAME_INVALID, ErrorEval.NAME_INVALID);
    confirmError(ErrorEval.NAME_INVALID, areaEvalX, ErrorEval.NAME_INVALID);
View Full Code Here


    ValueEval[] args = new ValueEval[] { new StringEval(strText), };
    return new Value().evaluate(args, -1, (short) -1);
  }

  private static void confirmValue(String strText, double expected) {
    ValueEval result = invokeValue(strText);
    assertEquals(NumberEval.class, result.getClass());
    assertEquals(expected, ((NumberEval) result).getNumberValue(), 0.0);
  }
View Full Code Here

    assertEquals(NumberEval.class, result.getClass());
    assertEquals(expected, ((NumberEval) result).getNumberValue(), 0.0);
  }

  private static void confirmValueError(String strText) {
    ValueEval result = invokeValue(strText);
    assertEquals(ErrorEval.class, result.getClass());
    assertEquals(ErrorEval.VALUE_INVALID, result);
  }
View Full Code Here

        ValueEval[] args = new ValueEval[]{new StringEval(numerator), new StringEval(denominator)};
        return new Quotient().evaluate(args, -1, -1);
    }

    private static void confirmValue(String msg, String numerator, String denominator, String expected) {
        ValueEval result = invokeValue(numerator, denominator);
        assertEquals(NumberEval.class, result.getClass());
        assertEquals(msg, expected, ((NumberEval) result).getStringValue());
    }
View Full Code Here

        assertEquals(NumberEval.class, result.getClass());
        assertEquals(msg, expected, ((NumberEval) result).getStringValue());
    }

    private static void confirmValueError(String msg, String numerator, String denominator, ErrorEval numError) {
        ValueEval result = invokeValue(numerator, denominator);
        assertEquals(ErrorEval.class, result.getClass());
        assertEquals(msg, numError, result);
    }
View Full Code Here

        ValueEval[] args = new ValueEval[]{new StringEval(real_num), new StringEval(i_num), new StringEval(suffix)};
        return new Complex().evaluate(args, -1, -1);
    }

    private static void confirmValue(String msg, String real_num, String i_num, String suffix, String expected) {
        ValueEval result = invokeValue(real_num, i_num, suffix);
        assertEquals(StringEval.class, result.getClass());
        assertEquals(msg, expected, ((StringEval) result).getStringValue());
    }
View Full Code Here

        assertEquals(StringEval.class, result.getClass());
        assertEquals(msg, expected, ((StringEval) result).getStringValue());
    }

    private static void confirmValueError(String msg, String real_num, String i_num, String suffix, ErrorEval numError) {
        ValueEval result = invokeValue(real_num, i_num, suffix);
        assertEquals(ErrorEval.class, result.getClass());
        assertEquals(msg, numError, result);
    }
View Full Code Here

    ValueEval[] args = new ValueEval[] { new StringEval(number1), };
    return new Dec2Hex().evaluate(args, -1, -1);
  }

  private static void confirmValue(String msg, String number1, String number2, String expected) {
    ValueEval result = invokeValue(number1, number2);
    assertEquals(StringEval.class, result.getClass());
    assertEquals(msg, expected, ((StringEval) result).getStringValue());
  }
View Full Code Here

    assertEquals(StringEval.class, result.getClass());
    assertEquals(msg, expected, ((StringEval) result).getStringValue());
  }

    private static void confirmValue(String msg, String number1, String expected) {
    ValueEval result = invokeValue(number1);
    assertEquals(StringEval.class, result.getClass());
    assertEquals(msg, expected, ((StringEval) result).getStringValue());
  }
View Full Code Here

    assertEquals(StringEval.class, result.getClass());
    assertEquals(msg, expected, ((StringEval) result).getStringValue());
  }

    private static void confirmValueError(String msg, String number1, String number2, ErrorEval numError) {
        ValueEval result = invokeValue(number1, number2);
        assertEquals(ErrorEval.class, result.getClass());
        assertEquals(msg, numError, result);
    }
View Full Code Here

TOP

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