app now just coordinates the components initialized in main
reduced responsibilities of constructors started using more pointers. sessions through app rather than app itself. mostly split view away from app (still hard coded) haven't decoupled sorts from timers as their actuator yet
This commit is contained in:
+7
-6
@@ -1,29 +1,30 @@
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include "sorters.hpp"
|
||||
using namespace std;
|
||||
|
||||
|
||||
SteppedBsort::SteppedBsort(SortInput &input): data(input) {};
|
||||
SteppedBsort::SteppedBsort(shared_ptr<SortInput> input): data(input) {};
|
||||
|
||||
bool SteppedBsort:: step(){
|
||||
if(is_finished==true) {
|
||||
printf("finished");
|
||||
return true;
|
||||
}
|
||||
if(data.values[j]>data.values[j+1])
|
||||
if(data->values[j]>data->values[j+1])
|
||||
{
|
||||
swap(data.values[j], data.values[j+1]);
|
||||
swap(data->values[j], data->values[j+1]);
|
||||
}
|
||||
j++;
|
||||
if(j>=data.values.size()-1 -i){
|
||||
if(j>=data->values.size()-1 -i){
|
||||
j=0;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i==data.values.size()-1){
|
||||
if (i==data->values.size()-1){
|
||||
is_finished=true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user