Package chemaxon.chemterms
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
ChemTermsEvaluator.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DoublePossible result with the value of 0.0.static final DoublePossible result with the value ofDouble.NaN.static final DoublePossible result with the value of 1.0.static final ObjectSpecial result value which will propagate through the call chain of Chemical Terms functions and will be returned by the methods ofChemTermsExpression.static final intThe multiplicity that marks a function vararg. -
Method Summary
Modifier and TypeMethodDescriptionEvaluates this function.intReturns the maximum parameter count of this function (a non-negative integer), orVARARGif there is no maximum.intReturns 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 ofChemTermsExpression. Converted toChemTermsExpression.UNDECIDEDbyChemTermsExpression.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), orVARARGif 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, ChemTermsContext context) throws ChemTermsExceptionEvaluates 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:
ChemTermsException- on error
-