Next() 공개 메소드

The next.
public Next ( ) : List
리턴 List
        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);
        }
        public void GetPositionTest()
        {
            int lengthCut = 2;
            int step = 1;
            var iterator = new StartIterator(chain, lengthCut, step);
            iterator.Next();
            Assert.True(iterator.CursorPosition == 0);
            iterator.Next();
            Assert.True(iterator.CursorPosition == 1);
            for (int index = 2; index < iterator.MaxShifts; index++)
            {
                iterator.Next();
            }

            Assert.True(iterator.CursorPosition == 16);
        }
        /// <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);
        }
        public void MoveTest()
        {
            int length = 2;
            int step = 1;
            int position = 3;
            var iterator = new StartIterator(chain, length, step);
            iterator.Move(position);
            Assert.True(iterator.CursorPosition == position);

            position = 100;
            iterator.Move(position);
            Assert.True(iterator.CursorPosition != position);

            position = chain.GetLength() / 2;
            iterator.Move(position);
            Assert.True(iterator.CursorPosition == position);

            position = -1;
            iterator.Move(position);
            Assert.True(iterator.CursorPosition != position);

            length = 3;
            step = 2;
            position = 3;
            string triple = "GTG";
            iterator = new StartIterator(chain, length, step);
            iterator.Move(position);
            iterator.Next();
            Assert.AreEqual(triple, Helper.ToString(iterator.Current()));
        }
        public void NextTest()
        {
            List<string> cut;
            string[] triplesForStepOne =
                {
                    "AAC", "ACA", "CAG", "AGG", "GGT", "GTG", "TGC", "GCC", "CCC", "CCC", "CCT",
                    "CTT", "TTA", "TAT", "ATT", "TTT"
                };
            string[] triplesForStepTwo = { "AAC", "CAG", "GGT", "TGC", "CCC", "CCT", "TTA", "ATT" };
            int lengthCut = 3;
            int step = 1;

            var iterator = new StartIterator(chain, lengthCut, step);

            for (int i = 0; i < iterator.MaxShifts; i++)
            {
                cut = iterator.Next();
                Assert.True(Helper.ToString(cut).Equals(triplesForStepOne[i]));
            }

            iterator = new StartIterator(chain, lengthCut, step + 1);

            for (int i = 0; i < iterator.MaxShifts; i++)
            {
                cut = iterator.Next();
                Assert.True(Helper.ToString(cut).Equals(triplesForStepTwo[i]));
            }
        }