X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=src%2Freverseaction.h;h=76ab6660da377187420f268ce6dda84825ef3361;hb=5f37e9f08f736f4fe4576dd530c60ecb87017907;hp=a7db6d460530082828fa26d59aa80cbe134d670d;hpb=d0abe1592fcbb10f4ac303e7b66c384624d4d439;p=germs.git diff --git a/src/reverseaction.h b/src/reverseaction.h index a7db6d4..76ab666 100644 --- a/src/reverseaction.h +++ b/src/reverseaction.h @@ -22,6 +22,10 @@ #define __REVERSEACTION_H__ #include "sortaction.h" +#include "genealgorithms.h" + +#include + /** * Reverses an interval * @@ -33,10 +37,15 @@ class ReverseAction : public SortAction{ /** * Creates a new reverse action for the interval [i,j] */ - ReverseAction(size_t i, size_t j):_i(i),_j(j){} + ReverseAction(size_t i, size_t j): SortAction(0),_i(i),_j(j){ + } + ReverseAction(Interval i): SortAction(0){ + _i = std::min(i.first,i.second); + _j = std::max(i.first,i.second)-1; + } /** - * Sort SortActions by score + * Applies the sort action on the gene order */ virtual GeneOrder& operator()(GeneOrder& go) const{ go.reverse(_i,_j);