using System; using System.Collections.Generic; using System.Text; using DNAModule.Sunweaver.Commands.Abstracts; using DNAModule.Sunweaver.DataPrototypes; namespace DNAModule.Sunweaver { public class CoduleDeletionMutation : BasicCoduleMutation { public CoduleDeletionMutation() : base() { } public CoduleDeletionMutation(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 (length < 1) { length = 1; } if (index + length > c.BasePairs.Count || index<0) { index = c.BasePairs.Count - length; } if (index < 0) { index = 0; } if (index + length > c.BasePairs.Count) { length = c.BasePairs.Count - index; } for (int i = 0; i < length; i++) { c.BasePairs.RemoveAt(index); } } } }