public void HasNextTest() { int lengthCut = 3; int step = 1; int countSteps = 0; var iterator = new StartIterator(chain, lengthCut, step); while (iterator.HasNext()) { iterator.Next(); countSteps = countSteps + 1; } Assert.True(countSteps == iterator.MaxShifts); countSteps = 0; iterator = new StartIterator(chain, lengthCut, step + 1); while (iterator.HasNext()) { iterator.Next(); countSteps = countSteps + 1; } Assert.True(countSteps == iterator.MaxShifts); }
/// <summary> /// The find. /// </summary> /// <param name="par"> /// The par. /// </param> /// <returns> /// The <see cref="T:KeyValuePair{List{String},List{Int32}}"/>. /// </returns> public override sealed KeyValuePair<List<string>, List<int>>? Find(ContentValues par) { var convoluted = (ComplexChain)par.Get(Enum.GetName(typeof(Formalism), Formalism.Sequence)); var windowLen = (int)par.Get(Enum.GetName(typeof(Parameter), Parameter.Window)); var alphabet = (FrequencyDictionary)par.Get(Enum.GetName(typeof(Formalism), Formalism.Alphabet)); var level = (double)par.Get(Enum.GetName(typeof(Parameter), Parameter.CurrentThreshold)); int scanStep = 1; int disp = 0; var it = new StartIterator(convoluted, windowLen, scanStep); while (it.HasNext()) { it.Next(); fullEntry.Add(it, disp); } CalculateStd(convoluted, windowLen); return DiscardCompositeWords(alphabet, level); }
/// <summary> /// The find. /// </summary> /// <param name="par"> /// The par. /// </param> /// <returns> /// The <see cref="T:KeyValuePair{List{string},List{int}}?"/>. /// </returns> public override sealed KeyValuePair<List<string>, List<int>>? Find(ContentValues par) { var convoluted = (ComplexChain)par.Get(Enum.GetName(typeof(Formalism), Formalism.Sequence)); double pbalance = (int)par.Get(Enum.GetName(typeof(Parameter), Parameter.Balance)) / 100.0; int windowLen = (int)par.Get(Enum.GetName(typeof(Parameter), Parameter.Window)); var alphabet = (FrequencyDictionary)par.Get(Enum.GetName(typeof(Formalism), Formalism.Alphabet)); var level = (double)par.Get(Enum.GetName(typeof(Parameter), Parameter.CurrentThreshold)); int scanStep = 1; int disp = 0; int length = convoluted.GetLength(); fullEntry = new DataCollector(); minusOneEntry = new DataCollector(); minusTwoEntry = new DataCollector(); var it = new StartIterator(convoluted, windowLen, scanStep); CriterionMethod criteriaCalculator = new ConvolutedCriterionMethod(); while (it.HasNext()) { it.Next(); fullEntry.Add(it, disp); FindLess(it); } CalculateStd(convoluted, pbalance, windowLen, length, criteriaCalculator); return DiscardCompositeWords(alphabet, level); }