Class MolContext

java.lang.Object
chemaxon.jep.context.MolContext
All Implemented Interfaces:
ChemContext, chemaxon.marvin.util.CallbackIface, Serializable
Direct Known Subclasses:
AtomContext

@PublicApi @ProvidesFunction(minParameterCount=0,maxParameterCount=0,names="mol") @ProvidesFunction(minParameterCount=1,maxParameterCount=1,names={"fingerprint","reactant","product","agent","ratom","patom","aatom"}) public class MolContext extends Object implements ChemContext
Expression evaluation context containing a single molecule.
Since:
JChem 2.2, Marvin 5.1
See Also:
  • Field Details

  • Constructor Details

    • MolContext

      public MolContext()
      Constructor.
    • MolContext

      public MolContext(Molecule m)
      Creates a MolContext with the given input molecule.
      Since:
      Marvin 5.2
  • Method Details

    • getContextFunctionNames

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public String[] getContextFunctionNames()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the ChemContext.ProvidesFunction annotation instead.
      Returns {"mol", "fingerprint"}. This is the accessor function name for getting the molecule.
      Specified by:
      getContextFunctionNames in interface ChemContext
      Returns:
      {"mol", "fingerprint"}
    • callContextFunction

      public Object callContextFunction(String name, List<Object> params) throws JepException
      Executes the specified context function with the given parameters.

      Implemented functions:

      nameparameterreturn value
      "mol"the input molecule
      "fingerprint"the input molecule fingerprint
      Specified by:
      callContextFunction in interface ChemContext
      Parameters:
      name - the context function name (as specified by ChemContext.ProvidesFunction.names())
      params - the context function parameters. The size of this list must be between the minimum and maximum allowed.
      Returns:
      the context element, or null if the given function is not supported
      Throws:
      JepException - on error
    • setMolecule

      public void setMolecule(Molecule mol)
      Sets the input molecule.
      Parameters:
      mol - is the input molecule
    • setSupplier

      public void setSupplier(Supplier<Molecule> supplier)
    • getMolecule

      public Molecule getMolecule()
      Returns the input molecule.
      Returns:
      the input molecule
    • setFingerprint

      public void setFingerprint(int[] fingerprint)
      Sets the fingerprint of the input molecule.
      Parameters:
      fingerprint - is the fingerprint
    • getFingerprint

      public int[] getFingerprint()
      Returns the input molecule fingerprint.
      Returns:
      the input molecule fingerprint
    • getFingerprint

      protected int[] getFingerprint(Object arg)
      Returns the input molecule fingerprint if argument is the input molecule, null otherwise.
      Parameters:
      arg - is the argument to be checked against the input molecule
      Returns:
      the input molecule fingerprint or null
    • clear

      public void clear()
      Clears the context.
      Specified by:
      clear in interface ChemContext