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

Represents an edge from one DawgNode to another, annotated with a character label from the current position of the dictionary term. More...

#include <transition.h>

Collaboration diagram for liblevenshtein::Transition:

Public Member Functions

 Transition (char label, DawgNode *source, DawgNode *target)
 Constructs a new Transition from a source DawgNode to its target, annotated by the given label.
 
 Transition (const Transition &transition)=default
 Copy constructor for this Transition.
 
 Transition (Transition &&transition) noexcept
 Move constructor for this Transition.
 
auto label () const -> char
 Returns the label annotating the edge from the source to the target of this Transition.
 
auto source () const -> DawgNode *
 Returns the initial DawgNode along the edge of this transition.
 
auto target () const -> DawgNode *
 Returns the destination DawgNode along the edge of this transition.
 
auto operator== (const Transition &other) const -> bool
 Returns whether this Transition is equivalent to another.
 

Private Attributes

char _label
 Annotation along the edge of this Transition.
 
DawgNode_source
 DawgNode at the beginning of this Transition.
 
DawgNode_target
 DawgNode at the ending of this Transition.
 

Detailed Description

Represents an edge from one DawgNode to another, annotated with a character label from the current position of the dictionary term.

Definition at line 13 of file transition.h.

Constructor & Destructor Documentation

◆ Transition() [1/3]

liblevenshtein::Transition::Transition ( char label,
DawgNode * source,
DawgNode * target )

Constructs a new Transition from a source DawgNode to its target, annotated by the given label.

Parameters
labelAnnotation for the current Transition.
sourceInitial DawgNode for this Transition.
targetDestination DawgNode for this Transition.

Definition at line 6 of file transition.cpp.

7 : _label(label),
10{}
DawgNode * _source
DawgNode at the beginning of this Transition.
Definition transition.h:77
auto source() const -> DawgNode *
Returns the initial DawgNode along the edge of this transition.
DawgNode * _target
DawgNode at the ending of this Transition.
Definition transition.h:80
auto label() const -> char
Returns the label annotating the edge from the source to the target of this Transition.
char _label
Annotation along the edge of this Transition.
Definition transition.h:74
auto target() const -> DawgNode *
Returns the destination DawgNode along the edge of this transition.

◆ Transition() [2/3]

liblevenshtein::Transition::Transition ( const Transition & transition)
default

Copy constructor for this Transition.

Parameters
transitionTransition to copy.

◆ Transition() [3/3]

liblevenshtein::Transition::Transition ( Transition && transition)
noexcept

Move constructor for this Transition.

Parameters
transitionTransition whose memory is to be moved to this one.

Definition at line 12 of file transition.cpp.

13 : _label(transition._label),
14 _source(transition._source),
15 _target(transition._target)
16{}

Member Function Documentation

◆ label()

auto liblevenshtein::Transition::label ( ) const -> char

Returns the label annotating the edge from the source to the target of this Transition.

Returns
Annotation of this Transition.

Definition at line 18 of file transition.cpp.

18 {
19 return _label;
20}

References _label.

Referenced by liblevenshtein::SortedDawg::minimize().

Here is the caller graph for this function:

◆ operator==()

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

Returns whether this Transition is equivalent to another.

Parameters
otherA Transition whose equivalence to this one is to be determined.
Returns
Whether this Transition is equivalent to another.

Definition at line 30 of file transition.cpp.

30 {
31 return _label == other._label
32 && *_source == *(other._source)
33 && *_target == *(other._target);
34}
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition main.cpp:25

References query().

Here is the call graph for this function:

◆ source()

auto liblevenshtein::Transition::source ( ) const -> DawgNode *

Returns the initial DawgNode along the edge of this transition.

Returns
A pointer to the DawgNode at the beginning of this transition.

Definition at line 22 of file transition.cpp.

22 {
23 return _source;
24}

References _source.

Referenced by liblevenshtein::SortedDawg::minimize().

Here is the caller graph for this function:

◆ target()

auto liblevenshtein::Transition::target ( ) const -> DawgNode *

Returns the destination DawgNode along the edge of this transition.

Returns
A pointer to the DawgNode at the ending of this transition.

Definition at line 26 of file transition.cpp.

26 {
27 return _target;
28}

References _target.

Referenced by liblevenshtein::SortedDawg::minimize().

Here is the caller graph for this function:

Member Data Documentation

◆ _label

char liblevenshtein::Transition::_label
private

Annotation along the edge of this Transition.

Definition at line 74 of file transition.h.

Referenced by label().

◆ _source

DawgNode* liblevenshtein::Transition::_source
private

DawgNode at the beginning of this Transition.

Definition at line 77 of file transition.h.

Referenced by source().

◆ _target

DawgNode* liblevenshtein::Transition::_target
private

DawgNode at the ending of this Transition.

Definition at line 80 of file transition.h.

Referenced by target().


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