Skip to content

Commit

Permalink
get a fragment by fragment_order
Browse files Browse the repository at this point in the history
  • Loading branch information
kk-mats committed Jun 19, 2019
1 parent a552707 commit 0ab79ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions model/clone_pair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ fragment clone_pair::fragment2() const noexcept
return this->fragments_.second;
}

fragment clone_pair::fragment_of(const fragment_order order) const noexcept
{
return order==fragment_order::first ? this->fragments_.first : this->fragments_.second;
}

unsigned int clone_pair::similarity() const noexcept
{
return this->similairty_;
Expand Down
7 changes: 7 additions & 0 deletions model/clone_pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ namespace asterism
class clone_pair final
{
public:
enum class fragment_order
{
first, second
};

clone_pair() noexcept;
clone_pair(const fragment &fragment1, const fragment &fragment2, const unsigned int similarity) noexcept;
clone_pair(fragment &&fragment1, fragment &&fragment2, const unsigned int similarity) noexcept;
Expand All @@ -20,6 +25,8 @@ class clone_pair final

fragment fragment1() const noexcept;
fragment fragment2() const noexcept;
fragment fragment_of(const fragment_order order) const noexcept;

unsigned int similarity() const noexcept;

friend uint qHash(const clone_pair &key, uint seed) noexcept;
Expand Down

0 comments on commit 0ab79ec

Please sign in to comment.