Class ReactionContext

java.lang.Object
chemaxon.jep.context.ReactionContext
All Implemented Interfaces:
ChemContext, chemaxon.marvin.util.CallbackIface, Serializable

@PublicAPI @ProvidesFunction(minParameterCount=1, maxParameterCount=1, names={"reactant","product","agent","ratom","patom","aatom"}) public class ReactionContext extends Object implements ChemContext
Expression evaluation context to evaluate reaction conditions. Contains reaction context elements: reactants, products, map-to-atom correspondences for both sides.
Since:
JChem 2.2, Marvin 5.1
See Also:
  • Field Details

  • Constructor Details

    • ReactionContext

      public ReactionContext()
      Constructor.
    • ReactionContext

      public ReactionContext(RxnMolecule reaction)
      Constructs a reaction context with specified reaction.
      Parameters:
      reaction - the reaction to wrap
      Since:
      6.2
    • ReactionContext

      @Deprecated public ReactionContext(boolean copy)
      Deprecated.
      Copy feature is no longer required. Constructor.
      Parameters:
      copy - is true if map arrays should be copied
  • 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 {"reactant", "product", "ratom", "patom"}.
      Specified by:
      getContextFunctionNames in interface ChemContext
      Returns:
      {"reactant", "product", "ratom", "patom"}
    • callContextFunction

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

      Implemented functions:

      nameparameterreturn value
      "reactant"reactant index (Integer, 0-based)the reactant
      "product"product index (Integer, 0-based)the product
      "ratom"atom map (Integer)the reactant atom
      "patom"atom map (Integer)the product atom
      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
    • setReaction

      public void setReaction(RxnMolecule reaction)
      Sets the reaction.
      Parameters:
      reaction - the reaction to set
      Since:
      6.2
    • getReaction

      public RxnMolecule getReaction()
      Returns the reaction.
      Returns:
      the reaction
      Since:
      6.2
    • setReactants

      @Deprecated public void setReactants(Molecule[] reactants)
      Deprecated.
      Use setReaction(RxnMolecule) instead. Sets the reactants.
      Parameters:
      reactants - is the reactant array
    • setProducts

      @Deprecated public void setProducts(Molecule[] products)
      Deprecated.
      Use setReaction(RxnMolecule) instead. Sets the products.
      Parameters:
      products - is the product array
    • setReactantAtomsByMap

      @Deprecated public void setReactantAtomsByMap(MolAtom[] ma)
      Deprecated.
      use setReaction(RxnMolecule) instead. Sets the map -> reactant atom array.
      Parameters:
      ma - is the map -> reactant atom array
    • setProductAtomsByMap

      @Deprecated public void setProductAtomsByMap(MolAtom[] ma)
      Deprecated.
      use setReaction(RxnMolecule) instead. Sets the map -> product atom array.
      Parameters:
      ma - is the map -> product atom array
    • isEmpty

      public boolean isEmpty()
      Returns true if the context is empty.
      Returns:
      true if the context is empty
    • clear

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