[gnome-calculator] GCalc: renamed Expression to MathExpression
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] GCalc: renamed Expression to MathExpression
- Date: Thu, 17 Oct 2019 19:06:56 +0000 (UTC)
commit 3cae7fba414162cfe8be34a2109bdd8084fb5729
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Oct 17 10:07:30 2019 -0500
GCalc: renamed Expression to MathExpression
gcalc/gcalc-assign.vala | 4 ++--
gcalc/gcalc-binary-operator.vala | 2 +-
gcalc/gcalc-constant.vala | 2 +-
gcalc/gcalc-division.vala | 2 +-
gcalc/gcalc-expression-container.vala | 20 ++++++++++----------
gcalc/gcalc-expression-hash-map.vala | 10 +++++-----
gcalc/gcalc-function-acos.vala | 8 ++++----
gcalc/gcalc-function-acosh.vala | 8 ++++----
gcalc/gcalc-function-asin.vala | 8 ++++----
gcalc/gcalc-function-asinh.vala | 8 ++++----
gcalc/gcalc-function-atan.vala | 8 ++++----
gcalc/gcalc-function-atanh.vala | 8 ++++----
gcalc/gcalc-function-cos.vala | 8 ++++----
gcalc/gcalc-function-cosh.vala | 8 ++++----
gcalc/gcalc-function-exp.vala | 8 ++++----
gcalc/gcalc-function-log.vala | 8 ++++----
gcalc/gcalc-function-sin.vala | 8 ++++----
gcalc/gcalc-function-sinh.vala | 8 ++++----
gcalc/gcalc-function-sqrt.vala | 8 ++++----
gcalc/gcalc-function-tan.vala | 8 ++++----
gcalc/gcalc-function-tanh.vala | 8 ++++----
gcalc/gcalc-function.vala | 8 ++++----
gcalc/gcalc-gassign.vala | 2 +-
gcalc/gcalc-gerror-result.vala | 4 ++--
gcalc/gcalc-gexpression.vala | 6 +++---
gcalc/gcalc-gfunction.vala | 4 ++--
gcalc/gcalc-ggroup.vala | 2 +-
gcalc/gcalc-gmath-equation.vala | 2 +-
gcalc/gcalc-gparser.vala | 16 ++++++++--------
gcalc/gcalc-gresult.vala | 6 +++---
gcalc/gcalc-group.vala | 4 ++--
gcalc/gcalc-math-equation-manager.vala | 2 +-
gcalc/gcalc-math-equation.vala | 2 +-
...lc-expression.vala => gcalc-math-expression.vala} | 6 +++---
gcalc/gcalc-minus.vala | 2 +-
gcalc/gcalc-multiply.vala | 2 +-
gcalc/gcalc-operator.vala | 2 +-
gcalc/gcalc-parameter.vala | 4 ++--
gcalc/gcalc-plus.vala | 2 +-
gcalc/gcalc-polynomial.vala | 6 +++---
gcalc/gcalc-pow.vala | 2 +-
gcalc/gcalc-result.vala | 2 +-
gcalc/gcalc-term.vala | 16 ++++++++--------
gcalc/gcalc-variable.vala | 6 +++---
gcalc/meson.build | 2 +-
45 files changed, 135 insertions(+), 135 deletions(-)
---
diff --git a/gcalc/gcalc-assign.vala b/gcalc/gcalc-assign.vala
index 11d9dba3..5a461ff9 100644
--- a/gcalc/gcalc-assign.vala
+++ b/gcalc/gcalc-assign.vala
@@ -18,8 +18,8 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Assign : Object, Expression, Operator, BinaryOperator {
- public Expression evaluate () throws GLib.Error {
+public interface GCalc.Assign : Object, MathExpression, Operator, BinaryOperator {
+ public MathExpression evaluate () throws GLib.Error {
if (expressions.get_n_items () != 2) {
throw new AssigError.INVALID_STRUCTURE_ERROR ("Invalid number of expressions in assign");
}
diff --git a/gcalc/gcalc-binary-operator.vala b/gcalc/gcalc-binary-operator.vala
index 4541fac6..b133a29a 100644
--- a/gcalc/gcalc-binary-operator.vala
+++ b/gcalc/gcalc-binary-operator.vala
@@ -18,5 +18,5 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.BinaryOperator : Object, Expression, Operator {}
+public interface GCalc.BinaryOperator : Object, MathExpression, Operator {}
diff --git a/gcalc/gcalc-constant.vala b/gcalc/gcalc-constant.vala
index e830b4d3..d95884f7 100644
--- a/gcalc/gcalc-constant.vala
+++ b/gcalc/gcalc-constant.vala
@@ -18,7 +18,7 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Constant : Object, Expression {
+public interface GCalc.Constant : Object, MathExpression {
public abstract double real ();
public abstract double imag ();
public abstract void zero ();
diff --git a/gcalc/gcalc-division.vala b/gcalc/gcalc-division.vala
index 68d29bee..fab3cb5b 100644
--- a/gcalc/gcalc-division.vala
+++ b/gcalc/gcalc-division.vala
@@ -18,5 +18,5 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Division : Object, Expression, Operator, BinaryOperator {}
+public interface GCalc.Division : Object, MathExpression, Operator, BinaryOperator {}
diff --git a/gcalc/gcalc-expression-container.vala b/gcalc/gcalc-expression-container.vala
index 83336b3c..a3e82c1e 100644
--- a/gcalc/gcalc-expression-container.vala
+++ b/gcalc/gcalc-expression-container.vala
@@ -18,17 +18,17 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public class GCalc.ExpressionContainer : Gee.ArrayList<Expression>, GLib.ListModel {
- public weak Expression parent { get; set; }
+public class GCalc.ExpressionContainer : Gee.ArrayList<MathExpression>, GLib.ListModel {
+ public weak MathExpression parent { get; set; }
// Gee.AbstractCollection
- public override bool add (Expression exp) {
+ public override bool add (MathExpression exp) {
var r = base.add (exp);
exp.parent = parent;
return r;
}
- public override Expression remove_at (int index) {
+ public override MathExpression remove_at (int index) {
var r = base.remove_at (index);
if (r != null) {
r.parent = null;
@@ -36,7 +36,7 @@ public class GCalc.ExpressionContainer : Gee.ArrayList<Expression>, GLib.ListMod
return r;
}
- public override bool remove (Expression exp) {
+ public override bool remove (MathExpression exp) {
var r = base.remove (exp);
if (r) {
exp.parent = null;
@@ -50,7 +50,7 @@ public class GCalc.ExpressionContainer : Gee.ArrayList<Expression>, GLib.ListMod
}
public Type get_item_type () {
- return typeof (Expression);
+ return typeof (MathExpression);
}
public uint get_n_items () {
@@ -61,12 +61,12 @@ public class GCalc.ExpressionContainer : Gee.ArrayList<Expression>, GLib.ListMod
return get_item (position);
}
- public Expression? find (Expression exp) {
+ public MathExpression? find (MathExpression exp) {
unowned Variable? variable = exp as Variable;
if (variable == null) {
return null;
}
- foreach (Expression e in this) {
+ foreach (MathExpression e in this) {
if (e is Variable && ((Variable) e).name == variable.name) {
return e;
}
@@ -74,8 +74,8 @@ public class GCalc.ExpressionContainer : Gee.ArrayList<Expression>, GLib.ListMod
return null;
}
- public Expression? find_named (string name) {
- foreach (Expression e in this) {
+ public MathExpression? find_named (string name) {
+ foreach (MathExpression e in this) {
if (e is Variable && ((Variable) e).name == name) {
return e;
}
diff --git a/gcalc/gcalc-expression-hash-map.vala b/gcalc/gcalc-expression-hash-map.vala
index 913562e9..9b93c9cf 100644
--- a/gcalc/gcalc-expression-hash-map.vala
+++ b/gcalc/gcalc-expression-hash-map.vala
@@ -18,21 +18,21 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public class GCalc.ExpressionHashMap : Gee.HashMap<uint,Expression> {
- public weak Expression parent { get; set; }
+public class GCalc.ExpressionHashMap : Gee.HashMap<uint,MathExpression> {
+ public weak MathExpression parent { get; set; }
- public void add (Expression exp)
+ public void add (MathExpression exp)
requires (exp is Hashable)
{
@set (((Hashable) exp).hash (), exp);
exp.parent = parent;
}
- public void remove (Expression exp) {
+ public void remove (MathExpression exp) {
unset (((Hashable) exp).hash ());
}
- public Expression? find_named (string name) {
+ public MathExpression? find_named (string name) {
return @get (name.hash ());
}
}
diff --git a/gcalc/gcalc-function-acos.vala b/gcalc/gcalc-function-acos.vala
index 24828a36..af14d78e 100644
--- a/gcalc/gcalc-function-acos.vala
+++ b/gcalc/gcalc-function-acos.vala
@@ -29,13 +29,13 @@ public class GCalc.GFunctionAcos : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -52,7 +52,7 @@ public class GCalc.GFunctionAcos : GFunction {
var res = MPC.Complex (1000);
res.acos (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-acosh.vala b/gcalc/gcalc-function-acosh.vala
index 7e5af3a5..c7832c1c 100644
--- a/gcalc/gcalc-function-acosh.vala
+++ b/gcalc/gcalc-function-acosh.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionAcosh : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionAcosh : GFunction {
var res = MPC.Complex (1000);
res.acosh (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-asin.vala b/gcalc/gcalc-function-asin.vala
index 62f88948..c10471ec 100644
--- a/gcalc/gcalc-function-asin.vala
+++ b/gcalc/gcalc-function-asin.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionAsin : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionAsin : GFunction {
var res = MPC.Complex (1000);
res.asin (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-asinh.vala b/gcalc/gcalc-function-asinh.vala
index 6e81ca55..8b54dcbf 100644
--- a/gcalc/gcalc-function-asinh.vala
+++ b/gcalc/gcalc-function-asinh.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionAsinh : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionAsinh : GFunction {
var res = MPC.Complex (1000);
res.asinh (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-atan.vala b/gcalc/gcalc-function-atan.vala
index 53f97f50..ff57b432 100644
--- a/gcalc/gcalc-function-atan.vala
+++ b/gcalc/gcalc-function-atan.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionAtan : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionAtan : GFunction {
var res = MPC.Complex (1000);
res.atan (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-atanh.vala b/gcalc/gcalc-function-atanh.vala
index 8c95f933..1055f798 100644
--- a/gcalc/gcalc-function-atanh.vala
+++ b/gcalc/gcalc-function-atanh.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionAtanh : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionAtanh : GFunction {
var res = MPC.Complex (1000);
res.atanh (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-cos.vala b/gcalc/gcalc-function-cos.vala
index 43cb6c81..bc21fd80 100644
--- a/gcalc/gcalc-function-cos.vala
+++ b/gcalc/gcalc-function-cos.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionCos : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionCos : GFunction {
var res = MPC.Complex (1000);
res.cos (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-cosh.vala b/gcalc/gcalc-function-cosh.vala
index 75b33c92..34f9d551 100644
--- a/gcalc/gcalc-function-cosh.vala
+++ b/gcalc/gcalc-function-cosh.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionCosh : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionCosh : GFunction {
var res = MPC.Complex (1000);
res.cosh (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-exp.vala b/gcalc/gcalc-function-exp.vala
index 9367f214..e6f24d45 100644
--- a/gcalc/gcalc-function-exp.vala
+++ b/gcalc/gcalc-function-exp.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionExp : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionExp : GFunction {
var res = MPC.Complex (1000);
res.exp (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-log.vala b/gcalc/gcalc-function-log.vala
index 413606d7..85f96c6f 100644
--- a/gcalc/gcalc-function-log.vala
+++ b/gcalc/gcalc-function-log.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionLog : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionLog : GFunction {
var res = MPC.Complex (1000);
res.log (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-sin.vala b/gcalc/gcalc-function-sin.vala
index 2a716462..9eb79be5 100644
--- a/gcalc/gcalc-function-sin.vala
+++ b/gcalc/gcalc-function-sin.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionSin : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionSin : GFunction {
var res = MPC.Complex (1000);
res.sin (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-sinh.vala b/gcalc/gcalc-function-sinh.vala
index 3380bc19..2fd0e445 100644
--- a/gcalc/gcalc-function-sinh.vala
+++ b/gcalc/gcalc-function-sinh.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionSinh : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionSinh : GFunction {
var res = MPC.Complex (1000);
res.sinh (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-sqrt.vala b/gcalc/gcalc-function-sqrt.vala
index c4fa63b3..a811ce7a 100644
--- a/gcalc/gcalc-function-sqrt.vala
+++ b/gcalc/gcalc-function-sqrt.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionSqrt : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionSqrt : GFunction {
var res = MPC.Complex (1000);
res.sqrt (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-tan.vala b/gcalc/gcalc-function-tan.vala
index e5021e2d..df150034 100644
--- a/gcalc/gcalc-function-tan.vala
+++ b/gcalc/gcalc-function-tan.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionTan : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionTan : GFunction {
var res = MPC.Complex (1000);
res.tan (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function-tanh.vala b/gcalc/gcalc-function-tanh.vala
index ae862f83..ebe91385 100644
--- a/gcalc/gcalc-function-tanh.vala
+++ b/gcalc/gcalc-function-tanh.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionTanh : GFunction {
param_types.add (new GConstant ());
}
- internal override Expression evaluate () throws GLib.Error
+ internal override MathExpression evaluate () throws GLib.Error
{
verify_params ();
GConstant c = null;
- var exp = expressions.get_item (0) as Expression;
+ var exp = expressions.get_item (0) as MathExpression;
if (exp == null) {
- throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(Expression).name ());
+ throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s",
typeof(MathExpression).name ());
}
var ev = exp.solve ();
if (ev is ErrorResult) {
@@ -49,7 +49,7 @@ public class GCalc.GFunctionTanh : GFunction {
var res = MPC.Complex (1000);
res.tanh (p1);
var nc = new GConstant.internal_complex (res);
- return nc as Expression;
+ return nc as MathExpression;
}
}
diff --git a/gcalc/gcalc-function.vala b/gcalc/gcalc-function.vala
index 995ff582..923219ea 100644
--- a/gcalc/gcalc-function.vala
+++ b/gcalc/gcalc-function.vala
@@ -19,9 +19,9 @@
* Daniel Espinosa <esodan gmail com>
*/
/**
- * A Function as part of a {@link Expression}
+ * A Function as part of a {@link MathExpression}
*/
-public interface GCalc.Function : Object, Expression {
+public interface GCalc.Function : Object, MathExpression {
/**
* Parameters used by the function, objects representing
* the expected types. See {@link verify_params}
@@ -42,11 +42,11 @@ public interface GCalc.Function : Object, Expression {
*/
public abstract bool closed { get; set; }
/**
- * Evaluate the function returning a resulting {@link Expression}.
+ * Evaluate the function returning a resulting {@link MathExpression}.
*
* In some cases return is a {@link Constant}
*/
- public abstract Expression evaluate () throws GLib.Error;
+ public abstract MathExpression evaluate () throws GLib.Error;
/**
* Check the paratemeters given to the function agains {@link param_types}
* and number of parameters using {@link n_params}
diff --git a/gcalc/gcalc-gassign.vala b/gcalc/gcalc-gassign.vala
index cf222dd1..654bc540 100644
--- a/gcalc/gcalc-gassign.vala
+++ b/gcalc/gcalc-gassign.vala
@@ -27,7 +27,7 @@ public class GCalc.GAssign : GExpression, Operator, BinaryOperator, Assign {
if (v == null) {
return "Invalid Assigment structure. No variable is set";
}
- var e = expressions.get_item (1) as Expression;
+ var e = expressions.get_item (1) as MathExpression;
if (e == null) {
return "Invalid Assigment structure. No variable's definition is set";
}
diff --git a/gcalc/gcalc-gerror-result.vala b/gcalc/gcalc-gerror-result.vala
index 9cb43886..92b9bd53 100644
--- a/gcalc/gcalc-gerror-result.vala
+++ b/gcalc/gcalc-gerror-result.vala
@@ -20,14 +20,14 @@
*/
public class GCalc.GErrorResult : Object, Result, ErrorResult {
private string msg = "";
- private Expression _expression;
+ private MathExpression _expression;
public GErrorResult (string msg) {
this.msg = msg;
_expression = new GErrorExpression ();
}
// Result
- public Expression expression { get { return _expression; } }
+ public MathExpression expression { get { return _expression; } }
public string to_string () { return msg; }
// ErrorResult
public string message { get { return msg; } }
diff --git a/gcalc/gcalc-gexpression.vala b/gcalc/gcalc-gexpression.vala
index 51b3f395..54d7423e 100644
--- a/gcalc/gcalc-gexpression.vala
+++ b/gcalc/gcalc-gexpression.vala
@@ -18,17 +18,17 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public class GCalc.GExpression : Object, Expression {
+public class GCalc.GExpression : Object, MathExpression {
ExpressionContainer exps = new ExpressionContainer ();
construct {
exps.parent = this;
}
// Expression
- internal weak Expression parent { get; set; }
+ internal weak MathExpression parent { get; set; }
internal ExpressionContainer expressions { get { return exps; } }
internal virtual string to_string () {
string s = "";
- foreach (Expression e in expressions) {
+ foreach (MathExpression e in expressions) {
s += e.to_string ();
}
return s;
diff --git a/gcalc/gcalc-gfunction.vala b/gcalc/gcalc-gfunction.vala
index 22fa1675..c9508b5f 100644
--- a/gcalc/gcalc-gfunction.vala
+++ b/gcalc/gcalc-gfunction.vala
@@ -36,7 +36,7 @@ public class GCalc.GFunction : GExpression, Function, Hashable {
internal override string to_string () {
string s = name + "(";
for (uint i = 0; i < expressions.get_n_items (); i++) {
- var e = expressions.get_item (i) as Expression;
+ var e = expressions.get_item (i) as MathExpression;
if (e == null) {
continue;
}
@@ -49,7 +49,7 @@ public class GCalc.GFunction : GExpression, Function, Hashable {
return s;
}
- internal virtual Expression evaluate () throws GLib.Error {
+ internal virtual MathExpression evaluate () throws GLib.Error {
return new GErrorExpression ();
}
// Hashable
diff --git a/gcalc/gcalc-ggroup.vala b/gcalc/gcalc-ggroup.vala
index 14f8d64b..ad38ba86 100644
--- a/gcalc/gcalc-ggroup.vala
+++ b/gcalc/gcalc-ggroup.vala
@@ -34,7 +34,7 @@ public class GCalc.GGroup : GExpression, Group {
s = "{";
break;
}
- foreach (Expression e in expressions) {
+ foreach (MathExpression e in expressions) {
s += e.to_string ();
}
switch (level) {
diff --git a/gcalc/gcalc-gmath-equation.vala b/gcalc/gcalc-gmath-equation.vala
index 48749743..316fe7b5 100644
--- a/gcalc/gcalc-gmath-equation.vala
+++ b/gcalc/gcalc-gmath-equation.vala
@@ -26,7 +26,7 @@ public class GCalc.GMathEquation : GExpression, MathEquation {
if (expressions.get_n_items () == 0) {
return new GErrorResult ("No expressions found in equation");
}
- var e = expressions.get_item (0) as Expression;
+ var e = expressions.get_item (0) as MathExpression;
if (e == null) {
res = new GErrorResult ("Invalid expression in equation");
} else {
diff --git a/gcalc/gcalc-gparser.vala b/gcalc/gcalc-gparser.vala
index 9c95d685..8e38d8b1 100644
--- a/gcalc/gcalc-gparser.vala
+++ b/gcalc/gcalc-gparser.vala
@@ -19,13 +19,13 @@
* Daniel Espinosa <esodan gmail com>
*/
/**
- * Takes a string an create a tree of {@link Expression} objects representing
+ * Takes a string an create a tree of {@link MathExpression} objects representing
* a math equation.
*/
public class GCalc.GParser : Object {
- Expression current = null;
- Expression current_parent = null;
- Expression top_parent = null;
+ MathExpression current = null;
+ MathExpression current_parent = null;
+ MathExpression top_parent = null;
bool enable_parameter = false;
Gee.ArrayList<TokenType> expected = new Gee.ArrayList<TokenType> ();
GLib.Scanner scanner;
@@ -68,9 +68,9 @@ public class GCalc.GParser : Object {
}
switch (token) {
case TokenType.IDENTIFIER:
- Expression sfunc = eqman.functions.find_named (n);
+ MathExpression sfunc = eqman.functions.find_named (n);
if (sfunc != null) {
- sfunc = Object.new (sfunc.get_type ()) as Expression;
+ sfunc = Object.new (sfunc.get_type ()) as MathExpression;
if (current == null) {
var exp = new GPolynomial ();
eq.expressions.add (exp);
@@ -98,9 +98,9 @@ public class GCalc.GParser : Object {
} else if (n.down () == "def" && current is Function) {
throw new ParserError.INVALID_TOKEN_ERROR ("Found an unexpected function definition expression");
} else {
- var v = new GVariable (n) as Expression;
+ var v = new GVariable (n) as MathExpression;
if (enable_parameter) {
- v = new GParameter (n) as Expression;
+ v = new GParameter (n) as MathExpression;
enable_parameter = false;
}
var sv = eqman.find_variable (n) as Variable;
diff --git a/gcalc/gcalc-gresult.vala b/gcalc/gcalc-gresult.vala
index 64c8af96..75e7a43a 100644
--- a/gcalc/gcalc-gresult.vala
+++ b/gcalc/gcalc-gresult.vala
@@ -19,14 +19,14 @@
* Daniel Espinosa <esodan gmail com>
*/
public class GCalc.GResult : Object, Result {
- private Expression _expression;
- public GResult (Expression exp) {
+ private MathExpression _expression;
+ public GResult (MathExpression exp) {
_expression = exp;
}
// Result
internal string to_string () {
return expression.to_string ();
}
- internal Expression expression { get { return _expression; } }
+ internal MathExpression expression { get { return _expression; } }
}
diff --git a/gcalc/gcalc-group.vala b/gcalc/gcalc-group.vala
index cfe4c994..3205d933 100644
--- a/gcalc/gcalc-group.vala
+++ b/gcalc/gcalc-group.vala
@@ -18,7 +18,7 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Group : Object, Expression {
+public interface GCalc.Group : Object, MathExpression {
public enum Level {
ONE,
TWO,
@@ -26,7 +26,7 @@ public interface GCalc.Group : Object, Expression {
}
public abstract Level level { get; set; }
public abstract bool closed { get; set; }
- public virtual Expression evaluate () throws GLib.Error {
+ public virtual MathExpression evaluate () throws GLib.Error {
if (expressions.get_n_items () == 0) {
throw new GroupError.INVALID_POLYNOMIAL ("No internal polynomial in group");
}
diff --git a/gcalc/gcalc-math-equation-manager.vala b/gcalc/gcalc-math-equation-manager.vala
index 5bc076cd..1aabc884 100644
--- a/gcalc/gcalc-math-equation-manager.vala
+++ b/gcalc/gcalc-math-equation-manager.vala
@@ -23,7 +23,7 @@ public interface GCalc.MathEquationManager : Object {
public abstract ExpressionContainer functions { get; }
public virtual Variable find_variable (string name) {
Variable res = null;
- foreach (Expression e in equations) {
+ foreach (MathExpression e in equations) {
var eq = e as MathEquation;
if (e == null) {
continue;
diff --git a/gcalc/gcalc-math-equation.vala b/gcalc/gcalc-math-equation.vala
index f76a3032..a89ad46f 100644
--- a/gcalc/gcalc-math-equation.vala
+++ b/gcalc/gcalc-math-equation.vala
@@ -18,7 +18,7 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.MathEquation : Object, Expression {
+public interface GCalc.MathEquation : Object, MathExpression {
public abstract ExpressionHashMap variables { get; }
}
diff --git a/gcalc/gcalc-expression.vala b/gcalc/gcalc-math-expression.vala
similarity index 87%
rename from gcalc/gcalc-expression.vala
rename to gcalc/gcalc-math-expression.vala
index b83315db..de54d19b 100644
--- a/gcalc/gcalc-expression.vala
+++ b/gcalc/gcalc-math-expression.vala
@@ -21,11 +21,11 @@
/**
* A part of a math equation
*/
-public interface GCalc.Expression : Object {
+public interface GCalc.MathExpression : Object {
/**
* Parent of the expression
*/
- public abstract weak Expression parent { get; set; }
+ public abstract weak MathExpression parent { get; set; }
/**
* Child expressions
*/
@@ -40,6 +40,6 @@ public interface GCalc.Expression : Object {
public abstract Result solve ();
}
-public interface GCalc.ErrorExpression : Object, Expression {
+public interface GCalc.ErrorExpression : Object, MathExpression {
}
diff --git a/gcalc/gcalc-minus.vala b/gcalc/gcalc-minus.vala
index 0722fd80..4e247fad 100644
--- a/gcalc/gcalc-minus.vala
+++ b/gcalc/gcalc-minus.vala
@@ -18,5 +18,5 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Minus : Object, Expression, Operator, BinaryOperator {}
+public interface GCalc.Minus : Object, MathExpression, Operator, BinaryOperator {}
diff --git a/gcalc/gcalc-multiply.vala b/gcalc/gcalc-multiply.vala
index bde0f5be..b9f5ea14 100644
--- a/gcalc/gcalc-multiply.vala
+++ b/gcalc/gcalc-multiply.vala
@@ -18,5 +18,5 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Multiply : Object, Expression, Operator, BinaryOperator {}
+public interface GCalc.Multiply : Object, MathExpression, Operator, BinaryOperator {}
diff --git a/gcalc/gcalc-operator.vala b/gcalc/gcalc-operator.vala
index a41b8d88..149fde02 100644
--- a/gcalc/gcalc-operator.vala
+++ b/gcalc/gcalc-operator.vala
@@ -18,5 +18,5 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Operator : Object, Expression {}
+public interface GCalc.Operator : Object, MathExpression {}
diff --git a/gcalc/gcalc-parameter.vala b/gcalc/gcalc-parameter.vala
index 80c26c3d..bfa1c2f8 100644
--- a/gcalc/gcalc-parameter.vala
+++ b/gcalc/gcalc-parameter.vala
@@ -20,12 +20,12 @@
*/
/**
* A parameter is a {@link Variable} holding a value, that is not
- * expected to be resolved as part of an {@link Expression} evaluation,
+ * expected to be resolved as part of an {@link MathExpression} evaluation,
* but by asigning its value.
*
* Currently the value will be converted to a {@link Constant} if possible.
*/
-public interface GCalc.Parameter : Object, Variable {
+public interface GCalc.Parameter : Object, MathExpression, Variable {
public abstract void set_value (GLib.Value val) throws GLib.Error;
public abstract GLib.Value get_value ();
}
diff --git a/gcalc/gcalc-plus.vala b/gcalc/gcalc-plus.vala
index f52c0acc..47ffea88 100644
--- a/gcalc/gcalc-plus.vala
+++ b/gcalc/gcalc-plus.vala
@@ -18,5 +18,5 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Plus : Object, Expression, Operator, BinaryOperator {}
+public interface GCalc.Plus : Object, MathExpression, Operator, BinaryOperator {}
diff --git a/gcalc/gcalc-polynomial.vala b/gcalc/gcalc-polynomial.vala
index dd52e225..621175f9 100644
--- a/gcalc/gcalc-polynomial.vala
+++ b/gcalc/gcalc-polynomial.vala
@@ -18,10 +18,10 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Polynomial : Object, Expression {
- public virtual Expression evaluate () throws GLib.Error {
+public interface GCalc.Polynomial : Object, MathExpression {
+ public virtual MathExpression evaluate () throws GLib.Error {
Term current = null;
- Expression res = null;
+ MathExpression res = null;
for (uint i = 0; i < expressions.get_n_items (); i++) {
var e = expressions.get_item (i) as Term;
if (e == null) {
diff --git a/gcalc/gcalc-pow.vala b/gcalc/gcalc-pow.vala
index 39e2d84b..cbe71db7 100644
--- a/gcalc/gcalc-pow.vala
+++ b/gcalc/gcalc-pow.vala
@@ -18,5 +18,5 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Pow : Object, Expression, Operator {}
+public interface GCalc.Pow : Object, MathExpression, Operator {}
diff --git a/gcalc/gcalc-result.vala b/gcalc/gcalc-result.vala
index a1bfcb7a..6f8837d8 100644
--- a/gcalc/gcalc-result.vala
+++ b/gcalc/gcalc-result.vala
@@ -20,6 +20,6 @@
*/
public interface GCalc.Result : Object {
public abstract string to_string ();
- public abstract Expression expression { get; }
+ public abstract MathExpression expression { get; }
}
diff --git a/gcalc/gcalc-term.vala b/gcalc/gcalc-term.vala
index 76ebf6db..f2390130 100644
--- a/gcalc/gcalc-term.vala
+++ b/gcalc/gcalc-term.vala
@@ -18,12 +18,12 @@
* Authors:
* Daniel Espinosa <esodan gmail com>
*/
-public interface GCalc.Term : Object, Expression {
- public virtual Expression add (Term t) throws GLib.Error {
+public interface GCalc.Term : Object, MathExpression {
+ public virtual MathExpression add (Term t) throws GLib.Error {
if (t.expressions.get_n_items () == 0) {
return new GConstant.@double (1.0);
}
- Expression res = new GErrorExpression ();
+ MathExpression res = new GErrorExpression ();
var e = evaluate ();
var e2 = t.evaluate ();
if (e is Constant && e2 is Constant) {
@@ -31,11 +31,11 @@ public interface GCalc.Term : Object, Expression {
}
return res;
}
- public virtual Expression evaluate () throws GLib.Error {
- Expression current = null;
+ public virtual MathExpression evaluate () throws GLib.Error {
+ MathExpression current = null;
Operator current_operator = null;
bool first = true;
- foreach (Expression e in expressions) {
+ foreach (MathExpression e in expressions) {
if (e is Operator) {
if (!(e is Minus || e is Plus) && first) {
throw new TermError.INVALID_OPERATOR ("Incorrect position for operator in expression");
@@ -93,10 +93,10 @@ public interface GCalc.Term : Object, Expression {
}
return current;
}
- public static Expression evaluate_constants (Constant c1, Constant c2, Operator op)
+ public static MathExpression evaluate_constants (Constant c1, Constant c2, Operator op)
throws GLib.Error
{
- Expression res = null;
+ MathExpression res = null;
if (op is Minus) {
res = c1.multiply (c2);
}
diff --git a/gcalc/gcalc-variable.vala b/gcalc/gcalc-variable.vala
index 721136b8..a3bd7daf 100644
--- a/gcalc/gcalc-variable.vala
+++ b/gcalc/gcalc-variable.vala
@@ -19,15 +19,15 @@
* Daniel Espinosa <esodan gmail com>
*/
/**
- * A variable that can be evaluated from an {@link Expression}
+ * A variable that can be evaluated from an {@link MathExpression}
*/
-public interface GCalc.Variable : Object, Expression {
+public interface GCalc.Variable : Object, MathExpression {
public abstract string name { get; construct set; }
public abstract Constant @value { get; set; }
public abstract Variable bind { get; set; }
public virtual bool binded { get { return bind != null; } }
- public virtual Expression evaluate () throws GLib.Error {
+ public virtual MathExpression evaluate () throws GLib.Error {
if (bind != null) {
return bind.evaluate ();
}
diff --git a/gcalc/meson.build b/gcalc/meson.build
index 6e40a25c..16762498 100644
--- a/gcalc/meson.build
+++ b/gcalc/meson.build
@@ -60,7 +60,7 @@ gcalc_sources = files([
'gcalc-binary-operator.vala',
'gcalc-constant.vala',
'gcalc-division.vala',
- 'gcalc-expression.vala',
+ 'gcalc-math-expression.vala',
'gcalc-expression-container.vala',
'gcalc-expression-hash-map.vala',
'gcalc-function.vala',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]