private void buttonSort_Click(object sender, EventArgs e) { this.tmp.CopyTo(array, 0); int tmp = _radioButtonList.FindIndex(button => button.Checked); switch (tmp) { case 0: { _comparator = new NumberComparator(); _sortable = new BubbleSorter <double>(); } break; case 1: { _comparator = new NumberComparator(); _sortable = new FlagBubble <double>(); } break; case 2: { _comparator = new NumberComparator(); _sortable = new SimpleSelection <double>(); } break; case 3: { _comparator = new NumberComparator(); _sortable = new QuickSort <double>(); } break; case 4: { IComparableLab <CustomDoubleArray> comparator = new CustomDoubleArrayComparator(); ISortable <CustomDoubleArray> sortable = new ShellSort <CustomDoubleArray>(); if (sortable.ArrayCheck(CustomDoubleArray, comparator)) { tmpArrayHolder.Text = ""; sortedArrayHolder.Text = ""; CustomDoubleArray = sortable.Sort(CustomDoubleArray, tmpArrayHolder, comparator, true, true); sortable.Print(CustomDoubleArray, sortedArrayHolder, ""); } else { tmpLabel.Text = "Please reenter array, because it does not fit the condition!!"; } } return; case 5: { _comparator = new NumberComparator(); _sortable = new MergeSort <double>(); _direction = false; } break; case 6: { int [] intArray = new int[array.Length]; for (int i = 0; i < intArray.Length; i++) { intArray[i] = (int)array[i]; } intArray = Lab6ArrayHandler.Execute(intArray); IComparableLab <int> comparable = new NumberComparator(); ISortable <int> sortable = new CountSort <int>(); _direction = false; if (sortable.ArrayCheck(intArray, comparable)) { tmpArrayHolder.Text = ""; sortedArrayHolder.Text = ""; sortable.Print(intArray, tmpArrayHolder, "Масив після виконання індивідуального завдання: \n"); intArray = sortable.Sort(intArray, tmpArrayHolder, comparable, _direction, true); sortable.Print(intArray, sortedArrayHolder, ""); } else { tmpLabel.Text = "Please reenter array, because it does not fit the condition!!"; } } return; default: { throw new IndexOutOfRangeException(); } } if (_sortable.ArrayCheck(array, _comparator)) { tmpArrayHolder.Text = ""; sortedArrayHolder.Text = ""; array = _sortable.Sort(array, tmpArrayHolder, _comparator, _direction, true); _sortable.Print(array, sortedArrayHolder, ""); } else { tmpLabel.Text = "Please reenter array, because it does not fit the condition!!"; } }