public final class ForkedEvaluator
extends java.lang.Object
HSSFWorkbook
or
XSSFWorkbook
. This class enables a 'master workbook' to be loaded just once and shared between many evaluation clients. Each evaluation client creates its own
ForkedEvaluator
and can set cell values that will be used for local evaluations (and don't disturb evaluations on other evaluators).
(一种替代工作簿评估器,可在单个工作簿同时和独立评估多次的情况下节省内存。使用标准公式评估,大约 90% 的内存消耗是由于加载 HSSFWorkbook 或 XSSFWorkbook。此类使“主工作簿”只需加载一次并在许多评估客户端之间共享。每个评估客户端创建自己的 ForkedEvaluator 并可以设置将用于本地评估的单元格值(并且不要干扰其他评估器的评估)。)
Modifier and Type | Method and Description |
---|---|
void |
copyUpdatedCells(Workbook workbook)
Copies the values of all updated cells (modified by calls to
updateCell(String, int, int, ValueEval) ) to the supplied
workbook.
Typically, the supplied workbook is a writable copy of the 'master workbook', but at the very least it must contain sheets with the same names. (将所有更新单元格的值(通过调用 updateCell(String, int, int, ValueEval) 进行修改)复制到提供的工作簿。通常,提供的工作簿是“主工作簿”的可写副本,但至少它必须包含具有相同名称的工作表。) |
static ForkedEvaluator |
create(Workbook wb, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) |
ValueEval |
evaluate(java.lang.String sheetName, int rowIndex, int columnIndex)
If cell contains a formula, the formula is evaluated and returned, else the CellValue simply copies the appropriate cell value from the cell and also its cell type.
(如果单元格包含公式,则计算并返回公式,否则 CellValue 只是从单元格中复制适当的单元格值及其单元格类型。)
|
static void |
setupEnvironment(java.lang.String[] workbookNames, ForkedEvaluator[] evaluators)
Coordinates several formula evaluators together so that formulas that involve external references can be evaluated.
(将多个公式评估器协调在一起,以便可以评估涉及外部引用的公式。)
|
void |
updateCell(java.lang.String sheetName, int rowIndex, int columnIndex, ValueEval value)
Sets the specified cell to the supplied
value
(将指定的单元格设置为提供的值)
|
public static ForkedEvaluator create(Workbook wb, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
udfFinder
- pass
null
for default (AnalysisToolPak only)
(udfFinder - 传递 null 为默认值(仅限AnalysisToolPak))
public void updateCell(java.lang.String sheetName, int rowIndex, int columnIndex, ValueEval value)
sheetName
- the name of the sheet containing the cell
(sheetName - 包含单元格的工作表的名称)
rowIndex
- zero based
(rowIndex - 从零开始)
columnIndex
- zero based
(columnIndex - 从零开始)
public void copyUpdatedCells(Workbook workbook)
updateCell(String, int, int, ValueEval)
) to the supplied
workbook.
public ValueEval evaluate(java.lang.String sheetName, int rowIndex, int columnIndex)
sheetName
- the name of the sheet containing the cell
(sheetName - 包含单元格的工作表的名称)
rowIndex
- zero based
(rowIndex - 从零开始)
columnIndex
- zero based
(columnIndex - 从零开始)
null
if the supplied cell is
null
or blank
(如果提供的单元格为空或空白,则为空)
public static void setupEnvironment(java.lang.String[] workbookNames, ForkedEvaluator[] evaluators)
workbookNames
- the simple file names used to identify the workbooks in formulas with external links (for example "MyData.xls" as used in a formula "[MyData.xls]Sheet1!A1")
(workbookNames - 用于在具有外部链接的公式中标识工作簿的简单文件名(例如,公式“[MyData.xls]Sheet1!A1”中使用的“MyData.xls”))
evaluators
- all evaluators for the full set of workbooks required by the formulas.
(评估者 - 公式所需的全套工作簿的所有评估者。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.