@PublicAPI public class MolComparator extends java.lang.Object
compareAtoms(int, int)
, compareBonds(int, int)
,
compareHit(int[], int)
.
The comparison methods in this class are empty convenience methods that
always return true. The init and unInit methods should call super method
if overridden.
Utility methods to get original query and target atom molecular indexes are:
getOrigQueryAtom(int)
, getOrigTargetAtom(int)
,
getOrigQueryNeighbour(int)
, getOrigTargetNeighbour(int)
.
By using MolComparators one can introduce extra matching conditions. Working examples can be found here.
Modifier and Type | Field and Description |
---|---|
static int |
MAYBE_USEFUL
Describes that the MolComparator may be needed with the current search
object and the current query, depending on the target.
|
static int |
NOT_USEFUL
Describes that the MolComparator is not needed with the current search
object, the current query (and target).
|
protected Molecule |
query |
protected chemaxon.sss.search.model.ReadOnlySearchData |
querySearchData |
protected MolSearchOptions |
searchOptions |
protected Molecule |
target |
protected chemaxon.sss.search.model.ReadOnlySearchData |
targetSearchData |
static int |
USEFUL
Describes that the MolComparator should be used with the current search
object and the current query, regardless of the target.
|
Constructor and Description |
---|
MolComparator() |
Modifier and Type | Method and Description |
---|---|
boolean |
compareAtoms(int a1,
int a2)
Compares atoms of indices a1 and a2.
|
boolean |
compareBonds(int b1,
int b2)
Compares bonds of indices b1 and b2.
|
boolean |
compareHit(int[] internalHit,
int internalHitLength)
Checks a partial hit during the search algorithm.
|
int |
getOrigQueryAtom(int a1)
Converts search internal atom index (in the query) to the original
atom index in the query molecule.
|
int |
getOrigQueryAtom1(int bi)
Returns the index of the first atom (atom index in the query molecule)
of the given query bond(search internal bond index in the query).
|
int |
getOrigQueryAtom2(int bi)
Returns the index of the second atom (atom index in the query molecule)
of the given query bond(search internal bond index in the query).
|
int |
getOrigQueryBond(int bi)
Returns bond index in the query molecule
for the given query bond (search internal bond index in the query).
|
int |
getOrigQueryNeighbour(int a)
For a search internal atom index (in the query), returns a neighbour
atom index (original atom index in the query molecule).
|
int |
getOrigTargetAtom(int a1)
Converts search internal atom index (in the target) to the original
atom index in the target molecule.
|
int |
getOrigTargetAtom1(int bi)
Returns the index of the first atom (atom index in the target molecule)
of the given target bond(search internal bond index in the target).
|
int |
getOrigTargetAtom2(int bi)
Returns the index of the second atom (atom index in the target molecule)
of the given target bond(search internal bond index in the target).
|
int |
getOrigTargetBond(int bi)
Returns bond index in the target molecule
for the given target bond (search internal bond index in the target).
|
int |
getOrigTargetNeighbour(int a)
For a search internal atom index (in the target), returns a neighbour
atom index (original atom index in the target molecule).
|
int |
isUsefulForQuery()
Decides based on the query and the search object if the comparator
should be used or not.
|
int |
isUsefulForTarget()
Decides based on the query, target and the search object if the
comparator should be used or not.
|
void |
setQuery(Molecule q)
Loads the query molecule into this comparator.
|
void |
setQuerySearchData(chemaxon.sss.search.model.ReadOnlySearchData querySearchData) |
void |
setSearchOptions(MolSearchOptions searchOptions) |
void |
setTarget(Molecule t)
Loads the target molecule into this comparator.
|
void |
setTargetSearchData(chemaxon.sss.search.model.ReadOnlySearchData targetSearchData) |
protected Molecule query
protected Molecule target
protected chemaxon.sss.search.model.ReadOnlySearchData targetSearchData
protected chemaxon.sss.search.model.ReadOnlySearchData querySearchData
protected MolSearchOptions searchOptions
public static final int USEFUL
isUsefulForQuery()
,
Constant Field Valuespublic static final int MAYBE_USEFUL
isUsefulForQuery()
,
Constant Field Valuespublic static final int NOT_USEFUL
isUsefulForQuery()
,
Constant Field Valuespublic void setQuery(Molecule q)
q
- the query that will be used from now onpublic void setTarget(Molecule t)
t
- the query that will be used from now onpublic void setTargetSearchData(chemaxon.sss.search.model.ReadOnlySearchData targetSearchData)
public void setQuerySearchData(chemaxon.sss.search.model.ReadOnlySearchData querySearchData)
public void setSearchOptions(MolSearchOptions searchOptions)
public boolean compareAtoms(int a1, int a2)
a1
- atom in query (search internal index)a2
- atom in target (search internal index)getOrigQueryAtom(int)
,
getOrigTargetAtom(int)
public boolean compareBonds(int b1, int b2)
b1
- bond index in queryb2
- bond index in targetpublic int getOrigTargetAtom(int a1)
a1
- internal target atom indexgetOrigTargetNeighbour(int)
may be helpful.)public int getOrigQueryAtom(int a1)
a1
- internal query atom indexgetOrigQueryNeighbour(int)
may be helpful.)public int getOrigTargetNeighbour(int a)
a
- internal target atom indexgetOrigTargetAtom(int)
public int getOrigQueryNeighbour(int a)
a
- internal query atom indexgetOrigTargetAtom(int)
public boolean compareHit(int[] internalHit, int internalHitLength)
internalHit
- the current hit vector from the associated search
object that contains atom indices of internal search representation.
Strictly read only! The values of this array are incremented by 1
because of algorithmic reasons.
This vector may contain only a partial match, so possibly not all query
atoms have associated matchings.
getOrigQueryAtom(int)
(from array indexes) and
getOrigTargetAtom(int)
(from array values - do not forget to
call a decreased value: getOrigTargetAtom(internalHit[i]-1) ).
internalHitLength
- the effective length of internalHit.getOrigQueryAtom(int)
,
getOrigTargetAtom(int)
public int isUsefulForQuery()
USEFUL
,
MAYBE_USEFUL
,
NOT_USEFUL
,
isUsefulForTarget()
public int isUsefulForTarget()
USEFUL
,
MAYBE_USEFUL
,
NOT_USEFUL
,
isUsefulForQuery()
public int getOrigQueryAtom1(int bi)
bi
- internal query bond indexpublic int getOrigQueryAtom2(int bi)
bi
- internal query bond indexpublic int getOrigTargetAtom1(int bi)
bi
- internal target bond indexpublic int getOrigTargetAtom2(int bi)
bi
- internal target bond indexpublic int getOrigQueryBond(int bi)
bi
- internal query bond indexpublic int getOrigTargetBond(int bi)
bi
- internal target bond index