public override void TestClone() { IMonomer oMonomer = (IMonomer)NewChemObject(); object clone = oMonomer.Clone(); Assert.IsTrue(clone is IMonomer); Assert.AreNotSame(oMonomer, clone); }
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); }
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); }