|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.util.iterator.IteratorFactory
public class IteratorFactory
The IteratorFactory class provides implementations of java.util.Iterator#Iterator
to ease the handling of atoms and bonds used in Molecule objects and its
descendants. The following iterators are included in this class:
API usage example:
//initialize an RgMolecule;
RgMolecule mol = ... ;
//create the iterator factory with the specified molecule and parameters related to atoms and bonds.
IteratorFactory factory = new IteratorFactory(mol, IteratorFactory.INCLUDE_ALL_ATOMS, IteratorFactory.INCLUDE_ALL_BONDS);
RgComponentIterator rgIterator = factory.createRgComponentIterator();
//iteration on the components of the RgMolecule.
while (rgIterator.hasNext()) {
Molecule component = rgIterator.nextComponent();
IteratorFactory ifc = new IteratorFactory(component, IteratorFactory.SKIP_PSEUDO_ATOM | IteratorFactory.SKIP_EXPLICIT_H,
IteratorFactory.SKIP_COORDINATE_BONDS);
AtomIterator atomIterator = ifc.createAtomIterator();
//iteration on the atoms of a component
while (atomIterator.()){
MolAtom atom = atomIterator.nextAtom();
//process the atom
...
}
//iteration on the bonds of a component
BondIterator bondIterator = ifc.createBondIterator();
while (bondIterator.hasNext()){
MolBond bond = bondIterator.nextBond();
//process the bond
...
}
}
MolAtom,
MolBond,
Molecule,
RxnMolecule,
RgMolecule| Nested Class Summary | |
|---|---|
class |
IteratorFactory.AtomIterator
The AtomIterator class provides
an iterator for the atoms of the specified molecule of the factory
according to the atom related behavior set in the factory. |
class |
IteratorFactory.AtomNeighbourIterator
The AtomNeighbourIterator class provides an iterator to process
the atoms connecting to a specified atom according to the atom and bond related
behavior of this factory. |
class |
IteratorFactory.BondIterator
The BondIterator class provides an iterator to process
the bonds of the specified molecule in this factory
according to the bond related behavior of this factory. |
class |
IteratorFactory.BondNeighbourIterator
The BondNeighbourIterator class provides an iterator to
process the bonds connecting to the specified atom according to the atom
and bond related behavior of this factory. |
class |
IteratorFactory.NeighbourIterator
The NeighbourIterator class provides an iterator to process the bonds connecting to the
specified atom according to the atom and bond related behavior of this factory. |
class |
IteratorFactory.RgComponentIterator
The RgComponentIterator class provides an iterator to process
the rgroup definition components in the specified molecule of
the factory. |
class |
IteratorFactory.RxnComponentIterator
The RxnComponentIterator class provides an iterator to process
the components (reactant, product and agent components) in the reaction molecule of
the factory. |
| Field Summary | |
|---|---|
static int |
INCLUDE_ALL_ATOMS
Include all atoms: chemical atoms, explicit hydrogen, multicenter, lone pair and pseudo atoms in atom iterations. |
static int |
INCLUDE_ALL_BONDS
Include all bonds: covalent and coordinate bonds in bond iteration. |
static int |
INCLUDE_CHEMICAL_ATOMS
Include only chemical atoms in iteration, skip multicenters, lone pairs and pseudo atoms. |
static int |
SKIP_COORDINATE_BONDS
Exclude coordinate bonds from bond iteration. |
static int |
SKIP_COVALENT_BONDS
Exclude covalent bonds from bond iteration. |
static int |
SKIP_EXPLICIT_H
Exclude explicit hydrogens from atom iteration. |
static int |
SKIP_LONE_PAIR
Exclude lone pairs from atom iteration. |
static int |
SKIP_MULTICENTER
Exclude multicenters from atom iteration. |
static int |
SKIP_PSEUDO_ATOM
Exclude pseudo atoms from atom iteration. |
| Constructor Summary | |
|---|---|
IteratorFactory(Molecule mol)
Constructs an iterator factory for the specified molecule with default atom and bond related behavior to include all atoms and bonds. |
|
IteratorFactory(Molecule mol,
int atomRelatedBehavior,
int bondRelatedBehavior)
Constructs an iterator factory for the specified molecule with a specified atom and bond related behavior. |
|
| Method Summary | |
|---|---|
IteratorFactory.AtomIterator |
createAtomIterator()
Constructs an atom iterator for the specified molecule of the factory according to the atom related behavior set in the factory. |
IteratorFactory.AtomNeighbourIterator |
createAtomNeighbourIterator(MolAtom atom)
Constructs an iterator to get the atom neighbours of the specified atom. |
IteratorFactory.BondIterator |
createBondIterator()
Constructs a bond iterator for the specified molecule of the factory according to bond related behavior set in the factory. |
IteratorFactory.BondNeighbourIterator |
createBondNeighbourIterator(MolAtom atom)
Constructs an iterator to get the bonds connecting to the specified atom. |
IteratorFactory.RgComponentIterator |
createRgComponentIterator()
Constructs an rgroup definition component iterator for the specified molecule of the factory if the molecule is an RgMolecule, an empty iterator otherwise. |
IteratorFactory.RxnComponentIterator |
createRxnComponentIterator()
Constructs a reaction component iterator for the specified molecule of the factory if the molecule is an RxnMolecule, an empty iterator otherwise. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int INCLUDE_ALL_BONDS
public static final int SKIP_COORDINATE_BONDS
public static final int SKIP_COVALENT_BONDS
public static final int INCLUDE_ALL_ATOMS
public static final int SKIP_EXPLICIT_H
public static final int SKIP_MULTICENTER
public static final int SKIP_LONE_PAIR
public static final int SKIP_PSEUDO_ATOM
public static final int INCLUDE_CHEMICAL_ATOMS
| Constructor Detail |
|---|
public IteratorFactory(Molecule mol,
int atomRelatedBehavior,
int bondRelatedBehavior)
mol - the molecule whose atoms and bonds to be iterated.atomRelatedBehavior - the behavior how to iterate on atoms. Specify with the constants:
bondRelatedBehavior - the behavior how to iterate on bonds. Specify with the constants:
public IteratorFactory(Molecule mol)
INCLUDE_ALL_ATOMS,
INCLUDE_ALL_BONDS| Method Detail |
|---|
public IteratorFactory.AtomIterator createAtomIterator()
public IteratorFactory.BondIterator createBondIterator()
public IteratorFactory.AtomNeighbourIterator createAtomNeighbourIterator(MolAtom atom)
atom - the atom whose neighbour atoms to be iterated
public IteratorFactory.BondNeighbourIterator createBondNeighbourIterator(MolAtom atom)
atom - the atom whose bonds to be iterated
public IteratorFactory.RxnComponentIterator createRxnComponentIterator()
public IteratorFactory.RgComponentIterator createRgComponentIterator()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||