@@ -60,28 +60,28 @@ class BubbleSortNotifier extends SortingNotifier {
6060 await greenSortedItemsAsDone ();
6161 }
6262
63- List <BubbleSortStep > bubbleSortSteps (List <int > values) {
64- final steps = < BubbleSortStep > [];
63+ List <SortingStep > bubbleSortSteps (List <int > values) {
64+ final steps = < SortingStep > [];
6565 final arr = List <int >.from (values);
6666
6767 for (int i = 0 ; i < arr.length - 1 ; i++ ) {
6868 bool isSorted = true ;
6969
7070 for (int j = 0 ; j < arr.length - i - 1 ; j++ ) {
71- steps.add (BubbleSortStep (index1: j, index2: j + 1 , action: SortingStatus .compared)); // external
71+ steps.add (SortingStep (index1: j, index2: j + 1 , action: SortingStatus .compared)); // external
7272
7373 if (arr[j] > arr[j + 1 ]) {
74- steps.add (BubbleSortStep (index1: j, index2: j + 1 , action: SortingStatus .swapped)); // external
74+ steps.add (SortingStep (index1: j, index2: j + 1 , action: SortingStatus .swapped)); // external
7575 final tmp = arr[j];
7676 arr[j] = arr[j + 1 ];
7777 arr[j + 1 ] = tmp;
7878 isSorted = false ;
7979 }
8080
81- steps.add (BubbleSortStep (index1: j, index2: j + 1 , action: SortingStatus .unSorted)); // external
81+ steps.add (SortingStep (index1: j, index2: j + 1 , action: SortingStatus .unSorted)); // external
8282 }
8383
84- steps.add (BubbleSortStep (
84+ steps.add (SortingStep (
8585 index1: arr.length - i - 1 , index2: arr.length - i - 1 , action: SortingStatus .sorted)); // external
8686
8787 if (isSorted) break ;
@@ -90,15 +90,3 @@ class BubbleSortNotifier extends SortingNotifier {
9090 return steps;
9191 }
9292}
93-
94- class BubbleSortStep {
95- final int index1;
96- final int index2;
97- final SortingStatus action;
98-
99- BubbleSortStep ({
100- required this .index1,
101- required this .index2,
102- required this .action,
103- });
104- }
0 commit comments