Class MolContext

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

@PublicAPI public class MolContext extends Object implements ChemContext
Expression evaluation context containing a single molecule. Provides function names for accessing context elements through the CallbackIface.
Since:
JChem 2.2, Marvin 5.1
See Also:
  • 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

      public String[] getContextFunctionNames()
      Returns {"mol", "fingerprint"}. This is the accessor function name for getting the molecule.
      Specified by:
      getContextFunctionNames in interface ChemContext
      Returns:
      {"mol", "fingerprint"}
    • callback

      public Object callback(String method, Object arg)
      Implements CallbackIface. Returns null for unimplemented callbacks. Implemented callbacks:
      methodargreturn value
      "mol"nullthe input molecule
      "fingerprint"nullthe input molecule fingerprint
      Specified by:
      callback in interface chemaxon.marvin.util.CallbackIface
      Specified by:
      callback in interface ChemContext
      Parameters:
      method - is the accessor method name
      arg - is the accessor method argument (the JEP parameter stack as null, a single parameter object or a parameter object array depending on the number of parameters on the stack)
      Returns:
      the context element
    • setMolecule

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

      public void setSupplier(com.google.common.base.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