Class SearchHit

java.lang.Object
chemaxon.sss.search.SearchHit

@PublicApi public class SearchHit extends Object
Search hit object. It provides two different views: single hit and group hit.
Since:
JChem 5.4
  • Constructor Summary

    Constructors
    Constructor
    Description
    SearchHit(int[] singleHit)
    Constructor: creates a hit object from a single (1 dimensional) hit mapping array.
    SearchHit(int[][] groupHit)
    Constructor: creates a hit object from a group (2 dimensional) hit mapping array.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int[][]
    Returns the group hit view of the hit object.
    int[]
    Returns the single hit view of the hit object.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SearchHit

      public SearchHit(int[] singleHit)
      Constructor: creates a hit object from a single (1 dimensional) hit mapping array.
      Parameters:
      singleHit - the 1D hit mapping array
    • SearchHit

      public SearchHit(int[][] groupHit)
      Constructor: creates a hit object from a group (2 dimensional) hit mapping array.

      Warning: The given array is not copied for efficiency reasons. Do not modify it after passing to this constructor.

      Parameters:
      groupHit - the 2D hit mapping array
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getSingleHit

      public int[] getSingleHit()
      Returns the single hit view of the hit object.

      The single hit is a simple array of int values so that the i-th element is the index of the target atom that is matched to the i-th query atom. In case of an R-group query, this array corresponds to the root of the query.

      Special matching atom indexes:

      The hit array may contain special codes that are not valid indexes of the target structure. These special values are defined as follows.
      • In case of explicit query H atoms matching to implicit H atoms in the target, a negative number is returned. The absolute value of this number equals with the atom index of the heavy atom bearing the implicit hydrogen, or Integer.MIN_VALUE in case of 0 heavy atom index.
      • The same method is used for explicit LP (lone pair) atoms in the query. The hit contains the negated number of the target heavy atom with the matching lone pair, or Integer.MIN_VALUE for 0 index. SearchConstants.HIT_LP is set for isolated lone pairs (in which case there is no such target heavy atom).
      • Multicenter atoms (e.g. of multicenter coordinate bonds) are not returned, the match array always contains SearchConstants.HIT_MULTICENTER for these atoms.
      • In the case of defined or undefined R-atom matching on a group of atoms: only one representative matched atom is set in the match array, or SearchConstants.HIT_R_EMPTY_MATCH denoting the match to an empty group.
      • Unmapable atoms (e.g. polymer star atoms) are denoted by SearchConstants.HIT_UNMAPABLE in the match array.
      • Excluded query atoms receive the special SearchConstants.HIT_EXCLUDEDQ value.
      • All Superatom S-groups are treated as expanded during the search, so atom indices are returned accordingly.
      Returns:
      the single hit view of the hit object
      See Also:
    • getGroupHit

      public int[][] getGroupHit()
      Returns the group hit view of the hit object.

      The group hit is an array of int arrays so that the i-th array contains the indexes of all target atoms that is matched to the i-th query atom. In contrast with the single hit, group hits allow multiple target atoms matching a single query atom. This can be the case if the query contains R-atoms or homology groups, because they may match several atoms in the target at once. In case of undefined R-atoms, empty match is denoted by an empty array (see SearchConstants.UNDEF_R_MATCHING_GROUP_H_EMPTY).

      In group hits, the same special matching atom indexes are used as in single hits. See getSingleHit() for their description.

      Warning: For efficiency reasons, this method directly returns the internal array representation. Make a deep copy of the result if you would like to modify it.

      Returns:
      the group hit view of the hit object
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object