コード例 #1
0
        public override void TestClone()
        {
            ICrystal crystal = (ICrystal)NewChemObject();
            object   clone   = crystal.Clone();

            Assert.IsTrue(clone is ICrystal);
        }
コード例 #2
0
        public override ICDKObject Clone(CDKObjectMap map)
        {
            ChemModel clone = (ChemModel)base.Clone(map);

            clone.setOfMolecules = (IChemObjectSet <IAtomContainer>)setOfMolecules?.Clone(map);
            clone.setOfReactions = (IReactionSet)setOfReactions?.Clone(map);
            clone.ringSet        = (IRingSet)ringSet?.Clone(map);
            clone.crystal        = (ICrystal)crystal?.Clone(map);
            return(clone);
        }
コード例 #3
0
        public virtual void TestClone_Axes()
        {
            ICrystal crystal1 = (ICrystal)NewChemObject();
            Vector3  axes     = new Vector3(1, 2, 3);

            crystal1.A = axes;
            ICrystal crystal2 = (ICrystal)crystal1.Clone();

            // test cloning of axes
            var cpy = crystal1.A; cpy.X = 5; crystal1.A = cpy; // NCDK's Vector3 is value type.

            Assert.AreEqual(1.0, crystal2.A.X, 0.001);
        }