/** * Writes a IChemObject to the MDL RXN file formated output. * It can only output ChemObjects of type Reaction * * @param object class must be of type Molecule or MoleculeSet. * * @see org.openscience.cdk.ChemFile */ @Override public void write(IChemObject object) throws CDKException { if (object instanceof IReactionSet) { writeReactionSet((IReactionSet) object); } else if (object instanceof IReaction) { writeReaction((IReaction) object); } else { throw new CDKException("Only supported is writing ReactionSet, Reaction objects."); } }
/** * Writes an array of Reaction to an OutputStream in MDL rdf format. * * @param reactions Array of Reactions that is written to an OutputStream */ private void writeReactionSet(IReactionSet reactions) throws CDKException { for (IReaction iReaction : reactions.reactions()) { writeReaction(iReaction); } }