/// <summary> /// The filter out. /// </summary> /// <param name="sequence"> /// The sequence. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public int FilterOut(List<string> sequence) { int hits = 0; EndIterator iterator; iterator = new EndIterator(Chain, sequence.Count, Interfaces.Seeker.Step); while (iterator.HasNext()) { List<string> temp = iterator.Next(); bool chainsEquals = sequence.Count == temp.Count; for (int i = 0; i < sequence.Count; i++) { if (temp[i] != sequence[i]) { chainsEquals = false; } } if (chainsEquals) { Chain.Remove(iterator.Position(), sequence.Count); hits = hits + 1; } } return hits; }
public void ResetTest() { int lengthCut = 2; int step = 1; int index = 0; int position = 6; var list1 = new List<string> { "ABABAB", "ABATAT", "TABABAB", "ABTABAB", "ABABAB", "ABABAB", "ABABAB" }; var chain = new ComplexChain(list1); var iterator = new EndIterator(chain, lengthCut, step); while (iterator.HasNext()) { iterator.Next(); index = index + 1; } iterator.Reset(); Assert.True(iterator.Position() == position); }