Class SearchContext

java.lang.Object
chemaxon.chemterms.MolContext
chemaxon.chemterms.SearchContext
All Implemented Interfaces:
ChemTermsContext

@PublicApi @ProvidesFunction(minParameterCount=0,maxParameterCount=0,names={"mol","target","query"}) @ProvidesFunction(minParameterCount=0,maxParameterCount=1,names={"hit","h"}) @ProvidesFunction(minParameterCount=1,maxParameterCount=1,names={"fingerprint","tfingerprint","qfingerprint","m","hitmap","hm"}) public class SearchContext extends MolContext
Expression evaluation context containing search hit data: the target, the query and the hit.
Since:
JChem 2.3, Marvin 5.1
  • Field Details

  • Constructor Details

    • SearchContext

      public SearchContext()
      Constructor.
  • 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
      "mol"the target molecule
      "target"the target molecule
      "query"the query molecule
      "fingerprint"Moleculethe target molecule fingerprint
      "tfingerprint"Moleculethe target molecule fingerprint
      "qfingerprint"Moleculethe query molecule fingerprint
      "m"intthe index of query atom with given map
      "hit"
      "h"
      the search hit (target atom indices)
      "hit"
      "h"
      intthe target atom index corresponding to the specified query atom
      "hm"
      "hitmap"
      intthe target atom index corresponding to the query atom with the specified map
      Specified by:
      callContextFunction in interface ChemTermsContext
      Overrides:
      callContextFunction in class MolContext
      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
    • setTarget

      public void setTarget(Molecule target)
      Sets the target molecule.
      Parameters:
      target - is the target molecule
    • getTarget

      public Molecule getTarget()
      Returns the target molecule.
      Returns:
      the target molecule
    • setQuery

      public void setQuery(Molecule query)
      Sets the query molecule and the map array.
      Parameters:
      query - is the query molecule
    • getQuery

      public Molecule getQuery()
      Returns the query molecule.
      Returns:
      the query molecule
    • setTargetFingerprint

      public void setTargetFingerprint(int[] fingerprint)
      Sets the fingerprint of the target molecule.
      Parameters:
      fingerprint - is the fingerprint
    • getTargetFingerprint

      public int[] getTargetFingerprint()
      Returns the target molecule fingerprint.
      Returns:
      the target molecule fingerprint
    • setQueryFingerprint

      public void setQueryFingerprint(int[] fingerprint)
      Sets the fingerprint of the query molecule.
      Parameters:
      fingerprint - is the fingerprint
    • getQueryFingerprint

      public int[] getQueryFingerprint()
      Returns the query molecule fingerprint.
      Returns:
      the query molecule fingerprint
    • getQueryFingerprint

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

      public void setHit(int[] hit)
      Sets the search hit, as a query atom index -> target atom index array, with negative target atom index denoting match on implicit H.
      Parameters:
      hit - is the search hit
    • clear

      public void clear()
      Clears the context.
      Specified by:
      clear in interface ChemTermsContext
      Overrides:
      clear in class MolContext