コード例 #1
0
        public void TestGetAllMolecules_IReactionSet()
        {
            IReactionSet reactionSet = builder.NewReactionSet();

            reactionSet.Add(builder.NewReaction()); // 1
            reactionSet.Add(builder.NewReaction()); // 2

            Assert.AreEqual(0, ReactionSetManipulator.GetAllMolecules(reactionSet).Count);
        }
コード例 #2
0
        /// <summary>
        /// Returns all the AtomContainer's of a ChemModel.
        /// </summary>
        public static IEnumerable <IAtomContainer> GetAllAtomContainers(IChemModel chemModel)
        {
            var moleculeSet = chemModel.Builder.NewAtomContainerSet();

            if (chemModel.MoleculeSet != null)
            {
                moleculeSet.AddRange(chemModel.MoleculeSet);
            }
            if (chemModel.ReactionSet != null)
            {
                moleculeSet.AddRange(ReactionSetManipulator.GetAllMolecules(chemModel.ReactionSet));
            }
            return(MoleculeSetManipulator.GetAllAtomContainers(moleculeSet));
        }
コード例 #3
0
        public void TestGetAllMolecules_IReactionSet2()
        {
            IReactionSet   reactionSet = builder.NewReactionSet();
            IReaction      reaction1   = builder.NewReaction();
            IAtomContainer molecule    = builder.NewAtomContainer();

            reaction1.Products.Add(molecule);
            reaction1.Reactants.Add(builder.NewAtomContainer());
            reactionSet.Add(reaction1);
            IReaction reaction2 = builder.NewReaction();

            reaction2.Products.Add(builder.NewAtomContainer());
            reaction2.Reactants.Add(molecule);
            reactionSet.Add(reaction2);

            Assert.AreEqual(3, ReactionSetManipulator.GetAllMolecules(reactionSet).Count);
        }