Esempio n. 1
0
        public override void TestClone()
        {
            IMonomer oMonomer = (IMonomer)NewChemObject();
            object   clone    = oMonomer.Clone();

            Assert.IsTrue(clone is IMonomer);
            Assert.AreNotSame(oMonomer, clone);
        }
Esempio n. 2
0
        public override ICDKObject Clone(CDKObjectMap map)
        {
            var clone = (Strand)base.Clone(map);

            clone.monomers = new Dictionary <string, IMonomer>();
            foreach (var pair in monomers)
            {
                string   monomerName   = pair.Key;
                IMonomer monomer       = pair.Value;
                var      clonedMonomer = (IMonomer)monomer.Clone(map);
                clone.monomers.Add(monomerName, clonedMonomer);
            }
            return(clone);
        }
Esempio n. 3
0
        public override ICDKObject Clone(CDKObjectMap map)
        {
            var clone = (Polymer)base.Clone(map);

            clone.monomers = new Dictionary <string, IMonomer>();
            foreach (var monomerInfo in monomers)
            {
                string   name     = monomerInfo.Key;
                IMonomer original = monomerInfo.Value;
                IMonomer cloned   = (IMonomer)original.Clone(map);
                clone.monomers.Add(name, cloned);
            }

            // update sgroups
            var sgroups = this.GetCtabSgroups();

            if (sgroups != null)
            {
                clone.SetCtabSgroups(SgroupManipulator.Copy(sgroups, map));
            }

            return(clone);
        }