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     struct has_neighbour_helper
00026     {
00027       has_neighbour_helper () : has_neighbour_ (false) {}
00028       bool operator() (htransition_t)
00029       {
00030         this->has_neighbour_ = true;
00031         
00032         return false;
00033       }
00034       bool has_neighbour_;
00035     };
00036   }
00037 
00038   template<typename A, typename T>
00039   bool  has_successors(const Element<A, T>& a,
00040                        const hstate_t s)
00041   {
00042     precondition (a.has_state (s));
00043     internal::has_neighbour_helper functor;
00044     a.deltaf (functor, s, delta_kind::transitions());
00045     return functor.has_neighbour_;
00046   }
00047 
00048   template<typename A, typename T>
00049   bool  has_predecessors(const Element<A, T>& a,
00050                          const hstate_t s)
00051   {
00052     precondition (a.has_state (s));
00053     internal::has_neighbour_helper functor;
00054     a.rdeltaf (functor, s, delta_kind::transitions());
00055     return functor.has_neighbour_;
00056   }
00057 } 
00058 
00059 #endif // ! VCSN_ALGORITHMS_INTERNAL_HAS_NEIGHBOUR_HXX