Top Description Fields Constructors Methods
org.apache.poi.ss.formula

public final Class OperationEvaluationContext

extends Object
Class Inheritance
Imports
org.apache.poi.ss.SpreadsheetVersion, org.apache.poi.ss.formula.CollaboratingWorkbooksEnvironment.WorkbookNotFoundException, .EvaluationWorkbook.ExternalName, .EvaluationWorkbook.ExternalSheet, .EvaluationWorkbook.ExternalSheetRange, org.apache.poi.ss.formula.constant.ErrorConstant, org.apache.poi.ss.formula.eval.AreaEval, .BoolEval, .ErrorEval, .ExternalNameEval, .FunctionNameEval, .NumberEval, .RefEval, .StringEval, .ValueEval, org.apache.poi.ss.formula.functions.FreeRefFunction, org.apache.poi.ss.formula.ptg.Area3DPtg, .Area3DPxg, .NameXPtg, .NameXPxg, .Ptg, .Ref3DPtg, .Ref3DPxg, org.apache.poi.ss.util.CellReference, .CellReference.NameType, org.apache.poi.util.LocaleUtil

Contains all the contextual information required to evaluate an operation within a formula

For POI internal use only

Field Summary

Modifier and TypeField and Description
private final WorkbookEvaluator
private final int
private boolean
private final boolean
private final int
private final int
private final EvaluationTracker
private final EvaluationWorkbook
public static final FreeRefFunction

Constructor Summary

AccessConstructor and Description
public
OperationEvaluationContext(WorkbookEvaluator bookEvaluator, EvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum, EvaluationTracker tracker)

public
OperationEvaluationContext(WorkbookEvaluator bookEvaluator, EvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum, EvaluationTracker tracker, boolean isSingleValue)

Method Summary

Modifier and TypeMethod and Description
public static CellReference
applyR1C1Reference(CellReference anchorReference, String relativeReference)

private static CellReference.NameType
private ValueEval
pack-priv SheetRangeEvaluator
pack-priv SheetRangeEvaluator
createExternSheetRefEvaluator(String firstSheetName, String lastSheetName, int externalWorkbookNumber)

pack-priv SheetRangeEvaluator
createExternSheetRefEvaluator(int externSheetIndex)

pack-priv SheetRangeEvaluator
private SheetRefEvaluator

Returns:

null if either workbook or sheet is not found
createExternSheetRefEvaluator
(String workbookName, String sheetName)

public FreeRefFunction
public ValueEval
public ValueEval
public ValueEval
getAreaEval(int firstRowIndex, int firstColumnIndex, int lastRowIndex, int lastColumnIndex)

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

public int
public ValueEval

Returns:

a RefEval or AreaEval
getDynamicReference
(String
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.
workbookName
,
String
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.
sheetName
,
String
the single cell reference or first part of the area reference. Must not be null.
refStrPart1
,
String
the second part of the area reference. For single cell references this parameter must be null
refStrPart2
,
boolean
specifies the format for refStrPart1 and refStrPart2. Pass true for 'A1' style and false for 'R1C1' style.
isA1Style
)

Resolves a cell or area reference dynamically.

private ValueEval
private ValueEval
private ValueEval
public ValueEval
public ValueEval
private static CellReference.NameType
public ValueEval
public ValueEval
public ValueEval
getRefEval(int rowIndex, int columnIndex)

public SheetRangeEvaluator
public int
public int
public EvaluationWorkbook
public boolean
public boolean

Returns:

flag indicating whether evaluation should "unwrap" the result to a single value based on the context row/column
isSingleValue
()

default true

private static int
parseColRef(String refStrPart)

private static int
parseRowRef(String refStrPart)

