Package chemaxon.jep

Interface CustomFunction


@PublicApi public 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

    Fields
    Modifier and Type
    Field
    Description
    static final Double
    Possible result with the value of 0.0.
    static final Double
    Possible result with the value of Double.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 of ChemJEP.
    static final int
    The multiplicity that marks a function vararg.
  • Method Summary

    Modifier and Type
    Method
    Description
    evaluate(Map<String,String> properties, List<Object> parameters, ChemContext context)
    Evaluates this function.
    int
    Returns the maximum parameter count of this function (a non-negative integer), or VARARG if there is no maximum.
    int
    Returns the minimum parameter count of this function (a non-negative integer).
  • Field Details

    • TRUE

      static final Double TRUE
      Possible result with the value of 1.0. Represents the logical value "true" in a Chemical Terms evaluation.
    • FALSE

      static final Double FALSE
      Possible result with the value of 0.0. Represents the logical value "false" in a Chemical Terms evaluation.
    • NAN

      static final Double NAN
      Possible result with the value of Double.NaN.
    • UNDECIDED

      static final Object UNDECIDED
      Special result value which will propagate through the call chain of Chemical Terms functions and will be returned by the methods of ChemJEP. Converted to ChemJEP.UNDECIDED by ChemJEP.getLogicalValue(Object).
    • VARARG

      static final int VARARG
      The 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), or VARARG 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 JepException
      Evaluates 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