Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

simplifier.h

00001 00002 // Math Type Library 00003 // $Id: simplifier.h,v 1.6 2002/04/29 19:34:30 cparpart Exp $ 00004 // (This file contains the expression simplifier interface) 00005 // 00006 // Copyright (c) 2002 by Christian Parpart <cparpart@surakware.net> 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public License 00019 // along with this library; see the file COPYING.LIB. If not, write to 00020 // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00021 // Boston, MA 02111-1307, USA. 00023 #ifndef libmath_simplifier_h 00024 #define libmath_simplifier_h 00025 00026 #include <math++/visitor.h> 00027 00028 namespace math { 00029 00033 template<typename T> 00034 class TSimplifier : public TNodeVisitor<T> { 00035 public: 00037 static TNode<T> *simplify(const TNode<T> *AExpression); 00038 00039 private: 00040 TNode<T> *FResult; 00041 00042 private: 00043 TSimplifier(); 00044 00046 T calculate(const TNode<T> *) const; 00047 00048 virtual void visit(TNumberNode<T> *); 00049 virtual void visit(TSymbolNode<T> *); 00050 virtual void visit(TParamNode<T> *); 00051 00052 virtual void visit(TPlusNode<T> *); 00053 virtual void visit(TNegNode<T> *); 00054 00055 virtual void visit(TMulNode<T> *); 00056 virtual void visit(TDivNode<T> *); 00057 00058 virtual void visit(TPowNode<T> *); 00059 virtual void visit(TSqrtNode<T> *); 00060 00061 virtual void visit(TSinNode<T> *); 00062 virtual void visit(TCosNode<T> *); 00063 virtual void visit(TTanNode<T> *); 00064 virtual void visit(TLnNode<T> *); 00065 00066 virtual void visit(TFuncNode<T> *); 00067 virtual void visit(TIfNode<T> *); 00068 00069 virtual void visit(TEquNode<T> *); 00070 virtual void visit(TUnEquNode<T> *); 00071 virtual void visit(TGreaterNode<T> *); 00072 virtual void visit(TLessNode<T> *); 00073 virtual void visit(TGreaterEquNode<T> *); 00074 virtual void visit(TLessEquNode<T> *); 00075 }; 00076 00077 } // namespace math 00078 00079 #include <math++/simplifier.tcc> 00080 00081 #endif

Generated on Thu Jul 29 08:56:44 2004 for MathTypeLibrary(libmath++) by doxygen 1.3.7