Package chemaxon.chemterms
Interface ChemTermsContext
- All Known Implementing Classes:
AtomContext,MolContext,ReactionContext,SearchContext
Interface of expression evaluation contexts.
Provides
context functions
and evaluation time constants for the evaluator engine.
Context functions have to be declared using the ChemTermsContext.ProvidesFunction annotation.- Since:
- JChem 2.2, Marvin 5.1
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic @interfaceRepeatable annotation used onChemTermsContextimplementations to declare the context functions supported by thecallContextFunction(String, List)method.static @interfaceContainer for the repeatableChemTermsContext.ProvidesFunctionannotation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA possible value forChemTermsContext.ProvidesFunction.maxParameterCount(), signaling that there is no maximum. -
Method Summary
Modifier and TypeMethodDescriptiondefault ObjectcallContextFunction(String name, List<Object> params) Executes the specified context function with the given parameters.voidclear()Clears the context.default ObjectgetVariable(String name) Returns the value of a variable.
-
Field Details
-
VARARG
static final int VARARGA possible value forChemTermsContext.ProvidesFunction.maxParameterCount(), signaling that there is no maximum.- See Also:
-
-
Method Details
-
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
-
callContextFunction
Executes the specified context function with the given parameters. Implementations override this method to implement the specific context element accessors as specified byChemTermsContext.ProvidesFunctionannotations on the implementation.- Parameters:
name- the context function name (as specified byChemTermsContext.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:
ChemTermsException- on error
-
clear
void clear()Clears the context.
-