MathTypeLibrary(libmath++)  0.0.3
Public Types | Static Public Member Functions | List of all members
math::TMatcher< T > Class Template Reference

#include <matcher.h>

Inheritance diagram for math::TMatcher< T >:
Inheritance graph
[legend]
Collaboration diagram for math::TMatcher< T >:
Collaboration graph
[legend]

Public Types

typedef std::map< std::string,
TNode< T > > 
TResult

Static Public Member Functions

static bool matchExact (const TMatch< T > *AMatch, const TNode< T > *AExpr, TMatchRegistry< T > *AReg=0)
static bool match (const TMatch< T > *AMatch, const TNode< T > *AExpr, TMatchRegistry< T > *AReg=0)
static unsigned match (const std::string &AMatch, const TNode< T > *AExpr, TResult &AResult)

Additional Inherited Members

- Public Member Functions inherited from math::TNodeVisitor< T >
virtual void visit (TNumberNode< T > *)=0
virtual void visit (TSymbolNode< T > *)=0
virtual void visit (TParamNode< T > *)=0
virtual void visit (TPlusNode< T > *)=0
virtual void visit (TNegNode< T > *)=0
virtual void visit (TMulNode< T > *)=0
virtual void visit (TDivNode< T > *)=0
virtual void visit (TPowNode< T > *)=0
virtual void visit (TSqrtNode< T > *)=0
virtual void visit (TSinNode< T > *)=0
virtual void visit (TCosNode< T > *)=0
virtual void visit (TTanNode< T > *)=0
virtual void visit (TLnNode< T > *)=0
virtual void visit (TFuncNode< T > *)=0
virtual void visit (TIfNode< T > *)=0
virtual void visit (TEquNode< T > *)=0
virtual void visit (TUnEquNode< T > *)=0
virtual void visit (TGreaterNode< T > *)=0
virtual void visit (TLessNode< T > *)=0
virtual void visit (TGreaterEquNode< T > *)=0
virtual void visit (TLessEquNode< T > *)=0

Detailed Description

template<class T>
class math::TMatcher< T >

TMatcher<> is a dynamic matching system for symbolic expressions. One application for that is simplifying expressions.

TMatcher<> class is really to be done. But it will rock then. Example:

  TMatcher<T>::TResult matchResult;
  if (TMatcher<T>::match("a+a", expr, machResult))
      return transform(expr, machResult, "2*a+$");

the "$" means the remaining part not matched using given template match, here "a+a". Example: if you've a+b+a and want match a+a, then the remaining part is b; if you've a^2+b^(sin(2x)+2)+c^2+c*2*a and want to match a^2+2ab+b^2, then the matched parts is: "a^2+c^2+c*2*a" and the remaining part will be: "b^(sin(2x)+2)".

Definition at line 176 of file matcher.h.

Member Function Documentation

template<class T >
static bool math::TMatcher< T >::match ( const TMatch< T > *  AMatch,
const TNode< T > *  AExpr,
TMatchRegistry< T > *  AReg = 0 
)
static

returns true when given pattern (AMatch) was matched in given expression (AExpr). The result data is stored into the registry on success only.

template<class T >
static unsigned math::TMatcher< T >::match ( const std::string &  AMatch,
const TNode< T > *  AExpr,
TResult &  AResult 
)
static

match matches a given expression template on expression AExpr and puts its result into AResult.

template<class T >
static bool math::TMatcher< T >::matchExact ( const TMatch< T > *  AMatch,
const TNode< T > *  AExpr,
TMatchRegistry< T > *  AReg = 0 
)
static

matchExact returns true when the template (AMatch) represents exactly the test expression (AExpr).


The documentation for this class was generated from the following file: