[gnome-calculator] GCalc: renamed Result to MathResult
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] GCalc: renamed Result to MathResult
- Date: Thu, 17 Oct 2019 19:09:33 +0000 (UTC)
commit f35f086f6f3deba78171a2f1a5885eeb9b188a0b
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Oct 17 12:36:12 2019 -0500
GCalc: renamed Result to MathResult
gcalc/gcalc-assign.vala | 4 ++--
gcalc/gcalc-constant.vala | 2 +-
gcalc/gcalc-equation.vala | 4 ++--
gcalc/gcalc-error-result.vala | 2 +-
gcalc/gcalc-expression.vala | 2 +-
gcalc/gcalc-function-acos.vala | 4 ++--
gcalc/gcalc-function-acosh.vala | 4 ++--
gcalc/gcalc-function-asin.vala | 4 ++--
gcalc/gcalc-function-asinh.vala | 4 ++--
gcalc/gcalc-function-atan.vala | 4 ++--
gcalc/gcalc-function-atanh.vala | 4 ++--
gcalc/gcalc-function-cos.vala | 4 ++--
gcalc/gcalc-function-cosh.vala | 4 ++--
gcalc/gcalc-function-exp.vala | 4 ++--
gcalc/gcalc-function-log.vala | 4 ++--
gcalc/gcalc-function-sin.vala | 4 ++--
gcalc/gcalc-function-sinh.vala | 4 ++--
gcalc/gcalc-function-sqrt.vala | 4 ++--
gcalc/gcalc-function-tan.vala | 4 ++--
gcalc/gcalc-function-tanh.vala | 4 ++--
gcalc/gcalc-gresult.vala | 2 +-
gcalc/gcalc-gsolver.vala | 4 ++--
gcalc/gcalc-gterm.vala | 6 +++---
gcalc/gcalc-math-error-result.vala | 2 +-
gcalc/gcalc-math-expression.vala | 4 ++--
gcalc/{gcalc-result.vala => gcalc-math-result.vala} | 4 ++--
gcalc/gcalc-polynomial.vala | 6 +++---
gcalc/gcalc-solver.vala | 2 +-
gcalc/meson.build | 2 +-
29 files changed, 53 insertions(+), 53 deletions(-)
---
diff --git a/gcalc/gcalc-assign.vala b/gcalc/gcalc-assign.vala
index 06620f9a..d1cf6ed1 100644
--- a/gcalc/gcalc-assign.vala
+++ b/gcalc/gcalc-assign.vala
@@ -33,8 +33,8 @@ public class GCalc.Assign : Expression, MathOperator, MathBinaryOperator, MathAs
}
return v.to_string ()+"="+e.to_string ();
}
- internal override Result solve () {
- Result res = null;
+ internal override MathResult solve () {
+ MathResult res = null;
try {
res = new GResult (evaluate ());
} catch (GLib.Error e) {
diff --git a/gcalc/gcalc-constant.vala b/gcalc/gcalc-constant.vala
index b346c985..fd2199d4 100644
--- a/gcalc/gcalc-constant.vala
+++ b/gcalc/gcalc-constant.vala
@@ -120,7 +120,7 @@ public class GCalc.Constant : Expression, MathConstant {
return "%g".printf (real ());
}
- internal override Result solve () {
+ internal override MathResult solve () {
return new GResult (this);
}
}
diff --git a/gcalc/gcalc-equation.vala b/gcalc/gcalc-equation.vala
index 33c6cd22..f212bcd3 100644
--- a/gcalc/gcalc-equation.vala
+++ b/gcalc/gcalc-equation.vala
@@ -21,8 +21,8 @@
public class GCalc.Equation : Expression, MathEquation {
ExpressionHashMap _variables = new ExpressionHashMap ();
internal ExpressionHashMap variables { get { return _variables; } }
- internal override Result solve () {
- Result res = null;
+ internal override MathResult solve () {
+ MathResult res = null;
if (expressions.get_n_items () == 0) {
return new ErrorResult ("No expressions found in equation");
}
diff --git a/gcalc/gcalc-error-result.vala b/gcalc/gcalc-error-result.vala
index 70cbc02f..6ca23eb3 100644
--- a/gcalc/gcalc-error-result.vala
+++ b/gcalc/gcalc-error-result.vala
@@ -21,7 +21,7 @@
/**
* An implementation of {@link MathErrorResult}
*/
-public class GCalc.ErrorResult : Object, Result, MathErrorResult {
+public class GCalc.ErrorResult : Object, MathResult, MathErrorResult {
private string msg = "";
private MathExpression _expression;
diff --git a/gcalc/gcalc-expression.vala b/gcalc/gcalc-expression.vala
index 764ebbe9..a3b9547f 100644
--- a/gcalc/gcalc-expression.vala
+++ b/gcalc/gcalc-expression.vala
@@ -33,7 +33,7 @@ public class GCalc.Expression : Object, MathExpression {
}
return s;
}
- internal virtual Result solve () {
+ internal virtual MathResult solve () {
return new ErrorResult ("Invalid expression");
}
}
diff --git a/gcalc/gcalc-function-acos.vala b/gcalc/gcalc-function-acos.vala
index d7eb4dbb..12ed3d7b 100644
--- a/gcalc/gcalc-function-acos.vala
+++ b/gcalc/gcalc-function-acos.vala
@@ -41,8 +41,8 @@ public class GCalc.FunctionAcos : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-acosh.vala b/gcalc/gcalc-function-acosh.vala
index a2bc04b7..70a00726 100644
--- a/gcalc/gcalc-function-acosh.vala
+++ b/gcalc/gcalc-function-acosh.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionAcosh : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-asin.vala b/gcalc/gcalc-function-asin.vala
index e8781834..114af807 100644
--- a/gcalc/gcalc-function-asin.vala
+++ b/gcalc/gcalc-function-asin.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionAsin : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-asinh.vala b/gcalc/gcalc-function-asinh.vala
index c0c1e0d9..c6361976 100644
--- a/gcalc/gcalc-function-asinh.vala
+++ b/gcalc/gcalc-function-asinh.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionAsinh : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-atan.vala b/gcalc/gcalc-function-atan.vala
index 390dfc9d..0e8ab4d4 100644
--- a/gcalc/gcalc-function-atan.vala
+++ b/gcalc/gcalc-function-atan.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionAtan : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-atanh.vala b/gcalc/gcalc-function-atanh.vala
index dce3f3ab..add4848e 100644
--- a/gcalc/gcalc-function-atanh.vala
+++ b/gcalc/gcalc-function-atanh.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionAtanh : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-cos.vala b/gcalc/gcalc-function-cos.vala
index 14958181..d1e3db1f 100644
--- a/gcalc/gcalc-function-cos.vala
+++ b/gcalc/gcalc-function-cos.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionCos : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-cosh.vala b/gcalc/gcalc-function-cosh.vala
index 6a4275a4..33483ce1 100644
--- a/gcalc/gcalc-function-cosh.vala
+++ b/gcalc/gcalc-function-cosh.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionCosh : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-exp.vala b/gcalc/gcalc-function-exp.vala
index a0d4da46..8474b6ea 100644
--- a/gcalc/gcalc-function-exp.vala
+++ b/gcalc/gcalc-function-exp.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionExp : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-log.vala b/gcalc/gcalc-function-log.vala
index d5479908..e33f892d 100644
--- a/gcalc/gcalc-function-log.vala
+++ b/gcalc/gcalc-function-log.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionLog : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-sin.vala b/gcalc/gcalc-function-sin.vala
index 0ebb4b3f..c0d033e7 100644
--- a/gcalc/gcalc-function-sin.vala
+++ b/gcalc/gcalc-function-sin.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionSin : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-sinh.vala b/gcalc/gcalc-function-sinh.vala
index 30dff1f8..e7dcc9e8 100644
--- a/gcalc/gcalc-function-sinh.vala
+++ b/gcalc/gcalc-function-sinh.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionSinh : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-sqrt.vala b/gcalc/gcalc-function-sqrt.vala
index 8567a663..fd904628 100644
--- a/gcalc/gcalc-function-sqrt.vala
+++ b/gcalc/gcalc-function-sqrt.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionSqrt : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-tan.vala b/gcalc/gcalc-function-tan.vala
index bb533b4b..3555e216 100644
--- a/gcalc/gcalc-function-tan.vala
+++ b/gcalc/gcalc-function-tan.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionTan : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-function-tanh.vala b/gcalc/gcalc-function-tanh.vala
index 82e45c14..189fcafd 100644
--- a/gcalc/gcalc-function-tanh.vala
+++ b/gcalc/gcalc-function-tanh.vala
@@ -38,8 +38,8 @@ public class GCalc.FunctionTanh : Function {
if (ev is ErrorResult) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
}
- if (ev is Result) {
- c = ((Result) ev).expression as Constant;
+ if (ev is MathResult) {
+ c = ((MathResult) ev).expression as Constant;
}
if (c == null) {
throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
diff --git a/gcalc/gcalc-gresult.vala b/gcalc/gcalc-gresult.vala
index 75e7a43a..2c1b2cc6 100644
--- a/gcalc/gcalc-gresult.vala
+++ b/gcalc/gcalc-gresult.vala
@@ -18,7 +18,7 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public class GCalc.GResult : Object, Result {
+public class GCalc.GResult : Object, MathResult {
private MathExpression _expression;
public GResult (MathExpression exp) {
_expression = exp;
diff --git a/gcalc/gcalc-gsolver.vala b/gcalc/gcalc-gsolver.vala
index e0fc117d..8b2cd89f 100644
--- a/gcalc/gcalc-gsolver.vala
+++ b/gcalc/gcalc-gsolver.vala
@@ -26,9 +26,9 @@ public class GCalc.GSolver : Object, Solver {
}
// Sover
internal MathEquationManager equation_manager { get; set; }
- internal Result solve (string str) throws GLib.Error {
+ internal MathResult solve (string str) throws GLib.Error {
var p = new Parser ();
- Result res;
+ MathResult res;
try {
p.parse (str, equation_manager);
if (equation_manager.equations.get_n_items () == 0) {
diff --git a/gcalc/gcalc-gterm.vala b/gcalc/gcalc-gterm.vala
index 599a114d..c5300092 100644
--- a/gcalc/gcalc-gterm.vala
+++ b/gcalc/gcalc-gterm.vala
@@ -19,11 +19,11 @@
* Daniel Espinosa <esodan gmail com>
*/
public class GCalc.GTerm : Expression, Term {
- internal override Result solve () {
- Result res = null;
+ internal override MathResult solve () {
+ MathResult res = null;
try {
var e = evaluate ();
- res = new GResult (e) as Result;
+ res = new GResult (e) as MathResult;
} catch (GLib.Error err) {
res = new ErrorResult ("Term evaluation fails: %s".printf (err.message));
}
diff --git a/gcalc/gcalc-math-error-result.vala b/gcalc/gcalc-math-error-result.vala
index 0c93bab0..f8fe2db4 100644
--- a/gcalc/gcalc-math-error-result.vala
+++ b/gcalc/gcalc-math-error-result.vala
@@ -21,7 +21,7 @@
/**
* A kind of result returned when there was an error in a solving operation
*/
-public interface GCalc.MathErrorResult : Object, Result {
+public interface GCalc.MathErrorResult : Object, MathResult {
public abstract string message { get; }
}
diff --git a/gcalc/gcalc-math-expression.vala b/gcalc/gcalc-math-expression.vala
index 05ba3229..988ad31e 100644
--- a/gcalc/gcalc-math-expression.vala
+++ b/gcalc/gcalc-math-expression.vala
@@ -35,9 +35,9 @@ public interface GCalc.MathExpression : Object {
*/
public abstract string to_string ();
/**
- * Solves the expression and returning a {@link Result}
+ * Solves the expression and returning a {@link MathResult}
*/
- public abstract Result solve ();
+ public abstract MathResult solve ();
}
public interface GCalc.ErrorExpression : Object, MathExpression {
diff --git a/gcalc/gcalc-result.vala b/gcalc/gcalc-math-result.vala
similarity index 92%
rename from gcalc/gcalc-result.vala
rename to gcalc/gcalc-math-result.vala
index 6f8837d8..d76832f1 100644
--- a/gcalc/gcalc-result.vala
+++ b/gcalc/gcalc-math-result.vala
@@ -1,4 +1,4 @@
-/* gcalc-result.vala
+/* gcalc-math-result.vala
*
* Copyright (C) 2018 Daniel Espinosa <esodan gmail com>
*
@@ -18,7 +18,7 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Result : Object {
+public interface GCalc.MathResult : Object {
public abstract string to_string ();
public abstract MathExpression expression { get; }
}
diff --git a/gcalc/gcalc-polynomial.vala b/gcalc/gcalc-polynomial.vala
index b012b343..f7f6e2d3 100644
--- a/gcalc/gcalc-polynomial.vala
+++ b/gcalc/gcalc-polynomial.vala
@@ -19,11 +19,11 @@
* Daniel Espinosa <esodan gmail com>
*/
public class GCalc.Polynomial : Expression, MathPolynomial {
- internal override Result solve () {
- Result res = null;
+ internal override MathResult solve () {
+ MathResult res = null;
try {
var e = evaluate ();
- res = new GResult (e) as Result;
+ res = new GResult (e) as MathResult;
} catch (GLib.Error err) {
res = new ErrorResult ("Polynomial solving fails: %s".printf (err.message));
}
diff --git a/gcalc/gcalc-solver.vala b/gcalc/gcalc-solver.vala
index 49d7bff6..7dff5078 100644
--- a/gcalc/gcalc-solver.vala
+++ b/gcalc/gcalc-solver.vala
@@ -20,7 +20,7 @@
*/
public interface GCalc.Solver : Object {
public abstract MathEquationManager equation_manager { get; set; }
- public abstract Result solve (string str) throws GLib.Error;
+ public abstract MathResult solve (string str) throws GLib.Error;
}
public errordomain GCalc.SolverError {
diff --git a/gcalc/meson.build b/gcalc/meson.build
index 7e2be147..4f259035 100644
--- a/gcalc/meson.build
+++ b/gcalc/meson.build
@@ -104,6 +104,7 @@ gcalc_sources = files([
'gcalc-math-plus.vala',
'gcalc-math-polynomial.vala',
'gcalc-math-pow.vala',
+ 'gcalc-math-result.vala',
'gcalc-minus.vala',
'gcalc-multiply.vala',
'gcalc-parameter.vala',
@@ -111,7 +112,6 @@ gcalc_sources = files([
'gcalc-plus.vala',
'gcalc-polynomial.vala',
'gcalc-pow.vala',
- 'gcalc-result.vala',
'gcalc-solver.vala',
'gcalc-term.vala',
'gcalc-variable.vala',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]