Package chemaxon.jep
Interface ChemContext
- All Superinterfaces:
chemaxon.marvin.util.CallbackIface,Serializable
- All Known Implementing Classes:
AtomContext,MolContext,ReactionContext
Interface of expression evaluation contexts.
Provides
context functions
and evaluation time constants for the evaluator engine.
Context functions have to be declared using the ChemContext.ProvidesFunction annotation.- Since:
- JChem 2.2, Marvin 5.1
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic @interfaceRepeatable annotation used onChemContextimplementations to declare the context functions supported by thecallContextFunction(String, List)method.static @interfaceContainer for the repeatableChemContext.ProvidesFunctionannotation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA possible value forChemContext.ProvidesFunction.maxParameterCount(), signaling that there is no maximum. -
Method Summary
Modifier and TypeMethodDescriptiondefault ObjectDeprecated, for removal: This API element is subject to removal in a future version.default ObjectcallContextFunction(String name, List<Object> params) Executes the specified context function with the given parameters.voidclear()Clears the context.default String[]Deprecated, for removal: This API element is subject to removal in a future version.This method is the legacy option for specifying the supported context functions.default ObjectgetVariable(String name) Returns the value of a variable.
-
Field Details
-
VARARG
static final int VARARGA possible value forChemContext.ProvidesFunction.maxParameterCount(), signaling that there is no maximum.- See Also:
-
-
Method Details
-
getContextFunctionNames
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) default String[] getContextFunctionNames()Deprecated, for removal: This API element is subject to removal in a future version.This method is the legacy option for specifying the supported context functions. Use theChemContext.ProvidesFunctionannotation instead.Returns context element accessor function names. Implementations override this method to add specific context elements accessors.- Returns:
- the context element accessor function names
-
getVariable
Returns the value of a variable.In a Chemical Terms expression, a symbol can be either:
- a constant, provided before compilation,
- a variable, provided by this method during the evaluation.
- Parameters:
name- the name of the variable- Returns:
- the value of the variable, or null if this context does not define the given variable
-
callback
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) default Object callback(String method, Object arg) Deprecated, for removal: This API element is subject to removal in a future version.UsecallContextFunction(String, List)instead.ImplementsCallbackIface. Implementations override this method to implement the specific context elements accessors returned bygetContextFunctionNames().- Specified by:
callbackin interfacechemaxon.marvin.util.CallbackIface- Parameters:
method- is the accessor method name (returned bygetContextFunctionNames())arg- is the accessor method argument (the JEP parameter stack asnull, a single parameter object or a parameter object array depending on the number of parameters on the stack)- Returns:
- the context element
-
callContextFunction
Executes the specified context function with the given parameters. Implementations override this method to implement the specific context element accessors as specified byChemContext.ProvidesFunctionannotations on the implementation.- Parameters:
name- the context function name (as specified byChemContext.ProvidesFunction.names())params- the context function parameters. The size of this list must be between theminimumandmaximumallowed.- Returns:
- the context element, or null if the given function is not supported
- Throws:
JepException- on error
-
clear
void clear()Clears the context.
-
callContextFunction(String, List)instead.