* Implementation of GiNaC's ABC. */
/*
- * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2006 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <iostream>
* the pattern itself or one of the children 'has' it. As a consequence
* (according to the definition of children) given e=x+y+z, e.has(x) is true
* but e.has(x+y) is false. */
-bool basic::has(const ex & pattern) const
+bool basic::has(const ex & pattern, unsigned options) const
{
lst repl_lst;
if (match(pattern, repl_lst))
return true;
for (size_t i=0; i<nops(); i++)
- if (op(i).has(pattern))
+ if (op(i).has(pattern, options))
return true;
return false;
exmap::const_iterator it;
if (options & subs_options::no_pattern) {
- it = m.find(*this);
+ ex thisex = *this;
+ it = m.find(thisex);
if (it != m.end())
return it->second;
+ return thisex;
} else {
for (it = m.begin(); it != m.end(); ++it) {
lst repl_lst;
return return_types::commutative;
}
-unsigned basic::return_type_tinfo() const
+const basic* basic::return_type_tinfo() const
{
- return tinfo();
+ return this;
}
/** Compute the hash value of an object and if it makes sense to store it in
* would all end up with the same hashvalue. */
unsigned basic::calchash() const
{
- unsigned v = golden_ratio_hash(tinfo());
+ unsigned v = golden_ratio_hash((p_int)tinfo());
for (size_t i=0; i<nops(); i++) {
v = rotate_left(v);
v ^= this->op(i).gethash();
compare_statistics.compare_same_hashvalue++;
#endif
- const unsigned typeid_this = tinfo();
- const unsigned typeid_other = other.tinfo();
+ const tinfo_t typeid_this = tinfo();
+ const tinfo_t typeid_other = other.tinfo();
if (typeid_this==typeid_other) {
GINAC_ASSERT(typeid(*this)==typeid(other));
// int cmpval = compare_same_type(other);