Class ReactionContext

java.lang.Object
chemaxon.chemterms.ReactionContext
All Implemented Interfaces:
ChemTermsContext

@PublicApi @ProvidesFunction(minParameterCount=1, maxParameterCount=1, names={"reactant","product","agent","ratom","patom","aatom"}) public class ReactionContext extends Object implements ChemTermsContext
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
  • 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
  • Method Details

    • callContextFunction

      public Object callContextFunction(String name, List<Object> params) throws ChemTermsException
      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 ChemTermsContext
      Parameters:
      name - the context function name (as specified by ChemTermsContext.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:
      ChemTermsException - on error
    • setReaction

      public final 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 ChemTermsContext