1 #ifndef _HFST_TRANSITION_H_
2 #define _HFST_TRANSITION_H_
7 #include "../HfstDataTypes.h"
11 namespace implementations {
22 template <
class C>
class HfstTransition
29 static unsigned int get_symbol_number
30 (
const typename C::SymbolType &symbol) {
31 return C::get_symbol_number(symbol);
45 typename C::SymbolType isymbol,
46 typename C::SymbolType osymbol,
47 typename C::WeightType weight):
48 target_state(s), transition_data(isymbol, osymbol, weight)
54 typename C::WeightType weight,
56 target_state(s), transition_data(inumber, onumber, weight)
61 target_state(another.target_state),
62 transition_data(another.transition_data)
67 bool operator<(const HfstTransition<C> &another)
const {
68 if (target_state == another.target_state)
69 return (transition_data < another.transition_data);
70 return (target_state < another.target_state);
76 target_state = another.target_state;
77 transition_data = another.transition_data;
87 return transition_data;
92 return transition_data.get_input_symbol();
97 return transition_data.get_output_symbol();
101 unsigned int get_input_number()
const {
102 return transition_data.get_input_number();
106 unsigned int get_output_number()
const {
107 return transition_data.get_output_number();
112 return transition_data.get_weight();
115 friend class ComposeIntersectFst;
116 friend class ComposeIntersectLexicon;
117 friend class ComposeIntersectRule;
118 friend class ComposeIntersectRulePair;
127 typedef HfstTransition<HfstTropicalTransducerTransitionData>
142 #endif // _HFST_TRANSITION_H_
C::SymbolType get_output_symbol() const
Get the output symbol of the transition.
Definition: HfstTransition.h:96
C::SymbolType get_input_symbol() const
Get the input symbol of the transition.
Definition: HfstTransition.h:91
unsigned int HfstState
The number of a state in an HfstTransitionGraph.
Definition: HfstDataTypes.h:120
HfstTransition< HfstFastTransitionData > HfstFastTransition
An HfstTransition with transition data of type HfstFastTransitionData.
Definition: HfstDataTypes.h:126
HfstState get_target_state() const
Get the target state of the transition.
Definition: HfstTransition.h:81
HfstTransition(HfstState s, typename C::SymbolType isymbol, typename C::SymbolType osymbol, typename C::WeightType weight)
Create a transition leading to state s with input symbol isymbol, output_symbol osymbol and weight we...
Definition: HfstTransition.h:44
const C & get_transition_data() const
Get the transition data of the transition.
Definition: HfstTransition.h:86
HfstTransition< HfstTropicalTransducerTransitionData > HfstBasicTransition
An HfstTransition with transition data of type HfstTropicalTransducerTransitionData.
Definition: HfstDataTypes.h:122
C::WeightType get_weight() const
Get the weight of the transition.
Definition: HfstTransition.h:111
A transition that consists of a target state and transition data represented by class C...
Definition: HfstDataTypes.h:122
HfstTransition()
Create a transition leading to state zero with input and output symbols and weight as given by defaul...
Definition: HfstTransition.h:39
HfstTransition(const HfstTransition< C > &another)
Create a deep copy of transition another.
Definition: HfstTransition.h:60
void operator=(const HfstTransition< C > &another)
Assign this transition the same value as transition another.
Definition: HfstTransition.h:75