Package chemaxon.jep
Interface CustomFunction
Base interface for custom Chemical Terms functions.
To call a custom function, add it to the configuration XML passed to the constructors of
Evaluator
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Double
Possible result with the value of 0.0.static final Double
Possible result with the value ofDouble.NaN
.static final Double
Possible result with the value of 1.0.static final Object
Special result value which will propagate through the call chain of Chemical Terms functions and will be returned by the methods ofChemJEP
.static final int
The multiplicity that marks a function vararg. -
Method Summary
Modifier and TypeMethodDescriptionEvaluates this function.int
Returns the maximum parameter count of this function (a non-negative integer), orVARARG
if there is no maximum.int
Returns the minimum parameter count of this function (a non-negative integer).
-
Field Details
-
TRUE
Possible result with the value of 1.0. Represents the logical value "true" in a Chemical Terms evaluation. -
FALSE
Possible result with the value of 0.0. Represents the logical value "false" in a Chemical Terms evaluation. -
NAN
Possible result with the value ofDouble.NaN
. -
UNDECIDED
Special result value which will propagate through the call chain of Chemical Terms functions and will be returned by the methods ofChemJEP
. Converted toChemJEP.UNDECIDED
byChemJEP.getLogicalValue(Object)
. -
VARARG
static final int VARARGThe multiplicity that marks a function vararg.- See Also:
-
-
Method Details
-
minParameterCount
int minParameterCount()Returns the minimum parameter count of this function (a non-negative integer). This method should always return the same value for instances of the same class. -
maxParameterCount
int maxParameterCount()Returns the maximum parameter count of this function (a non-negative integer), orVARARG
if there is no maximum. This method should always return the same value if called on the same object. -
evaluate
Object evaluate(Map<String, String> properties, List<Object> parameters, ChemContext context) throws JepExceptionEvaluates this function.- Parameters:
properties
- The properties defined in the configuration XML for this function. Never null.parameters
- The actual parameters of this function. Never null, but may contain nulls.context
- The chemical context this function is evaluated in. If no context was given for the current evaluation, a dummy object is passed that does not support any functions or variables (its methods always return null), so this parameter is never null.- Returns:
- the result of the function evaluation
- Throws:
JepException
- on error
-