using System; using System.Collections.Generic; using System.Text; using DNAModule.Sunweaver.Commands.Abstracts; using DNAModule.Sunweaver.DataPrototypes; namespace DNAModule.Sunweaver { public class CoduleInsertionMutation : BasicCoduleMutation { public CoduleInsertionMutation() : base() { } public CoduleInsertionMutation(int minLength, int maxLength, double probability, float commands, float constants, float references, float stores) : base(minLength, maxLength, probability, commands, constants, references, stores) { } public override void mutate(Codule c, int index, int length, float commands, float constants, float references, float stores) { if (index < 0) { index = 0; } if (length < 1) { length = 1; } if (index > c.BasePairs.Count) { index = c.BasePairs.Count; } for (int i = 0; i < length; i++) { c.BasePairs.Insert(i + index, DNASystem.CommandListClass.randomBasePair(commands, constants, references, stores)); } } } }