Class SelectionMolecule

  • All Implemented Interfaces:
    chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>, chemaxon.core.structure.MoleculeForBuilder, chemaxon.core.structure.RootStructureForBuilder, chemaxon.core.structure.StructureForBuilder, Incomplecule, MTransformable, StereoConstants, Serializable

    @PublicAPI
    public class SelectionMolecule
    extends MoleculeGraph
    A selection object which can contain atoms and bonds without real parent relationship (the real parent of atoms and bonds is another MoleculeGraph ancestor).
    Since:
    Marvin 3.0
    See Also:
    Serialized Form
    • Constructor Detail

      • SelectionMolecule

        public SelectionMolecule()
    • Method Detail

      • isRealAtomParent

        protected boolean isRealAtomParent()
        Selection molecules are not real atom parents. However, in some special cases a selection molecule can be an atom parent.
        Overrides:
        isRealAtomParent in class MoleculeGraph
        Returns:
        false
        Since:
        Marvin 3.0
      • add

        public void add​(MolBond bond)
        Adds a bond to the graph. If the bond doesn't have parent molecule then the bond is also added to its end-points.
        Overrides:
        add in class MoleculeGraph
        Parameters:
        bond - the bond object
      • add

        public void add​(MolBond bond,
                        boolean checkParallel)
        Add a bond to the molecule. If the second parameter is true, there an exception thrown when there is already a bond between the given MolAtoms. There is no checking if either is SgroupAtom. If the molecule graph is a superGraph, the bond is also added to its endpoints (two MolAtom objects).
        Overrides:
        add in class MoleculeGraph
        Parameters:
        bond - the bond object
        checkParallel -
      • add

        public void add​(MolAtom atom)
        Adds an atom to the molecule. It doesn't add the bonds of the atom to the molecule.
        Overrides:
        add in class MoleculeGraph
        Parameters:
        atom - the atom object
      • add

        public void add​(MolAtom atom,
                        boolean addBonds)
        Adds an atom to the molecule. It the second parameter is true, then adds the bonds of the atom to the molecule, if the bond's other atom is already added.
        Parameters:
        atom -
        addBonds -
        Since:
        Marvin 6.1, 04/30/2013
      • addAtomWithBonds

        protected void addAtomWithBonds​(MolAtom atom)
        Adds an atom to the molecule. Adds the bonds of the atom to the molecule, if the bond's other atom is already added.
        Parameters:
        atom -
        Since:
        Marvin 6.1, 04/30/2013
      • swapAtoms

        public void swapAtoms​(int i,
                              int j)
        Swap two atoms.
        Parameters:
        i - index of the first atom
        j - index of the second atom
        Since:
        Marvin 3.3, 11/04/2003
      • removeAtom

        public void removeAtom​(MolAtom atom)
        Removes an atom and its bonds.
        Overrides:
        removeAtom in class MoleculeGraph
        Parameters:
        atom - the atom
      • removeAtom

        public void removeAtom​(int i)
        Removes an atom and its bonds from the graph.
        Overrides:
        removeAtom in class MoleculeGraph
        Parameters:
        i - the atom index
      • removeBond

        public void removeBond​(MolBond bond)
        Removes a bond by reference.
        Overrides:
        removeBond in class MoleculeGraph
        Parameters:
        bond - the bond
      • removeBond

        public void removeBond​(int i)
        Removes a bond from the graph.
        Overrides:
        removeBond in class MoleculeGraph
        Parameters:
        i - the bond index
      • addAtom0

        protected void addAtom0​(MolAtom atom)
        Adds an atom.
        Overrides:
        addAtom0 in class MoleculeGraph
        Parameters:
        atom - the atom reference
      • setAtom0

        protected void setAtom0​(int i,
                                MolAtom atom)
        Sets the atom at the specified index.
        Overrides:
        setAtom0 in class MoleculeGraph
        Parameters:
        i - atom index
        atom - new atom reference
      • addBond0

        protected void addBond0​(MolBond bond)
        Adds a bond.
        Overrides:
        addBond0 in class MoleculeGraph
        Parameters:
        bond - the bond reference
      • regenCtab

        protected void regenCtab()
        Regenerates the connection table.
        Overrides:
        regenCtab in class MoleculeGraph
        Since:
        Marvin 3.5.2, 12/16/2004
      • regenBtab

        protected void regenBtab()
        Regenerates the bond table.
        Overrides:
        regenBtab in class MoleculeGraph
        Since:
        Marvin 16.06.06.
      • fuse0

        protected void fuse0​(MoleculeGraph g,
                             boolean check)
        Adds those atoms and bonds of a graph to this one that are not already elements.
        Overrides:
        fuse0 in class MoleculeGraph
        Parameters:
        g - the graph
        check - true if a containment check should be performed to ensure that only those atoms and bonds are added that are not already elements - false if the graph is known to be disjoint from this graph and this check can be safely skipped
        Since:
        Marvin 5.0
      • clonecopy

        public void clonecopy​(MoleculeGraph graph)
        Copies the clones of atoms and bonds of this graph to another one.
        Overrides:
        clonecopy in class MoleculeGraph
        Parameters:
        graph - the target graph
      • clonecopyMoleculeGraphWithoutSgroups

        protected boolean clonecopyMoleculeGraphWithoutSgroups​(int[] iatoms,
                                                               MolBond[] cbonds,
                                                               int nb,
                                                               MoleculeGraph g)
        Copies the specified atoms and bonds of this graph to another one.
        Overrides:
        clonecopyMoleculeGraphWithoutSgroups in class MoleculeGraph
        Parameters:
        iatoms - array of atoms indices to copy
        cbonds - array of bonds to copy or null to copy bonds in cbonds only
        nb - number of bonds
        g - the target graph
        Returns:
        false if the bonds array contains all bond end points, true if there is at least one external bond
        Since:
        Marvin 5.0.2, 03/07/2008
      • isGrinvCCValid

        protected boolean isGrinvCCValid()
        Tests whether the graph invariant change count is valid.
        Overrides:
        isGrinvCCValid in class MoleculeGraph
        Returns:
        false
        Since:
        Marvin 5.0, 11/30/2007
      • checkBondConsistency

        protected void checkBondConsistency()
        Empty implementation, bond consistency is not checked in case of selections.
        Overrides:
        checkBondConsistency in class MoleculeGraph
        Since:
        Marvin 5.0, 11/06/2007
      • createGearch

        protected chemaxon.struc.gearch.MoleculeGraphGearch createGearch()
        Overrides:
        createGearch in class MoleculeGraph
      • addAtomWithoutChangingIt

        protected final int addAtomWithoutChangingIt​(MolAtom atom)
        Adds an atom without setting its parentGraph and index fields.
        Overrides:
        addAtomWithoutChangingIt in class MoleculeGraph
        Parameters:
        atom - the atom reference
        Returns:
        the new atom index