seq_operators.h

00001 /*
00002  *  Copyright (C) 2005 M.J. Zaki <zaki@cs.rpi.edu> Rensselaer Polytechnic Institute
00003  *  Written by parimi@cs.rpi.edu
00004  *  Updated by chaojv@cs.rpi.edu, alhasan@cs.rpi.edu, salems@cs.rpi.edu
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; either version 2
00009  *  of the License, or (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 #ifndef _SEQ_OPERATORS_H_
00021 #define _SEQ_OPERATORS_H_
00022 
00023 template<class PP, class MP, class PAT_ST, template<typename, typename, typename, template <typename> class > class CC, 
00024          template <typename> class ALLOC >
00025 void update_rmost_path(SEQ_PATTERN*const& cand_pat) {}
00026 
00027 template<class PP, class MP, class PAT_ST, template<typename, typename, typename, template <typename> class > class CC, 
00028          template <typename> class ALLOC >
00029 ostream& operator<< (ostream& ostr, const SEQ_PATTERN* p) {
00030 
00031 
00032    typename SEQ_PATTERN::CONST_IT it;
00033    for(it=p->begin(); it!=p->end(); it++) {
00034      if(it == p->begin()) {
00035         ostr << (*it).v;
00036      } else {
00037         ostr << " -> " << (*it).v;
00038      }
00039   } 
00040   ostr<< " -- "<<p->_pat_sup;
00041 
00042   return ostr;
00043 }
00044 
00045 #include "pattern.h"
00046 
00047 template<class T, class MP, class ST, template<class, typename, typename, template <typename> class > class CC, 
00048          template <typename> class ALLOC >
00049 bool pattern<T, MP, ST, CC, ALLOC>::operator< (const pattern<T, MP, ST, CC, ALLOC> rhs) const {
00050 
00051    CONST_IT it=begin(), rhs_it=rhs.begin();
00052 
00053    if(size()!=rhs.size()) {
00054       cerr<<"Sequences are not of the same size."<<endl;
00055       exit(0);
00056    }
00057 
00058    while(it!=end() && rhs_it!=rhs.end()) {
00059      if((*it).v != (*rhs_it).v)
00060        return (*it) < (*rhs_it);
00061 
00062      it++;
00063      rhs_it++;
00064    }//end outer while
00065   
00066    //if execuion reaches this point then sequences are equal
00067    return false;
00068 }
00069 
00070 #endif

Generated on Wed Jul 26 14:01:08 2006 for DMTL by  doxygen 1.4.7