]> www.ginac.de Git - ginac.git/blobdiff - ginac/function.pl
- first implementation of pattern matching
[ginac.git] / ginac / function.pl
index a08d35f11f507d61e963048e9d8a329f989aa5c2..b0564e6e45f105422029acccdf6c108a95323979 100755 (executable)
@@ -344,6 +344,7 @@ public:
        ex evalf(int level=0) const;
        unsigned calchash(void) const;
        ex series(const relational & r, int order, unsigned options = 0) const;
+       bool match(const ex & pattern, lst & repl_lst) const;
        ex thisexprseq(const exvector & v) const;
        ex thisexprseq(exvector * vp) const;
 protected:
@@ -801,6 +802,14 @@ ${series_switch_statement}
        throw(std::logic_error("function::series(): invalid nparams"));
 }
 
+bool function::match(const ex & pattern, lst & repl_lst) const
+{
+       // Serial number must match
+       if (is_ex_of_type(pattern, function) && serial != ex_to_function(pattern).serial)
+               return false;
+       return inherited::match(pattern, repl_lst);
+}
+
 // protected