public void
setArrayMode(boolean value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_bookEvaluatorback to summary
private final WorkbookEvaluator _bookEvaluator
_columnIndexback to summary
private final int _columnIndex
_isInArrayContextback to summary
private boolean _isInArrayContext
_isSingleValueback to summary
private final boolean _isSingleValue
_rowIndexback to summary
private final int _rowIndex
_sheetIndexback to summary
private final int _sheetIndex
_trackerback to summary
private final EvaluationTracker _tracker
_workbookback to summary
private final EvaluationWorkbook _workbook
UDFback to summary
public static final FreeRefFunction UDF

Constructor Detail

OperationEvaluationContextback to summary
public OperationEvaluationContext(WorkbookEvaluator bookEvaluator, EvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum, EvaluationTracker tracker)
OperationEvaluationContextback to summary
public OperationEvaluationContext(WorkbookEvaluator bookEvaluator, EvaluationWorkbook workbook, int sheetIndex, int srcRowNum, int srcColNum, EvaluationTracker tracker, boolean isSingleValue)

Method Detail

applyR1C1Referenceback to summary
public static CellReference applyR1C1Reference(CellReference anchorReference, String relativeReference)
classifyCellReferenceback to summary
private static CellReference.NameType classifyCellReference(String str, SpreadsheetVersion ssVersion)
convertObjectEvalback to summary
private ValueEval convertObjectEval(Object token)
createExternSheetRefEvaluatorback to summary
pack-priv SheetRangeEvaluator createExternSheetRefEvaluator(ExternSheetReferenceToken ptg)
createExternSheetRefEvaluatorback to summary
pack-priv SheetRangeEvaluator createExternSheetRefEvaluator(String firstSheetName, String lastSheetName, int externalWorkbookNumber)
createExternSheetRefEvaluatorback to summary
pack-priv SheetRangeEvaluator createExternSheetRefEvaluator(int externSheetIndex)
createExternSheetRefEvaluatorback to summary
pack-priv SheetRangeEvaluator createExternSheetRefEvaluator(EvaluationWorkbook.ExternalSheet externalSheet)
createExternSheetRefEvaluatorback to summary
private SheetRefEvaluator createExternSheetRefEvaluator(String workbookName, String sheetName)
Returns:SheetRefEvaluator

null if either workbook or sheet is not found

findUserDefinedFunctionback to summary
public FreeRefFunction findUserDefinedFunction(String functionName)
getArea3DEvalback to summary
public ValueEval getArea3DEval(Area3DPtg aptg)
getArea3DEvalback to summary
public ValueEval getArea3DEval(Area3DPxg aptg)
getAreaEvalback to summary
public ValueEval getAreaEval(int firstRowIndex, int firstColumnIndex, int lastRowIndex, int lastColumnIndex)
getAreaValueEvalback to summary
public ValueEval getAreaValueEval(int firstRowIndex, int firstColumnIndex, int lastRowIndex, int lastColumnIndex, Object[][] tokens)
getColumnIndexback to summary
public int getColumnIndex()
getDynamicReferenceback to summary
public ValueEval getDynamicReference(String workbookName, String sheetName, String refStrPart1, String refStrPart2, boolean isA1Style)

Resolves a cell or area reference dynamically.

Parameters
workbookName:String

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:String

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:String

the single cell reference or first part of the area reference. Must not be null.

refStrPart2:String

the second part of the area reference. For single cell references this parameter must be null

isA1Style:boolean

specifies the format for refStrPart1 and refStrPart2. Pass true for 'A1' style and false for 'R1C1' style.

Returns:ValueEval

a RefEval or AreaEval

Exceptions
IllegalStateException:
If invalid parameters are provided
getExternalNameXEvalback to summary
private ValueEval getExternalNameXEval(EvaluationWorkbook.ExternalName externName, String workbookName)
getLocalNameXEvalback to summary
private ValueEval getLocalNameXEval(NameXPxg nameXPxg)
getLocalNameXEvalback to summary
private ValueEval getLocalNameXEval(NameXPtg nameXPtg)
getNameXEvalback to summary
public ValueEval getNameXEval(NameXPtg nameXPtg)
getNameXEvalback to summary
public ValueEval getNameXEval(NameXPxg nameXPxg)
getR1C1CellTypeback to summary
private static CellReference.NameType getR1C1CellType(String str)
getRef3DEvalback to summary
public ValueEval getRef3DEval(Ref3DPtg rptg)
getRef3DEvalback to summary
public ValueEval getRef3DEval(Ref3DPxg rptg)
getRefEvalback to summary
public ValueEval getRefEval(int rowIndex, int columnIndex)
getRefEvaluatorForCurrentSheetback to summary
public SheetRangeEvaluator getRefEvaluatorForCurrentSheet()
getRowIndexback to summary
public int getRowIndex()
getSheetIndexback to summary
public int getSheetIndex()
getWorkbookback to summary
public EvaluationWorkbook getWorkbook()
isArraymodeback to summary
public boolean isArraymode()
isSingleValueback to summary
public boolean isSingleValue()

default true

Returns:boolean

flag indicating whether evaluation should "unwrap" the result to a single value based on the context row/column

parseColRefback to summary
private static int parseColRef(String refStrPart)
parseRowRefback to summary
private static int parseRowRef(String refStrPart)
setArrayModeback to summary
public void setArrayMode(boolean value)