Class ReactionContext

  • All Implemented Interfaces:
    ChemContext, chemaxon.marvin.util.CallbackIface, Serializable

    @PublicAPI
    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. Provides function names for accessing context elements through the CallbackIface.
    Since:
    JChem 2.2, Marvin 5.1
    See Also:
    Serialized Form
    • Constructor Detail

      • 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 Detail

      • getContextFunctionNames

        public String[] getContextFunctionNames()
        Returns {"reactant", "product", "ratom", "patom"}.
        Specified by:
        getContextFunctionNames in interface ChemContext
        Returns:
        {"reactant", "product", "ratom", "patom"}
      • callback

        public Object callback​(String method,
                               Object arg)
        Implements CallbackIface. Returns null for unimplemented callbacks. Implemented callbacks:
        methodargreturn 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:
        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
      • 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
      • 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