00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGORITHMS_INTERNAL_HAS_NEIGHBOUR_HXX
00018 # define VCSN_ALGORITHMS_INTERNAL_HAS_NEIGHBOUR_HXX
00019
00020 # include <vaucanson/algorithms/internal/has_neighbour.hh>
00021
00022 namespace vcsn {
00023
00024 namespace internal {
00025 template <typename T>
00026 struct has_neighbour_helper
00027 {
00028 has_neighbour_helper () : has_neighbour_ (false) {}
00029 bool operator() (typename automaton_traits<T>::htransition_t)
00030 {
00031 this->has_neighbour_ = true;
00032
00033 return false;
00034 }
00035 bool has_neighbour_;
00036 };
00037 }
00038
00039 template<typename A, typename T>
00040 bool has_successors(const Element<A, T>& a,
00041 const typename automaton_traits<T>::hstate_t s)
00042 {
00043 precondition (a.has_state (s));
00044 internal::has_neighbour_helper<T> functor;
00045 a.deltaf (functor, s, delta_kind::transitions());
00046 return functor.has_neighbour_;
00047 }
00048
00049 template<typename A, typename T>
00050 bool has_predecessors(const Element<A, T>& a,
00051 const typename automaton_traits<T>::hstate_t s)
00052 {
00053 precondition (a.has_state (s));
00054 internal::has_neighbour_helper<T> functor;
00055 a.rdeltaf (functor, s, delta_kind::transitions());
00056 return functor.has_neighbour_;
00057 }
00058 }
00059
00060 #endif // ! VCSN_ALGORITHMS_INTERNAL_HAS_NEIGHBOUR_HXX