Logo Search packages:      
Sourcecode: cdk version File versions  Download package

void org::openscience::cdk::io::PDBWriter::write ( IChemObject  object ) throws CDKException [inline]

Writes the content of "object" to output

Parameters:
objectthe object of which the content is outputed
Exceptions:
CDKExceptionis thrown if the output does not support the data in the object

Implements org::openscience::cdk::io::IChemObjectWriter.

Definition at line 125 of file PDBWriter.java.

References org::openscience::cdk::tools::manipulator::ChemModelManipulator::getAllAtomContainers(), org::openscience::cdk::interfaces::IChemObject::getBuilder(), org::openscience::cdk::interfaces::IChemSequence::getChemModel(), org::openscience::cdk::interfaces::IChemFile::getChemSequence(), org::openscience::cdk::interfaces::IChemModel::getCrystal(), and org::openscience::cdk::interfaces::IChemObjectBuilder::newMolecule().

                                                              {
        if (object instanceof IMolecule){
            writeMolecule((IMolecule)object);
        } else if (object instanceof ICrystal){
            writeCrystal((ICrystal)object);
        } else if (object instanceof IChemFile){
            IChemFile chemFile = (IChemFile)object;
            IChemSequence sequence = chemFile.getChemSequence(0);
            if (sequence != null) {
                  IChemModel model = sequence.getChemModel(0);
                if (model != null) {
                  ICrystal crystal = model.getCrystal();
                    if (crystal != null) {
                        write(crystal);
                    } else {
                        Iterator containers = ChemModelManipulator.getAllAtomContainers(model).iterator();
                        while (containers.hasNext()) {
                            writeMolecule(model.getBuilder().newMolecule(
                              (IAtomContainer)containers.next()
                            ));
                        }
                    }
                }
            }
        } else {
            throw new CDKException("Only supported is writing of Molecule, Crystal and ChemFile objects.");
        }
    }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index