• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

Analitza

  • Analitza
  • Analyzer
Public Member Functions | List of all members
Analitza::Analyzer Class Reference
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 ( )

Constructor.

Creates an empty Analyzer module with a Variables module.

Analitza::Analyzer::Analyzer ( Variables *  v)

Constructor.

Creates an empty Analyzer module.

Parameters
vSets a custom variables module. This module will not be deleted along with Analyzer
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().

double Analitza::Analyzer::derivative ( const QVector< Object * > &  values)

Evaluates the derivative of an expression expression.

QStringList Analitza::Analyzer::errors ( ) const
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.

const Expression& Analitza::Analyzer::expression ( ) const
inline

Returns the expression in display.

Definition at line 80 of file analyzer.h.

void Analitza::Analyzer::flushErrors ( )
inline

Empties the error list.

Definition at line 104 of file analyzer.h.

bool Analitza::Analyzer::hasDependencies ( ) const
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.

Cn* Analitza::Analyzer::insertValueVariable ( const QString &  name,
double  value 
)

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.
bool Analitza::Analyzer::insertVariable ( const QString &  name,
const Object *  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.
bool Analitza::Analyzer::isCorrect ( ) const
inline

Returns whether there has been a problem in the last calculation.

Definition at line 101 of file analyzer.h.

QVector<Object*> Analitza::Analyzer::runStack ( ) const
inline

Definition at line 152 of file analyzer.h.

void Analitza::Analyzer::setExpression ( const Expression &  e)

Sets an expression to calculate.

void Analitza::Analyzer::setStack ( const QVector< Object * > &  stack)
inline

Definition at line 150 of file analyzer.h.

void Analitza::Analyzer::simplify ( )

simplifies the expression.

ExpressionType Analitza::Analyzer::type ( ) const
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.

Variables* Analitza::Analyzer::variables ( ) const
inline
Returns
Returns a way to query variables.

Definition at line 113 of file analyzer.h.

QMap<QString, ExpressionType> Analitza::Analyzer::variableTypes ( ) const
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:
  • analyzer.h
This file is part of the KDE documentation.
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.

Analitza

Skip menu "Analitza"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal