Class OperationEvaluationContext


  • public final class OperationEvaluationContext
    extends Object
    Contains all the contextual information required to evaluate an operation within a formula

    For POI internal use only

    • Constructor Detail

      • OperationEvaluationContext

        public OperationEvaluationContext​(WorkbookEvaluator bookEvaluator,
                                          EvaluationWorkbook workbook,
                                          int sheetIndex,
                                          int srcRowNum,
                                          int srcColNum,
                                          org.apache.poi.ss.formula.EvaluationTracker tracker,
                                          boolean isSingleValue,
                                          DependencyTracker dependencyTracker,
                                          Object ref,
                                          int[] offset)
    • Method Detail

      • enterFunction

        public void enterFunction​(int funcId)
        Call when entering a function, used to examine current scope is in an aggregate function or not.
        Parameters:
        funcId - the function id
        Since:
        5.8.0
      • leaveFunction

        public void leaveFunction()
        Call when leaving a function, used for examine current scope is in an aggregate function or not.
        Since:
        5.8.0
      • isArrayValue

        public boolean isArrayValue()
        Returns current scope is need an array value.
        Since:
        5.8.0
      • clearFunctionStack

        public void clearFunctionStack()
        Clear function scope stack.
        Since:
        5.8.0
      • isArraymode

        public boolean isArraymode()
      • setArrayMode

        public void setArrayMode​(boolean value)
      • getRowIndex

        public int getRowIndex()
      • getColumnIndex

        public int getColumnIndex()
      • getDynamicReference

        public ValueEval getDynamicReference​(String workbookName,
                                             String sheetName,
                                             String refStrPart1,
                                             String refStrPart2,
                                             boolean isA1Style)
        Resolves a cell or area reference dynamically.
        Parameters:
        workbookName - the name of the workbook containing the reference. If null the current workbook is assumed. Note - to evaluate formulas which use multiple workbooks, a CollaboratingWorkbooksEnvironment must be set up.
        sheetName - the name of the sheet containing the reference. May be null (when workbookName is also null) in which case the current workbook and sheet is assumed.
        refStrPart1 - the single cell reference or first part of the area reference. Must not be null.
        refStrPart2 - the second part of the area reference. For single cell references this parameter must be null
        isA1Style - specifies the format for refStrPart1 and refStrPart2. Pass true for 'A1' style and false for 'R1C1' style.
        Returns:
        a RefEval or AreaEval
        Throws:
        IllegalStateException - If invalid parameters are provided
      • clearOffsetRefPrecedent

        public void clearOffsetRefPrecedent()
      • createOffsetRefPrecedent

        public void createOffsetRefPrecedent​(ValueEval precedent)
      • getRefEval

        public ValueEval getRefEval​(int rowIndex,
                                    int columnIndex,
                                    boolean rowRel,
                                    boolean colRel)
      • getAreaEval

        public ValueEval getAreaEval​(int firstRowIndex,
                                     int firstColumnIndex,
                                     int lastRowIndex,
                                     int lastColumnIndex,
                                     boolean row1Rel,
                                     boolean col1Rel,
                                     boolean row2Rel,
                                     boolean col2Rel)
      • getAreaValueEval

        public ValueEval getAreaValueEval​(int firstRowIndex,
                                          int firstColumnIndex,
                                          int lastRowIndex,
                                          int lastColumnIndex,
                                          Object[][] tokens)
      • getSheetIndex

        public int getSheetIndex()
      • isSingleValue

        public boolean isSingleValue()
        default true
        Returns:
        flag indicating whether evaluation should "unwrap" the result to a single value based on the context row/column
      • getPtgIndex

        public int getPtgIndex()
      • setPtgIndex

        public void setPtgIndex​(int index)
      • getDependent

        public Object getDependent()
      • setEvalNameFormula

        public void setEvalNameFormula​(boolean evalNameFormula)
        Sets to indicate evaluating the DefinedName formula(evaluation result might be different from that of a cell formula) Default: false
        Parameters:
        evalNameFormula -
        Since:
        5.7.0
      • isEvalNameFormula

        public boolean isEvalNameFormula()
        Returns whether evaluating the DefinedName formula.
        Returns:
        Since:
        5.7.0