[gnome-calculator] GCalc: document parameters use at MathEquationManager
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] GCalc: document parameters use at MathEquationManager
- Date: Thu, 17 Oct 2019 19:10:39 +0000 (UTC)
commit 6d40bf3ddd50494688d8a836c122e70db220ba4a
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Oct 17 14:04:29 2019 -0500
GCalc: document parameters use at MathEquationManager
Fix issue #124
gcalc/gcalc-math-equation-manager.vala | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
---
diff --git a/gcalc/gcalc-math-equation-manager.vala b/gcalc/gcalc-math-equation-manager.vala
index 47810dd6..dede74d7 100644
--- a/gcalc/gcalc-math-equation-manager.vala
+++ b/gcalc/gcalc-math-equation-manager.vala
@@ -52,10 +52,35 @@
* // Result will be 1605
* stdout.printf ("%g", c.real ());
* }}}
+ *
+ * Is possible to define parameters instead of {@link MathVariable}. To do so,
+ * fine them at parsing time, then you can get it to change its value, to
+ * evaluate the dependant equation.
+ * {{{
+ * var parser = new Parser ();
+ * var eqman = new EquationManager ();
+ * parser.parse ("$param1*5", eqman);
+ * var eq = eqman.equations.get_item (1) as MathEquation;
+ * var p = eqman.variable.find_named ("param1");
+ * p.set_value (5.0);
+ * var res = eq.solve ();
+ * var c = (MathConstant) res;
+ * // Result will be 25
+ * stdout.printf ("%g", c.real ());
+ * }}}
*/
public interface GCalc.MathEquationManager : Object {
+ /**
+ * Set of equations. They can be related or not.
+ */
public abstract ExpressionContainer equations { get; }
+ /**
+ * Set of functions defined to be possibily used in equations.
+ */
public abstract ExpressionContainer functions { get; }
+ /**
+ * Set of variables or parameters defined in the set of equations.
+ */
public virtual MathVariable find_variable (string name) {
MathVariable res = null;
foreach (MathExpression e in equations) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]