public class EvaluationContext extends java.lang.Object implements IExpressionEvaluatorContext, IExpressionEvaluator
| Constructor and Description |
|---|
EvaluationContext(Workbook workbook) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDynamicDependency(CellRef cellRef)
Registers a dynamic dependency.
|
void |
enterInvariant()
Enters an invariant block.
|
java.lang.Object |
evaluate(java.lang.Object value)
Evaluates the specified object.
|
java.lang.Object |
evaluateIdentifier(IExpressionEvaluatorContext context,
java.lang.String identifier)
Evaluates the identifier with the specified name.
|
java.lang.Object |
evaluateMatrix(java.lang.Object value)
Evaluates the specified object.
|
java.lang.Object |
evaluateScalar(java.lang.Object value)
Evaluates the specified object.
|
java.lang.Object[] |
evaluateToArray(java.lang.Object value) |
com.mindfusion.spreadsheet.expressions.Criterion |
evaluateToCriterion(java.lang.Object value)
Evaluates the specified value to a Criterion object.
|
java.lang.Object |
evaluateToMatrix(java.lang.Object value)
Evaluates the specified value to a scalar value in the current context.
|
java.lang.Object |
evaluateToMatrixValue(java.lang.Object value)
Evaluates the specified value to a scalar value.
|
java.lang.Object |
evaluateToScalar(java.lang.Object value)
Evaluates the specified value to a scalar value in the current context.
|
java.lang.Object |
evaluateToScalarValue(java.lang.Object value)
Evaluates the specified value to a scalar value.
|
java.lang.Object |
evaluateToType(java.lang.Object value,
java.lang.Class<?> type)
Evaluates the specified value as the specified type in the current context.
|
java.lang.Object |
getCellsValue(CellRef cellRef) |
java.lang.Object |
getCellValue(CellRef cellRef) |
java.lang.Object |
getCellValue(java.lang.String sheetRef,
int c,
int r) |
java.lang.Object |
getCellValuesAsMatrix(CellRef cellRef) |
IExpressionEvaluator |
getCoreEvaluator()
Gets the core evaluator.
|
int |
getCurrentColumn()
The column of the cell being evaluated.
|
int |
getCurrentRow()
The row of the cell being evaluated.
|
Worksheet |
getCurrentWorksheet()
The worksheet containing the cell being evaluated.
|
java.lang.Iterable<CellRef> |
getDynamicDependencies() |
java.lang.Object |
getError(ErrorType errorType,
java.lang.String message)
Returns an error object of the specified type.
|
int |
getFinance_MaxIterations() |
double |
getFinance_Precision() |
java.util.Locale |
getLocale()
Gets the current locale.
|
java.lang.Object |
getOldValue()
The old value of cell being evaluated.
|
Workbook |
getWorkbook()
Gets a reference to the parent workbook.
|
java.lang.Object |
invokeFunction(IExpressionEvaluatorContext context,
java.lang.String name,
java.util.List<?> parameters)
Invokes the function with the specified name and parameters.
|
void |
leaveInvariant()
Leaves a previously entered invariant block.
|
void |
prepare(CellStorage cell) |
void |
prepare(Worksheet currentWorksheet,
int currentColumn,
int currentRow) |
java.lang.Boolean |
toBool(java.lang.Object value)
Attempts to convert the specified value to a boolean.
|
com.mindfusion.common.DateTime |
toDateTime(java.lang.Object value)
Attempts to convert the specified value to a
DateTime. |
java.lang.Double |
toDouble(java.lang.Object value)
Attempts to convert the specified value to a double.
|
java.lang.String |
toString(java.lang.Object value)
Attempts to convert the specified value to a string.
|
com.mindfusion.common.Duration |
toTimeSpan(java.lang.Object value)
Attempts to convert the specified value to a TimeSpan.
|
java.lang.Object |
toValue(java.lang.Object value)
Attempts to evaluate the specified object.
|
boolean |
tryGetCell(CellRef cellRef,
com.mindfusion.common.ByRef<CellStorage> cell) |
boolean |
tryGetCell(java.lang.String sheetRef,
int c,
int r,
com.mindfusion.common.ByRef<CellStorage> cell) |
public EvaluationContext(Workbook workbook)
public void prepare(CellStorage cell)
public void prepare(Worksheet currentWorksheet, int currentColumn, int currentRow)
public boolean tryGetCell(CellRef cellRef, com.mindfusion.common.ByRef<CellStorage> cell)
public boolean tryGetCell(java.lang.String sheetRef,
int c,
int r,
com.mindfusion.common.ByRef<CellStorage> cell)
public java.lang.Object getCellValuesAsMatrix(CellRef cellRef)
public java.lang.Object getCellValue(CellRef cellRef)
public java.lang.Object getCellValue(java.lang.String sheetRef,
int c,
int r)
public java.lang.Object getCellsValue(CellRef cellRef)
public void addDynamicDependency(CellRef cellRef)
public void enterInvariant()
public void leaveInvariant()
public java.lang.Object evaluateIdentifier(IExpressionEvaluatorContext context, java.lang.String identifier)
First, attempts to evaluate the identifier through the core evaluator. If unsuccessful, delegates the evaluation to the extended evaluator, if any.
evaluateIdentifier in interface IExpressionEvaluatorcontext - A helper object that can be used to obtain error values, invoke predefined functions, and so on.identifier - The name of the identifier.IExpressionEvaluatorContext.getError(com.mindfusion.spreadsheet.expressions.ErrorType, java.lang.String) method. Any other value
will be interpreted as the identifier not being evaluated.public java.lang.Object invokeFunction(IExpressionEvaluatorContext context, java.lang.String name, java.util.List<?> parameters)
To interpret a parameter as a CLR value, pass the parameter to one of
the following methods of the supplied IExpressionEvaluatorContext object:
toDouble,
toString,
toBool,
toDateTime, or
toTimeSpan. The context will attempt
to convert the parameter to the desired type and returns null if unsuccessful.
To check if a parameter is an error, call the ISERROR function of the core
evaluator.
First, attempts to invoke the function through the core evaluator. If unsuccessful, delegates the invocation to the extended evaluator, if any.
invokeFunction in interface IExpressionEvaluatorcontext - A helper object that can be used to obtain error values, invoke predefined functions, and so on.name - The name of the function.parameters - The function parameters.IExpressionEvaluatorContext.getError(com.mindfusion.spreadsheet.expressions.ErrorType, java.lang.String) method. Any other value
will be interpreted as the function not being invoked.public IExpressionEvaluator getCoreEvaluator()
IExpressionEvaluatorContextgetCoreEvaluator in interface IExpressionEvaluatorContextIExpressionEvaluator object identifying the core evaluator.public java.lang.Object getError(ErrorType errorType, java.lang.String message)
IExpressionEvaluatorContextThis method can be used when a custom function needs to return an error.
getError in interface IExpressionEvaluatorContexterrorType - One of the ErrorType constants identifying the type of the error.message - The message associated with the error.public java.lang.Object evaluate(java.lang.Object value)
public java.lang.Object evaluateScalar(java.lang.Object value)
public java.lang.Object evaluateToScalar(java.lang.Object value)
public java.lang.Object evaluateToScalarValue(java.lang.Object value)
public java.lang.Object evaluateMatrix(java.lang.Object value)
public java.lang.Object evaluateToMatrix(java.lang.Object value)
public java.lang.Object evaluateToMatrixValue(java.lang.Object value)
public java.lang.Object[] evaluateToArray(java.lang.Object value)
public com.mindfusion.spreadsheet.expressions.Criterion evaluateToCriterion(java.lang.Object value)
public java.lang.Object evaluateToType(java.lang.Object value,
java.lang.Class<?> type)
public java.lang.Object toValue(java.lang.Object value)
IExpressionEvaluatorContexttoValue in interface IExpressionEvaluatorContextvalue - The object to evaluate.public java.lang.Double toDouble(java.lang.Object value)
IExpressionEvaluatorContextThis method is usually used when trying to interpret a parameter passed to a custom function.
toDouble in interface IExpressionEvaluatorContextvalue - The value to convert.public java.lang.String toString(java.lang.Object value)
IExpressionEvaluatorContextThis method is usually used when trying to interpret a parameter passed to a custom function.
toString in interface IExpressionEvaluatorContextvalue - The value to convert.public java.lang.Boolean toBool(java.lang.Object value)
IExpressionEvaluatorContextThis method is usually used when trying to interpret a parameter passed to a custom function.
toBool in interface IExpressionEvaluatorContextvalue - The value to convert.public com.mindfusion.common.DateTime toDateTime(java.lang.Object value)
IExpressionEvaluatorContextDateTime.
This method is usually used when trying to interpret a parameter passed to a custom function.
toDateTime in interface IExpressionEvaluatorContextvalue - The value to convert.DateTime value corresponding to the specified value, or null,
if value cannot be represented as DateTime.public com.mindfusion.common.Duration toTimeSpan(java.lang.Object value)
IExpressionEvaluatorContextThis method is usually used when trying to interpret a parameter passed to a custom function.
toTimeSpan in interface IExpressionEvaluatorContextvalue - The value to convert.TimeSpan value corresponding to the specified value, or null,
if value cannot be represented as TimeSpan.public Workbook getWorkbook()
IExpressionEvaluatorContextgetWorkbook in interface IExpressionEvaluatorContextpublic Worksheet getCurrentWorksheet()
IExpressionEvaluatorContextgetCurrentWorksheet in interface IExpressionEvaluatorContextpublic int getCurrentColumn()
IExpressionEvaluatorContextgetCurrentColumn in interface IExpressionEvaluatorContextpublic int getCurrentRow()
IExpressionEvaluatorContextgetCurrentRow in interface IExpressionEvaluatorContextpublic java.lang.Object getOldValue()
IExpressionEvaluatorContextgetOldValue in interface IExpressionEvaluatorContextpublic java.util.Locale getLocale()
IExpressionEvaluatorContextgetLocale in interface IExpressionEvaluatorContextpublic java.lang.Iterable<CellRef> getDynamicDependencies()
public int getFinance_MaxIterations()
public double getFinance_Precision()