Package chemaxon.reaction
Class AtomIdentifier
- java.lang.Object
-
- chemaxon.reaction.AtomIdentifier
-
- All Implemented Interfaces:
Comparable<AtomIdentifier>
@PublicAPI public class AtomIdentifier extends Object implements Comparable<AtomIdentifier>
The identifier of an atom in the input of the reaction.
The input atom is contained by an array of molecules (reactants, or products in case of reverse mode) that are the input molecules of the reaction. In this array theAtomIdentifier
defines an atom by the:- Index of the molecule, can be acquired by
getMoleculeIndex()
. The value must be non-negative for non-orphan atoms. - Index of the atom in the molecule, can be acquired by
getAtomIndex()
. The value must be non-negative for non-orphan atoms, but can be negative for implicit hydrogens that are explicitized during the reaction. This can be checked using the methodisExplicitizedHydrogen()
. In this case the value of the index is the negative value of the index of the atom that is attached to this hydrogen. If the index of the attached atom is 0, the atom index of the identifier isInteger.MIN_VALUE
MolAtom
representation of the atom can be acquired using the methodgetAtom(Molecule[])
providing the output molecule array of the reaction.
The identifier may represent atom, that does not exist on the input side of the reaction (e.g.: atoms added while processing the reaction). This can be checked using the methodisOrphanAtom()
. If this is true, theAtomIdentifier
exists only to provide the mapping for the reaction schema, and the result ofgetAtom(Molecule[])
will always be null.
On the other hand the identifier may represent atom that does not exist on the output side of the reaction. (e.g.: atoms removed while processing the reaction). This can be checked using the methodisVirginAtom(Molecule[])
. In this case the output molecule array of the reaction must be provided.
TheAtomIdentifier
can store the mapping of the atom for the reaction schema. This can be acquired by using the methodgetReactionSchemaMap()
.
NOTE: The value of the reaction schema map is valid only for positive values.
NOTE: If a reaction schema contains explicit H, and matches an implicit H on the input, the H atom will be added to the input molecule, however as the H atom is added during the reaction, it will be still counted as an orphan atom.- Since:
- 5.11
-
-
Constructor Summary
Constructors Constructor Description AtomIdentifier(int moleculeIndex, int atomIndex)
Initializes an atom identifier based on the input molecules of the reaction.AtomIdentifier(int moleculeIndex, int atomIndex, int reactionSchemaMap)
Initializes an atom identifier based on the input molecules of the reaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(AtomIdentifier other)
boolean
equals(Object obj)
MolAtom
getAtom(Molecule[] outputMolecules)
Gets theMolAtom
representation of the identified atom based on the provided output molecules of the reactionint
getAtomIndex()
Gets the index of the atom in the moleculeint
getMoleculeIndex()
Gets the index of the molecule - in the input molecules of the reaction - containing the atomint
getReactionSchemaMap()
Gets the mapping of the target atom in the reaction schemaint
hashCode()
boolean
isExplicitizedHydrogen()
Gets whether the identifier represents an explicit H atom, that was implicit H atom in the input molecule, and was explicitized during the reaction, because it matched an explicit H atom in the reaction schema.boolean
isOrphanAtom()
Gets whether the identifier represents an orphan atom.boolean
isVirginAtom(Molecule[] outputMolecules)
Gets whether the identifier represents a virgin atom.void
setReactionSchemaMap(int mapIndex)
Sets the map of the identified atom (the mapping in the reaction schema)String
toString()
-
-
-
Constructor Detail
-
AtomIdentifier
public AtomIdentifier(int moleculeIndex, int atomIndex)
Initializes an atom identifier based on the input molecules of the reaction.- Parameters:
moleculeIndex
- the index of the molecule containing the atom in the input molecules of the reaction. The value must be non-negative for non-orphan atoms.atomIndex
- the index of the atom in the molecule. The value must be non-negative for non-orphan atoms, but can be negative for implicit hydrogens that are explicitized during the reaction. In this case The value of the index must be the negative index atom that is attached to this hydrogen. If the index of the attached atom is 0, the atom index of the identifier must beInteger.MIN_VALUE
-
AtomIdentifier
public AtomIdentifier(int moleculeIndex, int atomIndex, int reactionSchemaMap)
Initializes an atom identifier based on the input molecules of the reaction.- Parameters:
moleculeIndex
- the index of the molecule containing the atom in the input molecules of the reaction. The value must be non-negative for non-orphan atoms.atomIndex
- the index of the atom in the molecule. The value must be non-negative for non-orphan atoms, but can be negative for implicit hydrogens that are explicitized during the reaction. In this case The value of the index must be the negative index atom that is attached to this hydrogen. If the index of the attached atom is 0, the atom index of the identifier must beInteger.MIN_VALUE
reactionSchemaMap
- the mapping in the reaction schema
-
-
Method Detail
-
setReactionSchemaMap
public void setReactionSchemaMap(int mapIndex)
Sets the map of the identified atom (the mapping in the reaction schema)- Parameters:
mapIndex
- the mapping in the reaction schema
-
getMoleculeIndex
public int getMoleculeIndex()
Gets the index of the molecule - in the input molecules of the reaction - containing the atom- Returns:
- the index of the molecule - in the input molecules of the reaction - containing the atom
-
getAtomIndex
public int getAtomIndex()
Gets the index of the atom in the molecule- Returns:
- the index of the atom in the molecule
-
getReactionSchemaMap
public int getReactionSchemaMap()
Gets the mapping of the target atom in the reaction schema- Returns:
- the mapping the target atom in the reaction schema
-
getAtom
public MolAtom getAtom(Molecule[] outputMolecules)
Gets theMolAtom
representation of the identified atom based on the provided output molecules of the reaction- Parameters:
outputMolecules
- the output molecules of the reaction- Returns:
- the
MolAtom
representation of the target
-
compareTo
public int compareTo(AtomIdentifier other)
- Specified by:
compareTo
in interfaceComparable<AtomIdentifier>
-
isOrphanAtom
public boolean isOrphanAtom()
Gets whether the identifier represents an orphan atom. (Atom that exists only on the output side of the reaction)- Returns:
- whether the identifier represents an orphan atom. (Atom that exists only on the output side of the reaction)
-
isVirginAtom
public boolean isVirginAtom(Molecule[] outputMolecules)
Gets whether the identifier represents a virgin atom. (Atom that exists only on the input side of the reaction)- Parameters:
outputMolecules
- the output molecules of the reaction- Returns:
- whether the identifier represents a virgin atom. (Atom that exists only on the input side of the reaction)
-
isExplicitizedHydrogen
public boolean isExplicitizedHydrogen()
Gets whether the identifier represents an explicit H atom, that was implicit H atom in the input molecule, and was explicitized during the reaction, because it matched an explicit H atom in the reaction schema.- Returns:
- whether the identifier represents an explicitized H atom
-
-