liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
liblevenshtein::distance::SymmetricPair Class Reference

Represents a pair of terms sorted, lexicographically, in ascending order. More...

#include <symmetric_pair.h>

Collaboration diagram for liblevenshtein::distance::SymmetricPair:

Public Member Functions

 SymmetricPair (const std::string &u, const std::string &v)
 Constructs a SymmetricPair of terms such that the first term is the lesser, lexicographically, of the two.
 
auto operator== (const SymmetricPair &other) const -> bool
 Determines whether this SymmetricPair is equivalent to another.
 

Private Attributes

std::string first
 The lexicographically lesser term of the pair.
 
std::string second
 The lexicographically greater term of the pair.
 

Friends

class std::hash< SymmetricPair >
 The hasch function may access all the members of this class.
 
auto operator<< (std::ostream &out, const SymmetricPair &pair) -> std::ostream &
 The ostream operator may access all the members of this class.
 

Detailed Description

Represents a pair of terms sorted, lexicographically, in ascending order.

Definition at line 12 of file symmetric_pair.h.

Constructor & Destructor Documentation

◆ SymmetricPair()

liblevenshtein::distance::SymmetricPair::SymmetricPair ( const std::string & u,
const std::string & v )

Constructs a SymmetricPair of terms such that the first term is the lesser, lexicographically, of the two.

Parameters
uThe first term of the SymmetricPair.
vThe second term of the SymmetricPair.

Definition at line 9 of file symmetric_pair.cpp.

9 {
10 if (u.compare(v) < 0) {
11 this->first = u;
12 this->second = v;
13 } else {
14 this->first = v;
15 this->second = u;
16 }
17}
std::string second
The lexicographically greater term of the pair.
std::string first
The lexicographically lesser term of the pair.
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition main.cpp:25

References first, query(), and second.

Here is the call graph for this function:

Member Function Documentation

◆ operator==()

auto liblevenshtein::distance::SymmetricPair::operator== ( const SymmetricPair & other) const -> bool

Determines whether this SymmetricPair is equivalent to another.

Parameters
otherThe SymmetricPair to compare with this one.
Returns
Whether this SymmetricPair is equivalent to the other.

Definition at line 19 of file symmetric_pair.cpp.

19 {
20 return (first == other.first) && (second == other.second);
21}

References query().

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

auto operator<< ( std::ostream & out,
const SymmetricPair & pair ) -> std::ostream &
friend

The ostream operator may access all the members of this class.

Definition at line 23 of file symmetric_pair.cpp.

24 {
25 out << "SymmetricPair{first=\"" << pair.first << "\", second=\""
26 << pair.second << "\"}";
27 return out;
28}

◆ std::hash< SymmetricPair >

friend class std::hash< SymmetricPair >
friend

The hasch function may access all the members of this class.

Definition at line 30 of file symmetric_pair.h.

Member Data Documentation

◆ first

std::string liblevenshtein::distance::SymmetricPair::first
private

The lexicographically lesser term of the pair.

Definition at line 42 of file symmetric_pair.h.

Referenced by SymmetricPair().

◆ second

std::string liblevenshtein::distance::SymmetricPair::second
private

The lexicographically greater term of the pair.

Definition at line 45 of file symmetric_pair.h.

Referenced by SymmetricPair().


The documentation for this class was generated from the following files: