Example #1
0
        public void onProblemChanged(ProblemToAlgorithm data)
        {
            foreach (Label l in theListLabels)
            {
                this.Controls.Remove(l);
            }

            initializeSortAnimator(data.getData());
        }
Example #2
0
        public override void sort(ProblemToAlgorithm data)
        {
            for (int i = 0; i < data.getData().Count; i++)
            {
                for (int j = i + 1; j < data.getData().Count; j++)
                {
                    if (data.getData()[j].Item2 > data.getData()[i].Item2)
                    {
                        if (numberSwapListener != null)
                            numberSwapListener.onNumberSwapped(j, i);

                        Tuple<String, int> temp = data.getData()[j];
                        data.getData().RemoveAt(j);
                        data.getData().Insert(j, data.getData()[i]);
                        data.getData().RemoveAt(i);
                        data.getData().Insert(i, temp);
                    }
                }
            }
        }