Skip to content

Commit

Permalink
[FIX] shorten the function with a redirect; move log to the correct r…
Browse files Browse the repository at this point in the history
…elease
  • Loading branch information
Irallia committed Feb 13, 2020
1 parent a910984 commit 295b32a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 63 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Note that 3.1.0 will be the first API stable release and interfaces in this rele
* Add top-level `CMakeLists.txt`
([\#1475](https://github.com/seqan/seqan3/pull/1475)).

#### Search

* The `extend_right()` function can now also handle `char const *`.
([\#1588](https://github.com/seqan/seqan3/pull/1588)).

## API changes

## Notable Bug-fixes
Expand Down Expand Up @@ -245,8 +250,6 @@ Note that 3.1.0 will be the first API stable release and interfaces in this rele
The same applies for the `seqan3::bi_fm_index_cursor`
([\#1433](https://github.com/seqan/seqan3/pull/1433)).

* The `extend_right()` function can now also handle `char const *`.

## Notable Bug-fixes

* All our headers are self contained
Expand Down
34 changes: 2 additions & 32 deletions include/seqan3/search/fm_index/bi_fm_index_cursor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,39 +437,9 @@ class bi_fm_index_cursor
return false;
}

//!\overload
template <typename char_t>
bool extend_right(char_t* const c) noexcept
bool extend_right(char const * c) noexcept
{
#ifndef NDEBUG
fwd_cursor_last_used = true;
#endif

static_assert(std::convertible_to<char_t, index_alphabet_type>,
"The character must be convertible to the alphabet of the index.");

assert(index != nullptr);

size_type new_parent_lb = fwd_lb, new_parent_rb = fwd_rb;

bool all_chars_true = true;

for(int i = 0; c[i]; i++) {
auto c_char = to_rank(static_cast<index_alphabet_type>(c[i])) + 1;
if (bidirectional_search(index->fwd_fm.index, c_char, fwd_lb, fwd_rb, rev_lb, rev_rb))
{
parent_lb = new_parent_lb;
parent_rb = new_parent_rb;

_last_char = c_char;
++depth;
}
else
{
all_chars_true = all_chars_true && false;
}
}
return all_chars_true;
return extend_right(std::string_view{c});
}

/*!\brief Tries to extend the query by the character `c` to the left.
Expand Down
31 changes: 2 additions & 29 deletions include/seqan3/search/fm_index/fm_index_cursor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,36 +282,9 @@ class fm_index_cursor
return false;
}

//!\overload
template <typename char_t>
bool extend_right(char_t* const c) noexcept
bool extend_right(char const * c) noexcept
{
static_assert(std::convertible_to<char_t, index_alphabet_type>,
"The character must be convertible to the alphabet of the index.");

assert(index != nullptr);

size_type _lb = node.lb, _rb = node.rb;

bool all_chars_true = true;

// for (auto it = std::ranges::begin(seq); it != std::ranges::end(seq); ++len, ++it)
for(int i = 0; c[i]; i++) {
sdsl_char_type c_char = to_rank(static_cast<index_alphabet_type>(c[i])) + 1;

if (backward_search(index->index, c_char, _lb, _rb))
{
parent_lb = node.lb;
parent_rb = node.rb;
node = {_lb, _rb, node.depth + 1, c_char};
}
else
{
all_chars_true = all_chars_true && false;
}

}
return all_chars_true;
return extend_right(std::string_view{c});
}

/*!\brief Tries to extend the query by `seq` to the right.
Expand Down

0 comments on commit 295b32a

Please sign in to comment.