Skip to content

Commit

Permalink
adapt else block in configure_free_ends_initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
smehringer committed Aug 21, 2020
1 parent b578378 commit b4d2ca7
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions include/seqan3/alignment/pairwise/alignment_configurator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,9 @@ template <typename function_wrapper_t, typename ...policies_t, typename config_t
constexpr function_wrapper_t alignment_configurator::configure_free_ends_initialisation(config_t const & cfg)
{
using traits_t = alignment_configuration_traits<config_t>;
// Get the value for the sequence ends configuration.
auto align_ends_cfg = cfg.get_or(align_cfg::aligned_ends{free_ends_none}).value;
using align_ends_cfg_t = decltype(align_ends_cfg);

// This lambda augments the initialisation policy of the alignment algorithm
// with the aligned_ends configuration from before.
// with the method_global free ends gap configuration from before.
auto configure_leading_both = [&] (auto first_seq, auto second_seq) constexpr
{
// Define the trait for the initialisation policy
Expand All @@ -634,40 +631,27 @@ constexpr function_wrapper_t alignment_configurator::configure_free_ends_initial
}
else
{
// Get the value for the sequence ends configuration.
auto method_global_cfg = cfg.get_or(align_cfg::method_global{});

// This lambda determines the initialisation configuration for the second sequence given
// the leading gap property for it.
auto configure_leading_second = [&] (auto first) constexpr
{
// If possible use static information.
if constexpr (align_ends_cfg_t::template is_static<2>())
{
using second_t = std::integral_constant<bool, align_ends_cfg_t::template get_static<2>()>;
return configure_leading_both(first, second_t{});
}
// Resolve correct property at runtime.
if (method_global_cfg.free_end_gaps_sequence2_leading)
return configure_leading_both(first, std::true_type{});
else
{ // Resolve correct property at runtime.
if (align_ends_cfg[2])
return configure_leading_both(first, std::true_type{});
else
return configure_leading_both(first, std::false_type{});
}
return configure_leading_both(first, std::false_type{});
};

// Here the initialisation configuration for the first sequence is determined given
// the leading gap property for it.
// If possible use static information.
if constexpr (align_ends_cfg_t::template is_static<0>())
{
using first_t = std::integral_constant<bool, align_ends_cfg_t::template get_static<0>()>;
return configure_leading_second(first_t{});
}
// Resolve correct property at runtime.
if (method_global_cfg.free_end_gaps_sequence1_leading)
return configure_leading_second(std::true_type{});
else
{ // Resolve correct property at runtime.
if (align_ends_cfg[0])
return configure_leading_second(std::true_type{});
else
return configure_leading_second(std::false_type{});
}
return configure_leading_second(std::false_type{});
}
}
//!\endcond
Expand Down

0 comments on commit b4d2ca7

Please sign in to comment.