sum.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 //  Copyright (c) 2006 by Rafael Ostertag
00004 //
00005 //  This program is free software; you can redistribute it and/or modify
00006 //  it under the terms of the GNU General Public License as published by
00007 //  the Free Software Foundation; either version 2 of the License, or
00008 //  (at your option) any later version.
00009 //
00010 //  This program is distributed in the hope that it will be useful,
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //  GNU General Public License for more details.
00014 //
00015 //  You should have received a copy of the GNU General Public License
00016 //  along with this program; if not, write to the Free Software
00017 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 //
00019 //
00020 // $Id: sum.h,v 1.17 2006/12/28 19:01:25 rafi Exp $
00021 //
00022 
00032 #ifndef _SUM_H
00033 #define _SUM_H
00034 
00035 #ifdef HAVE_CONFIG_H
00036 #include "config.h"
00037 #endif
00038 
00039 #include <vector>
00040 
00041 #include "castemplates.h"
00042 #include "casterm.h"
00043 #include "casgarbage.h"
00044 
00060 class Sum : public CASTerm {
00061     private:
00065         CASObject* CollectEqualOperands() const;
00069         CASObject* CollectSingleValues() const;
00073         CASObject* CollectNonSingleValues() const;
00077         Sum* WithExponentOne() const;
00078 
00079     public:
00083         Sum();
00087         Sum ( const Sum &s );
00091         ~Sum();
00095         CASObject* Clone() const;
00104         inline CASType GetType() const {
00105             return CT_SUM;
00106         };
00110         void Get ( std::string &s ) const;
00114         void Get ( char *s, unsigned long size ) const;
00118         void Print() const;
00122         unsigned long Length() const;
00126         bool IsZero() const;
00130         bool IsOne() const;
00135         bool IsSimilar ( const CASObject *o ) const;
00139         CASObject* Absolute() const;
00143         void AbsoluteIP();
00147         CASObject* Invert() const;
00151         void InvertIP();
00155         CASObject* Add ( const CASObject* addend ) const;
00159         CASObject* Subtract ( const CASObject* subtrahend ) const;
00163         CASObject* Multiply ( const CASObject* factor ) const;
00167         CASObject* Divide ( const CASObject* divisor ) const;
00171         CASObject* Modulo ( const CASObject* divisor ) const;
00175         CASObject* GCD ( const CASObject* o ) const;
00179         CASObject* Evaluate() const;
00183         CASObject* Collect() const;
00187         CASObject* Expand() const;
00191         void RemoveNoOpElements();
00195         const Sum& operator= ( const Sum &s );
00196 
00203         friend void resolve_parentheses<Sum> ( CASObject* );
00210         friend void evaluate_operands<Sum> ( Sum* );
00217         friend void expand_operands<Sum> ( Sum* );
00224         friend class CASConvert;
00225 };
00226 
00231 #endif /* _SUM_H */

Generated on Sun Dec 31 01:57:27 2006 for ECAS by  doxygen 1.4.7