From 82b809e63700dbaa560c2aff305076c0b23866e6 Mon Sep 17 00:00:00 2001 From: DominikRafacz <d.rafacz@student.mini.pw.edu.pl> Date: Sun, 11 Jul 2021 12:48:06 +0200 Subject: [PATCH] fix early return for remove_ambiguous --- inst/include/tidysq/ops/remove_ambiguous.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/inst/include/tidysq/ops/remove_ambiguous.h b/inst/include/tidysq/ops/remove_ambiguous.h index c96e4d96..a147d266 100644 --- a/inst/include/tidysq/ops/remove_ambiguous.h +++ b/inst/include/tidysq/ops/remove_ambiguous.h @@ -6,20 +6,15 @@ namespace tidysq { namespace ops { template<typename INTERNAL_IN, typename INTERNAL_OUT = INTERNAL_IN> class OperationRemoveAmbiguous : public OperationRemoveOnCondition<INTERNAL_IN, INTERNAL_OUT> { - bool early_return_; - Alphabet match_dest_alph(const Alphabet &alphabet) { switch (alphabet.type()) { case AMI_BSC: - early_return_ = true; case AMI_EXT: return Alphabet(AMI_BSC); case DNA_BSC: - early_return_ = true; case DNA_EXT: return Alphabet(DNA_BSC); case RNA_BSC: - early_return_ = true; case RNA_EXT: return Alphabet(RNA_BSC); default: @@ -28,9 +23,13 @@ namespace tidysq { } bool may_return_early(const Sq<INTERNAL_IN> &vector_in) override { - return early_return_; + SqType type = this->alph_.type(); + return type == AMI_BSC || type == DNA_BSC || type == RNA_BSC; } + Sq<INTERNAL_OUT> return_early(const Sq<INTERNAL_IN> &vector_in) { + return vector_in; + } public: @@ -44,8 +43,7 @@ namespace tidysq { this->OperationRemoveOnCondition<INTERNAL_IN, INTERNAL_OUT>::alph_[value]) || this->OperationRemoveOnCondition<INTERNAL_IN, INTERNAL_OUT>::alph_.NA_value() == value; }, - by_letter), - early_return_(false) {}; + by_letter) {}; }; }