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

kig

  • sources
  • kde-4.12
  • kdeedu
  • kig
  • misc
equation.h
Go to the documentation of this file.
1 // Copyright (C) 2005 Pino Toscano <toscano.pino@tiscali.it>
2 
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 // 02110-1301, USA.
17 
18 #ifndef KIG_EQUATION_H
19 #define KIG_EQUATION_H
20 
21 #include <qstring.h>
22 
33 // * Use the addTerm() method to add a term to the equation, and removeTerm() to
34 // * remove one. After that, use prettyString() to get the equation written in a
35 // * nice form.
36 // *
37 // * \note
38 // * If you want to use only the \em x variable, you can unspecify the last
39 // * parameters in the term manipulation methods, like addTerm(), term() and
40 // * removeTerm().
41 // *
42 // * @author Pino Toscano
43 // */
44 
45  /*
46  * What follows is based on code by Maurizio Paolini
47  */
48 
49 class EquationString
50  : public QString
51 {
52 public:
53  EquationString( const QString& string );
54  double trunc( double );
55  void prettify( void );
56  void addTerm( double coeff, const QString& unknowns, bool& needsign );
57 
58  const QString x3() const;
59  const QString y3() const;
60  const QString x2y() const;
61  const QString xy2() const;
62  const QString x2() const;
63  const QString y2() const;
64  const QString xy() const;
65  const QString x() const;
66  const QString y() const;
67  const QString xnym(int n, int m) const;
68 };
69 
70 //class Equation
71 //{
72 //public:
73 // /**
74 // * Constructs a new empty equation.
75 // */
76 // Equation();
77 //
78 // /**
79 // * Adds a new term to the equation. Use \p xpower and \p ypower to specify
80 // * the power of the relative variables. For example, if you would add
81 // * \f$-5xy^2 \f$ to the equation, then do:
82 // * \code
83 // * Equation eq;
84 // * // other code ...
85 // * eq.addTerm( -5, 1, 2 );
86 // * \endcode
87 // * \param coeff is the coefficient of the new term
88 // * \param xpower is the power of the \em x variable
89 // * \param ypower is the power of the \em y variable
90 // */
91 // void addTerm( double coeff, int xpower, int ypower = 0 );
92 // /**
93 // * Removes the term with coefficients \p xpower and \p ypower for the
94 // * equations.
95 // * \param xpower is the power of the \em x variable
96 // * \param ypower is the power of the \em y variable
97 // */
98 // void removeTerm( int xpower, int ypower = 0 );
99 // /**
100 // * Gives the value of the coefficient of the term with coefficients
101 // * \p xpower and \p ypower .
102 // * \param value will contain the value of the found term, or 0 if not found
103 // * \param xpower is the power of the \em x variable
104 // * \param ypower is the power of the \em y variable
105 // * \return true or false whether the term was found
106 // */
107 // bool term( double& value, int xpower, int ypower = 0 );
108 //
109 // /**
110 // * Removes all the term of the equation.
111 // */
112 // void clear();
113 //
114 // /**
115 // * Set whether to show a second member for the equation, like \f$... = 0 \f$.
116 // * Note that the second member contents can be only a numeric value.
117 // * \param show whether to show the second member
118 // */
119 // void setSecondMemberShown( bool show );
120 // bool isSecondMemberShown() const;
121 // /**
122 // * Sets \p value as the value for the second member. It is displayed only if
123 // * you activated it using setShowSecondMember().
124 // * The default value for the second member is 0 (zero).
125 // */
126 // void setSecondMemberValue( double value );
127 // double secondMemberValue() const;
128 //
129 // /**
130 // * Returns a string with the current equation written in a nice form.
131 // * \param with_spaces specifies whether expand a bit the equation with spaces
132 // */
133 // QString prettyString( bool with_spaces = false ) const;
134 //
135 //private:
136 // class Private;
137 // Private* d;
138 //};
139 //
140 #endif
EquationString::y
const QString y() const
Definition: equation.cc:110
EquationString::xy2
const QString xy2() const
Definition: equation.cc:85
EquationString::x3
const QString x3() const
Definition: equation.cc:70
EquationString
Simple class that represents an equation.
Definition: equation.h:49
EquationString::xy
const QString xy() const
Definition: equation.cc:100
EquationString::x
const QString x() const
Definition: equation.cc:105
EquationString::addTerm
void addTerm(double coeff, const QString &unknowns, bool &needsign)
Definition: equation.cc:41
EquationString::y2
const QString y2() const
Definition: equation.cc:95
EquationString::x2
const QString x2() const
Definition: equation.cc:90
EquationString::xnym
const QString xnym(int n, int m) const
Definition: equation.cc:123
EquationString::x2y
const QString x2y() const
Definition: equation.cc:80
EquationString::y3
const QString y3() const
Definition: equation.cc:75
EquationString::EquationString
EquationString(const QString &string)
Definition: equation.cc:30
EquationString::prettify
void prettify(void)
Definition: equation.cc:117
EquationString::trunc
double trunc(double)
Definition: equation.cc:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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