/// <summary> Writes a SetOfMolecules to an OutputStream for the reaction. /// /// </summary> /// <param name="som"> The SetOfMolecules that is written to an OutputStream /// </param> private void writeSetOfMolecules(ISetOfMolecules som) { for (int i = 0; i < som.MoleculeCount; i++) { IMolecule mol = som.getMolecule(i); for (int j = 0; j < som.getMultiplier(i); j++) { //MemoryStream ms = new MemoryStream(); //StreamWriter sw = new StreamWriter(ms); writer.Write("$MOL\n"); MDLWriter mdlwriter = null; try { mdlwriter = new MDLWriter(writer); } catch (System.Exception ex) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //logger.error(ex.Message); //logger.debug(ex); //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" throw new CDKException("Exception while creating MDLWriter: " + ex.Message, ex); } mdlwriter.write(mol); //writer.Write(sw.ToString()); } } }
/// <summary> Returns the stoichiometry coefficient of the given reactant. /// /// </summary> /// <param name="reactant">Reactant for which the coefficient is returned. /// </param> /// <returns> -1, if the given molecule is not a product in this Reaction /// </returns> /// <seealso cref="setReactantCoefficient"> /// </seealso> public virtual double getReactantCoefficient(IMolecule reactant) { return(reactants.getMultiplier(reactant)); }
/// <summary> Returns the stoichiometry coefficient of the given product. /// /// </summary> /// <param name="product">Product for which the coefficient is returned. /// </param> /// <returns> -1, if the given molecule is not a product in this Reaction /// </returns> /// <seealso cref="setProductCoefficient"> /// </seealso> public virtual double getProductCoefficient(IMolecule product) { return(products.getMultiplier(product)); }