Analitza
#include <analyzer.h>
Public Member Functions | |
Analyzer () | |
Analyzer (Variables *v) | |
Analyzer (const Analyzer &a) | |
~Analyzer () | |
BuiltinMethods * | builtinMethods () |
Expression | calculate () |
Expression | calculateLambda () |
Expression | dependenciesToLambda () const |
Expression | derivative (const QString &var) |
double | derivative (const QVector< Object * > &values) |
QStringList | errors () const |
Expression | evaluate () |
const Expression & | expression () const |
void | flushErrors () |
bool | hasDependencies () const |
void | importScript (QTextStream *stream) |
Cn * | insertValueVariable (const QString &name, double value) |
bool | insertVariable (const QString &name, const Expression &value) |
bool | insertVariable (const QString &name, const Object *value) |
bool | isCorrect () const |
QVector< Object * > | runStack () const |
void | setExpression (const Expression &e) |
void | setStack (const QVector< Object * > &stack) |
void | simplify () |
ExpressionType | type () const |
Variables * | variables () const |
QMap< QString, ExpressionType > | variableTypes () const |
Detailed Description
The parser: Evaluates and calculates math expressions.
Is the base Math class, Analyzer can evaluate simple expressions, expressions that contains any number of variables and lambda expressions.
If Analyzer is created with a custom Variables module, then calculate() or evaluate() will be aware of the variables inside the module.
Definition at line 59 of file analyzer.h.
Constructor & Destructor Documentation
Analitza::Analyzer::Analyzer | ( | ) |
Analitza::Analyzer::Analyzer | ( | Variables * | v | ) |
Analitza::Analyzer::Analyzer | ( | const Analyzer & | a | ) |
Copy constructor.
Creates a copy of the a
Analyzer instance. Inherits its Variable structure.
Analitza::Analyzer::~Analyzer | ( | ) |
Destructor.
Member Function Documentation
BuiltinMethods* Analitza::Analyzer::builtinMethods | ( | ) |
Expression Analitza::Analyzer::calculate | ( | ) |
Calculates the expression and returns a value alone.
Expression Analitza::Analyzer::calculateLambda | ( | ) |
Calculates the expression and returns a value alone.
The parameters need to be set by passing a stack instance
Expression Analitza::Analyzer::dependenciesToLambda | ( | ) | const |
This method is useful if you want to work programatically on functions with undefined variables.
- Returns
- the same expression set but with explicit dependencies.
e.g. x+2 would return x->x+2
Expression Analitza::Analyzer::derivative | ( | const QString & | var | ) |
Evaluates the derivative of an expression expression, like expression() but sorrounded with a diff().
Evaluates the derivative of an expression expression.
|
inline |
- Returns
- Return an error list.
Definition at line 110 of file analyzer.h.
Expression Analitza::Analyzer::evaluate | ( | ) |
Evaluates an expression, like calculate() but returns a tree.
|
inline |
Returns the expression in display.
Definition at line 80 of file analyzer.h.
|
inline |
Empties the error list.
Definition at line 104 of file analyzer.h.
|
inline |
Returns whether the current expression has all data it needs to be calculated.
Definition at line 136 of file analyzer.h.
void Analitza::Analyzer::importScript | ( | QTextStream * | stream | ) |
Makes it possible to easily enter a bunch of code to execute it.
Adds a variable entry named name
with value
value.
- Returns
- Returns the added object
bool Analitza::Analyzer::insertVariable | ( | const QString & | name, |
const Expression & | value | ||
) |
Adds a variable entry.
It is the proper way to do it because tracks some possible errors. May change the error in case we're trying to represent something wrong.
- Returns
- Returns if it was actually inserted.
Adds a variable entry.
It is the proper way to do it because tracks some possible errors. May change the error in case we're trying to represent something wrong.
- Returns
- Returns if it was actually inserted.
|
inline |
Returns whether there has been a problem in the last calculation.
Definition at line 101 of file analyzer.h.
Definition at line 152 of file analyzer.h.
void Analitza::Analyzer::setExpression | ( | const Expression & | e | ) |
Sets an expression to calculate.
Definition at line 150 of file analyzer.h.
void Analitza::Analyzer::simplify | ( | ) |
simplifies the expression.
|
inline |
This method lets you retrieve the current type in use.
- Returns
- the type of the current expression.
Definition at line 148 of file analyzer.h.
|
inline |
- Returns
- Returns a way to query variables.
Definition at line 113 of file analyzer.h.
|
inline |
- Returns
- the type for any variable that depends on the last executed procedure
Definition at line 160 of file analyzer.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:37 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.