Class ChemModelManipulator
java.lang.Object
org.openscience.cdk.tools.manipulator.ChemModelManipulator
Class with convenience methods that provide methods from
methods from ChemObjects within the ChemModel. For example:
ChemModelManipulator.removeAtom(chemModel, atom);will find the Atom in the model by traversing the ChemModel's MoleculeSet, Crystal and ReactionSet fields and remove it with the removeAtom(Atom) method.
- See Also:
- Source code:
- main
- Belongs to CDK module:
- standard
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IAtomContainer
createNewMolecule
(IChemModel chemModel) Adds a new Molecule to the MoleculeSet inside a given ChemModel.static List<IAtomContainer>
getAllAtomContainers
(IChemModel chemModel) Returns all the AtomContainer's of a ChemModel.static List<IChemObject>
getAllChemObjects
(IChemModel chemModel) Retrieve a List of all ChemObject objects within an IChemModel.getAllIDs
(IChemModel chemModel) static int
getAtomCount
(IChemModel chemModel) Get the total number of atoms inside an IChemModel.static int
getBondCount
(IChemModel chemModel) Get the total number of bonds inside an IChemModel.static IAtomContainer
getRelevantAtomContainer
(IChemModel chemModel, IAtom atom) This badly named methods tries to determine which AtomContainer in the ChemModel is best suited to contain added Atom's and Bond's.static IAtomContainer
getRelevantAtomContainer
(IChemModel chemModel, IBond bond) Retrieves the first IAtomContainer containing a given IBond from an IChemModel.static IReaction
getRelevantReaction
(IChemModel chemModel, IAtom atom) Retrieves the first IReaction containing a given IAtom from an IChemModel.static IChemModel
newChemModel
(IAtomContainer atomContainer) Create a new ChemModel containing an IAtomContainer.static void
removeAtomAndConnectedElectronContainers
(IChemModel chemModel, IAtom atom) Remove an Atom and the connected ElectronContainers from all AtomContainers inside an IChemModel.static void
removeElectronContainer
(IChemModel chemModel, IElectronContainer electrons) Remove an ElectronContainer from all AtomContainers inside an IChemModel.static void
setAtomProperties
(IChemModel chemModel, Object propKey, Object propVal) Sets the AtomProperties of all Atoms inside an IChemModel.
-
Constructor Details
-
ChemModelManipulator
public ChemModelManipulator()
-
-
Method Details
-
getAtomCount
Get the total number of atoms inside an IChemModel.- Parameters:
chemModel
- The IChemModel object.- Returns:
- The number of Atom object inside.
-
getBondCount
Get the total number of bonds inside an IChemModel.- Parameters:
chemModel
- The IChemModel object.- Returns:
- The number of Bond object inside.
-
removeAtomAndConnectedElectronContainers
Remove an Atom and the connected ElectronContainers from all AtomContainers inside an IChemModel.- Parameters:
chemModel
- The IChemModel object.atom
- The Atom object to remove.
-
removeElectronContainer
Remove an ElectronContainer from all AtomContainers inside an IChemModel.- Parameters:
chemModel
- The IChemModel object.electrons
- The ElectronContainer to remove.
-
createNewMolecule
Adds a new Molecule to the MoleculeSet inside a given ChemModel. Creates a MoleculeSet if none is contained.- Parameters:
chemModel
- The ChemModel object.- Returns:
- The created Molecule object.
-
newChemModel
Create a new ChemModel containing an IAtomContainer. It will create anIAtomContainer
from the passed IAtomContainer when needed, which may cause information loss.- Parameters:
atomContainer
- The AtomContainer to have inside the ChemModel.- Returns:
- The new IChemModel object.
-
getRelevantAtomContainer
This badly named methods tries to determine which AtomContainer in the ChemModel is best suited to contain added Atom's and Bond's. -
getRelevantAtomContainer
Retrieves the first IAtomContainer containing a given IBond from an IChemModel.- Parameters:
chemModel
- The IChemModel object.bond
- The IBond object to search.- Returns:
- The IAtomContainer object found, null if none is found.
-
getRelevantReaction
Retrieves the first IReaction containing a given IAtom from an IChemModel.- Parameters:
chemModel
- The IChemModel object.atom
- The IAtom object to search.- Returns:
- The IAtomContainer object found, null if none is found.
-
getAllAtomContainers
Returns all the AtomContainer's of a ChemModel. -
setAtomProperties
Sets the AtomProperties of all Atoms inside an IChemModel.- Parameters:
chemModel
- The IChemModel object.propKey
- The key of the property.propVal
- The value of the property.
-
getAllChemObjects
Retrieve a List of all ChemObject objects within an IChemModel.- Parameters:
chemModel
- The IChemModel object.- Returns:
- A List of all ChemObjects inside.
-
getAllIDs
-