17 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HXX
18 # define VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HXX
20 # include <vaucanson/algebra/concept/letter.hh>
21 # include <vaucanson/algebra/implementation/alphabets/decorated_alphabet.hh>
27 template <
typename L,
typename T>
28 AlphabetDecorator<L, T>::~AlphabetDecorator()
34 template <
typename L,
typename T>
35 AlphabetDecorator<L, T>::AlphabetDecorator()
38 joker_ = letter_traits<L>::default_joker;
39 other_ = letter_traits<L>::default_other;
40 alphabet_owner_ =
true;
43 template <
typename L,
typename T>
44 AlphabetDecorator<L, T>::AlphabetDecorator(alphabet_impl_t& alphabet) :
47 alphabet_owner_ =
false;
48 if (std::find(alphabet.begin(), alphabet.end(),
49 letter_traits<L>::default_joker())
51 joker_ = letter_traits<L>::default_joker();
54 joker_ = letter_traits<L>::default_joker();
57 if (joker_ == letter_traits<L>::default_joker())
59 std::cerr <<
"Did not find a valid 'joker' ! Exiting !"
63 }
while (std::find(alphabet.begin(), alphabet.end(),
64 joker_) != alphabet.end());
66 if (std::find(alphabet.begin(), alphabet.end(),
67 letter_traits<L>::default_other())
69 other_ = letter_traits<L>::default_other();
72 other_ = letter_traits<L>::default_other();
75 if (other_ == letter_traits<L>::default_other())
77 std::cerr <<
"Did not find a valid 'other' ! Exiting !"
81 }
while (std::find(alphabet.begin(), alphabet.end(),
82 other_) != alphabet.end());
86 template <
typename L,
typename T>
88 AlphabetDecorator<L, T>::insert(L l)
94 template <
typename L,
typename T>
96 AlphabetDecorator<L, T>::size()
const
98 return alphabet().size();
101 template <
typename L,
typename T>
102 typename AlphabetDecorator<L, T>::iterator
103 AlphabetDecorator<L, T>::begin()
105 return alphabet().begin();
108 template <
typename L,
typename T>
109 typename AlphabetDecorator<L, T>::iterator
110 AlphabetDecorator<L, T>::end()
112 return alphabet().end();
115 template <
typename L,
typename T>
116 typename AlphabetDecorator<L, T>::const_iterator
117 AlphabetDecorator<L, T>::begin()
const
119 return alphabet().begin();
122 template <
typename L,
typename T>
123 typename AlphabetDecorator<L, T>::const_iterator
124 AlphabetDecorator<L, T>::end()
const
126 return alphabet().end();
129 template <
typename L,
typename T>
130 const T& AlphabetDecorator<L, T>::alphabet()
const
135 template <
typename L,
typename T>
136 T& AlphabetDecorator<L, T>::alphabet()
141 template <
typename L,
typename T>
142 L AlphabetDecorator<L, T>::joker()
const
147 template <
typename L,
typename T>
148 L AlphabetDecorator<L, T>::other()
const
154 template <
typename L,
typename T>
158 return this->value().joker();
161 template <
typename L,
typename T>
165 return this->value().other();
175 template <
typename L,
typename T>
182 template <
typename L,
typename T>
183 bool op_is_finite(
const algebra::AlphabetSet<L>& s,
184 const algebra::AlphabetDecorator<L, T>& a)
189 template <
typename L,
typename T>
190 bool op_contains_e(
const algebra::AlphabetSet<L>& s,
191 const algebra::AlphabetDecorator<L, T>& a,
198 return Element<algebra::AlphabetSet<L>, T>(s, a.alphabet()).contains(v);
201 template <
typename T,
typename L>
203 const algebra::AlphabetDecorator<L, T>& a,
207 Element<algebra::AlphabetSet<L>,
208 algebra::AlphabetDecorator<L, T> > e(s, a);
209 if (lhs == a.joker())
210 return e.contains(rhs);
211 if (rhs == a.joker())
212 return e.contains(lhs);
213 if (lhs == a.other())
214 return ! e.contains(rhs);
215 if (rhs == a.other())
216 return ! e.contains(lhs);
224 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HXX