public DisparityDots(DisparityCachedList inputList, int sCount = 0, int shSpeed = 1, int soSpeed = 1)
 {
     disparities  = inputList;
     length       = inputList.Length;
     shuffleCount = sCount;
     speed        = shSpeed;
     sortSpeed    = soSpeed;
 }
Пример #2
0
        public void lb_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (lb.SelectedKey == null)
            {
                return;
            }

            SortingAlgorithm algorithm = AlgorithmDictionary[lb.SelectedKey.ToString()];

            instance = algorithm;
            //CachingList list = new CachingList(1000);
            CachingList list = new NoGetCachingList(1000);

            FisherYates.Shuffle <Int32>(list);

            int shuffleCount = list.Cache.Count;

            Console.WriteLine(string.Join <int>(",", list));
            instance.Sort <Int32>(list);

            Console.WriteLine(string.Join <int>(",", list));

            DisparityCachedList disparities = new DisparityCachedList(list);
            DisparityDots       dots        = new DisparityDots(disparities, shuffleCount, 10, 10 * algorithm.SpeedMultiplier);

            drawable        = new Drawable();
            drawable.Paint += dots.OnPaint;

            UITimer timer = new UITimer();

            timer.Interval = 0.0005;
            //Drawable.RegisterEvent(dots.OnPaint,)
            timer.Elapsed += (ts, te) =>
            {
                drawable.Update(new Rectangle(0, 0, drawable.Width, drawable.Height));
            };
            timer.Start();

            splitter.Panel1 = lb;
            splitter.Panel2 = drawable;
        }