|
MathTypeLibrary(libmath++) 0.0.3
|
#include <matcher.h>


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) |
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)".
| 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.
| 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.
| 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).
1.7.4