]> www.ginac.de Git - ginac.git/blobdiff - ginac/ncmul.cpp
- removed debugging code in match()
[ginac.git] / ginac / ncmul.cpp
index 12c1d5e41fcf799eae4485967196222989a282a1..8a0cc1220311d5eb7c0070fb76dd552e1ba28813 100644 (file)
@@ -28,6 +28,7 @@
 #include "ex.h"
 #include "add.h"
 #include "mul.h"
+#include "print.h"
 #include "archive.h"
 #include "debugmsg.h"
 #include "utils.h"
@@ -112,36 +113,28 @@ DEFAULT_ARCHIVING(ncmul)
 
 // public
 
-void ncmul::print(std::ostream & os, unsigned upper_precedence) const
+void ncmul::print(const print_context & c, unsigned level) const
 {
-       debugmsg("ncmul print",LOGLEVEL_PRINT);
-       printseq(os,'(','*',')',precedence,upper_precedence);
-}
+       debugmsg("ncmul print", LOGLEVEL_PRINT);
 
-void ncmul::printraw(std::ostream & os) const
-{
-       debugmsg("ncmul printraw",LOGLEVEL_PRINT);
-       os << "ncmul(";
-       for (exvector::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
-               (*it).bp->printraw(os);
-               os << ",";
-       }
-       os << ",hash=" << hashvalue << ",flags=" << flags;
-       os << ")";
-}
+       if (is_of_type(c, print_tree)) {
 
-void ncmul::printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const
-{
-       debugmsg("ncmul print csrc",LOGLEVEL_PRINT);
-       exvector::const_iterator it;
-       exvector::const_iterator itend = seq.end()-1;
-       os << "ncmul(";
-       for (it=seq.begin(); it!=itend; ++it) {
-               (*it).bp->printcsrc(os,precedence);
-               os << ",";
-       }
-       (*it).bp->printcsrc(os,precedence);
-       os << ")";
+               inherited::print(c, level);
+
+       } else if (is_of_type(c, print_csrc)) {
+
+               c.s << "ncmul(";
+               exvector::const_iterator it = seq.begin(), itend = seq.end()-1;
+               while (it != itend) {
+                       it->print(c, precedence());
+                       c.s << ",";
+                       it++;
+               }
+               it->print(c, precedence());
+               c.s << ")";
+
+       } else
+               printseq(c, '(', '*', ')', precedence(), level);
 }
 
 bool ncmul::info(unsigned inf) const
@@ -218,7 +211,7 @@ ex ncmul::expand(unsigned options) const
                                                                                status_flags::expanded);
 }
 
-int ncmul::degree(const symbol & s) const
+int ncmul::degree(const ex & s) const
 {
        int deg_sum=0;
        for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
@@ -227,7 +220,7 @@ int ncmul::degree(const symbol & s) const
        return deg_sum;
 }
 
-int ncmul::ldegree(const symbol & s) const
+int ncmul::ldegree(const ex & s) const
 {
        int deg_sum=0;
        for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
@@ -236,7 +229,7 @@ int ncmul::ldegree(const symbol & s) const
        return deg_sum;
 }
 
-ex ncmul::coeff(const symbol & s, int n) const
+ex ncmul::coeff(const ex & s, int n) const
 {
        exvector coeffseq;
        coeffseq.reserve(seq.size());
@@ -439,11 +432,6 @@ ex ncmul::eval(int level) const
                                                                                  status_flags::evaluated);
 }
 
-ex ncmul::subs(const lst & ls, const lst & lr) const
-{
-       return ncmul(subschildren(ls, lr));
-}
-
 ex ncmul::thisexprseq(const exvector & v) const
 {
        return (new ncmul(v))->setflag(status_flags::dynallocated);
@@ -542,14 +530,6 @@ const exvector & ncmul::get_factors(void) const
        return seq;
 }
 
-//////////
-// static member variables
-//////////
-
-// protected
-
-unsigned ncmul::precedence = 50;
-
 //////////
 // friend functions
 //////////