Class ErrorEval

java.lang.Object
io.keikai.range.formula.ErrorEval
All Implemented Interfaces:
ValueEval

public final class ErrorEval extends Object implements ValueEval
Error value in the formula evaluator (e.g. #VALUE!, #DIV/0!, #N/A, …).

Returned by Function.evaluate(io.keikai.range.formula.ValueEval[], int, int) to propagate Excel error codes back to the caller. Use the named constants (VALUE_INVALID, NA, …) — ErrorEval instances are flyweight singletons.

Replaces org.apache.poi.ss.formula.eval.ErrorEval. Error codes match Excel / ECMA-376 §18.17.3 (errorTypeValues).

Since:
7.0.0
  • Field Details

    • NULL_INTERSECTION

      public static final ErrorEval NULL_INTERSECTION
      #NULL! — intersection of two ranges does not intersect.
    • DIV_ZERO

      public static final ErrorEval DIV_ZERO
      #DIV/0! — division by zero.
    • VALUE_INVALID

      public static final ErrorEval VALUE_INVALID
      #VALUE! — wrong type of argument.
    • REF_INVALID

      public static final ErrorEval REF_INVALID
      #REF! — invalid cell reference (often after delete).
    • NAME_INVALID

      public static final ErrorEval NAME_INVALID
      #NAME? — unrecognised name in formula.
    • NUM_ERROR

      public static final ErrorEval NUM_ERROR
      #NUM! — numeric value out of legal range.
    • NA

      public static final ErrorEval NA
      #N/A — value not available to the function.
  • Method Details

    • getErrorCode

      public int getErrorCode()
      Returns:
      the Excel error code (0, 7, 15, 23, 29, 36, 42).
    • getErrorString

      public String getErrorString()
      Returns:
      the Excel-style error string (e.g. "#VALUE!").
    • valueOf

      public static ErrorEval valueOf(int code)
      Look up an ErrorEval by its Excel error code.
      Parameters:
      code - Excel error code (0, 7, 15, 23, 29, 36, 42)
      Returns:
      the matching singleton
      Throws:
      IllegalArgumentException - for an unknown code
    • toString

      public String toString()
      Overrides:
      toString in class Object