[gnome-calculator] GCalc: renamed GConstant to Constant



commit f918548dbfbd4dfe256db406af29ea4248ae53ac
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Oct 17 11:21:24 2019 -0500

    GCalc: renamed GConstant to Constant

 .../{gcalc-gconstant.vala => gcalc-constant.vala}  | 46 ++++++++++----------
 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-gparameter.vala                        |  8 ++--
 gcalc/gcalc-gvariable.vala                         |  2 +-
 gcalc/gcalc-parser.vala                            |  2 +-
 gcalc/gcalc-term.vala                              |  4 +-
 gcalc/meson.build                                  |  2 +-
 tests/gcalc-parsing.vala                           |  2 +-
 tests/gcalc-solving-basic.vala                     | 50 +++++++++++-----------
 23 files changed, 118 insertions(+), 118 deletions(-)
---
diff --git a/gcalc/gcalc-gconstant.vala b/gcalc/gcalc-constant.vala
similarity index 72%
rename from gcalc/gcalc-gconstant.vala
rename to gcalc/gcalc-constant.vala
index 5d7fef9f..b346c985 100644
--- a/gcalc/gcalc-gconstant.vala
+++ b/gcalc/gcalc-constant.vala
@@ -1,4 +1,4 @@
-/* gcalc-gconstant.vala
+/* gcalc-constant.vala
  *
  * Copyright (C) 2018  Daniel Espinosa <esodan gmail com>
  *
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public class GCalc.GConstant : Expression, MathConstant {
+public class GCalc.Constant : Expression, MathConstant {
   private MPC.Complex _complex = MPC.Complex (1000);
 
   internal unowned MPC.Complex get_complex () { return _complex; }
@@ -26,19 +26,19 @@ public class GCalc.GConstant : Expression, MathConstant {
   construct {
     _complex.set_double (0.0);
   }
-  internal GConstant.internal_complex (MPC.Complex complex) {
+  internal Constant.internal_complex (MPC.Complex complex) {
     _complex.set (complex);
   }
-  public GConstant.integer (int val) {
+  public Constant.integer (int val) {
     _complex.set_double (val);
   }
-  public GConstant.unsigned_integer (uint val) {
+  public Constant.unsigned_integer (uint val) {
     _complex.set_double (val);
   }
-  public GConstant.@double (double val) {
+  public Constant.@double (double val) {
     _complex.set_double (val);
   }
-  public GConstant.complex (double real, double imag) {
+  public Constant.complex (double real, double imag) {
     _complex.set_double (real, imag);
   }
 
@@ -56,60 +56,60 @@ public class GCalc.GConstant : Expression, MathConstant {
   }
 
   internal MathConstant add (MathConstant c)
-    requires (c is GConstant)
+    requires (c is Constant)
   {
     var res = MPC.Complex (1000);
     var p1 = MPC.Complex (1000);
-    p1.set (((GConstant) c).get_complex ());
+    p1.set (((Constant) c).get_complex ());
     res.add (_complex, p1);
-    return new GConstant.internal_complex (res);
+    return new Constant.internal_complex (res);
   }
 
   internal MathConstant subtract (MathConstant c)
-    requires (c is GConstant)
+    requires (c is Constant)
   {
     var res = MPC.Complex (1000);
     var p1 = MPC.Complex (1000);
-    p1.set (((GConstant) c).get_complex ());
+    p1.set (((Constant) c).get_complex ());
     res.subtract (_complex, p1);
-    return new GConstant.internal_complex (res);
+    return new Constant.internal_complex (res);
   }
 
   internal MathConstant multiply (MathConstant c)
-    requires (c is GConstant)
+    requires (c is Constant)
   {
     var res = MPC.Complex (1000);
     var p1 = MPC.Complex (1000);
-    p1.set (((GConstant) c).get_complex ());
+    p1.set (((Constant) c).get_complex ());
     res.multiply (_complex, p1);
-    return new GConstant.internal_complex (res);
+    return new Constant.internal_complex (res);
   }
 
   internal MathConstant divide (MathConstant c)
-    requires (c is GConstant)
+    requires (c is Constant)
   {
     var res = MPC.Complex (1000);
     var p1 = MPC.Complex (1000);
-    p1.set (((GConstant) c).get_complex ());
+    p1.set (((Constant) c).get_complex ());
     res.divide (_complex, p1);
-    return new GConstant.internal_complex (res);
+    return new Constant.internal_complex (res);
   }
 
   internal MathConstant neg ()
   {
     var res = MPC.Complex (1000);
     res.neg (_complex);
-    return new GConstant.internal_complex (res);
+    return new Constant.internal_complex (res);
   }
 
   internal MathConstant pow (MathConstant c)
-    requires (c is GConstant)
+    requires (c is Constant)
   {
     var res = MPC.Complex (1000);
     var p1 = MPC.Complex (1000);
-    p1.set (((GConstant) c).get_complex ());
+    p1.set (((Constant) c).get_complex ());
     res.power (_complex, p1);
-    return new GConstant.internal_complex (res);
+    return new Constant.internal_complex (res);
   }
 
   // Expression interface
diff --git a/gcalc/gcalc-function-acos.vala b/gcalc/gcalc-function-acos.vala
index 2eca01ec..edd3251b 100644
--- a/gcalc/gcalc-function-acos.vala
+++ b/gcalc/gcalc-function-acos.vala
@@ -26,13 +26,13 @@ public class GCalc.GFunctionAcos : GFunction {
   construct {
     name = "acos";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -42,7 +42,7 @@ public class GCalc.GFunctionAcos : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -51,7 +51,7 @@ public class GCalc.GFunctionAcos : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.acos (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-acosh.vala b/gcalc/gcalc-function-acosh.vala
index c7832c1c..1db19d6e 100644
--- a/gcalc/gcalc-function-acosh.vala
+++ b/gcalc/gcalc-function-acosh.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionAcosh : GFunction {
   construct {
     name = "acosh";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionAcosh : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionAcosh : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.acosh (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-asin.vala b/gcalc/gcalc-function-asin.vala
index c10471ec..b1439559 100644
--- a/gcalc/gcalc-function-asin.vala
+++ b/gcalc/gcalc-function-asin.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionAsin : GFunction {
   construct {
     name = "asin";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionAsin : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionAsin : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.asin (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-asinh.vala b/gcalc/gcalc-function-asinh.vala
index 8b54dcbf..7b845ff9 100644
--- a/gcalc/gcalc-function-asinh.vala
+++ b/gcalc/gcalc-function-asinh.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionAsinh : GFunction {
   construct {
     name = "asinh";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionAsinh : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionAsinh : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.asinh (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-atan.vala b/gcalc/gcalc-function-atan.vala
index ff57b432..32b56305 100644
--- a/gcalc/gcalc-function-atan.vala
+++ b/gcalc/gcalc-function-atan.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionAtan : GFunction {
   construct {
     name = "atan";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionAtan : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionAtan : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.atan (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-atanh.vala b/gcalc/gcalc-function-atanh.vala
index 1055f798..ce67a788 100644
--- a/gcalc/gcalc-function-atanh.vala
+++ b/gcalc/gcalc-function-atanh.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionAtanh : GFunction {
   construct {
     name = "atanh";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionAtanh : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionAtanh : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.atanh (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-cos.vala b/gcalc/gcalc-function-cos.vala
index bc21fd80..7ccbe00b 100644
--- a/gcalc/gcalc-function-cos.vala
+++ b/gcalc/gcalc-function-cos.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionCos : GFunction {
   construct {
     name = "cos";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionCos : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionCos : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.cos (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-cosh.vala b/gcalc/gcalc-function-cosh.vala
index 34f9d551..34c784ea 100644
--- a/gcalc/gcalc-function-cosh.vala
+++ b/gcalc/gcalc-function-cosh.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionCosh : GFunction {
   construct {
     name = "cosh";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionCosh : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionCosh : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.cosh (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-exp.vala b/gcalc/gcalc-function-exp.vala
index e6f24d45..4fe520d1 100644
--- a/gcalc/gcalc-function-exp.vala
+++ b/gcalc/gcalc-function-exp.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionExp : GFunction {
   construct {
     name = "exp";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionExp : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionExp : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.exp (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-log.vala b/gcalc/gcalc-function-log.vala
index 85f96c6f..b3de7f02 100644
--- a/gcalc/gcalc-function-log.vala
+++ b/gcalc/gcalc-function-log.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionLog : GFunction {
   construct {
     name = "log";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionLog : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionLog : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.log (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-sin.vala b/gcalc/gcalc-function-sin.vala
index 9eb79be5..c7d357c6 100644
--- a/gcalc/gcalc-function-sin.vala
+++ b/gcalc/gcalc-function-sin.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionSin : GFunction {
   construct {
     name = "sin";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionSin : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionSin : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.sin (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-sinh.vala b/gcalc/gcalc-function-sinh.vala
index 2fd0e445..6910a8aa 100644
--- a/gcalc/gcalc-function-sinh.vala
+++ b/gcalc/gcalc-function-sinh.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionSinh : GFunction {
   construct {
     name = "sinh";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionSinh : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionSinh : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.sinh (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-sqrt.vala b/gcalc/gcalc-function-sqrt.vala
index a811ce7a..24e40fd7 100644
--- a/gcalc/gcalc-function-sqrt.vala
+++ b/gcalc/gcalc-function-sqrt.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionSqrt : GFunction {
   construct {
     name = "sqrt";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionSqrt : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionSqrt : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.sqrt (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-tan.vala b/gcalc/gcalc-function-tan.vala
index df150034..2a95c411 100644
--- a/gcalc/gcalc-function-tan.vala
+++ b/gcalc/gcalc-function-tan.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionTan : GFunction {
   construct {
     name = "tan";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionTan : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionTan : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.tan (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-function-tanh.vala b/gcalc/gcalc-function-tanh.vala
index ebe91385..018997be 100644
--- a/gcalc/gcalc-function-tanh.vala
+++ b/gcalc/gcalc-function-tanh.vala
@@ -23,13 +23,13 @@ public class GCalc.GFunctionTanh : GFunction {
   construct {
     name = "tanh";
     n_params = 1;
-    param_types.add (new GConstant ());
+    param_types.add (new Constant ());
   }
 
   internal override MathExpression evaluate () throws GLib.Error
   {
     verify_params ();
-    GConstant c = null;
+    Constant c = null;
     var exp = expressions.get_item (0) as MathExpression;
     if (exp == null) {
       throw new FunctionError.INVOCATION_ERROR ("Invalid parameter type. Expected %s", 
typeof(MathExpression).name ());
@@ -39,7 +39,7 @@ public class GCalc.GFunctionTanh : GFunction {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression: %s", ((ErrorResult) ev).message);
     }
     if (ev is Result) {
-      c = ((Result) ev).expression as GConstant;
+      c = ((Result) ev).expression as Constant;
     }
     if (c == null) {
        throw new FunctionError.INVOCATION_ERROR ("Invalid expression in result");
@@ -48,7 +48,7 @@ public class GCalc.GFunctionTanh : GFunction {
     p1.set (c.get_complex ());
     var res = MPC.Complex (1000);
     res.tanh (p1);
-    var nc = new GConstant.internal_complex (res);
+    var nc = new Constant.internal_complex (res);
     return nc as MathExpression;
   }
 }
diff --git a/gcalc/gcalc-gparameter.vala b/gcalc/gcalc-gparameter.vala
index 8aeee975..a4a02cc2 100644
--- a/gcalc/gcalc-gparameter.vala
+++ b/gcalc/gcalc-gparameter.vala
@@ -25,13 +25,13 @@ public class GCalc.GParameter : GCalc.GVariable, Parameter {
   }
 
   internal void set_value (GLib.Value val) throws GLib.Error {
-    MathConstant c = new GConstant.integer (0);
+    MathConstant c = new Constant.integer (0);
     if (val.holds (GLib.Type.INT)) {
-      c = new GConstant.integer ((int) val);
+      c = new Constant.integer ((int) val);
     } else if (val.holds (GLib.Type.DOUBLE)) {
-      c = new GConstant.@double ((double) val);
+      c = new Constant.@double ((double) val);
     } else if (val.holds (GLib.Type.FLOAT)) {
-      c = new GConstant.@double ((double) ((float) val));
+      c = new Constant.@double ((double) ((float) val));
     } else if (val.type ().is_a (typeof (GCalc.MathConstant))) {
       c = (GCalc.MathConstant) ((Object) val);
     }
diff --git a/gcalc/gcalc-gvariable.vala b/gcalc/gcalc-gvariable.vala
index fbb24720..fa9b5332 100644
--- a/gcalc/gcalc-gvariable.vala
+++ b/gcalc/gcalc-gvariable.vala
@@ -25,7 +25,7 @@ public class GCalc.GVariable : Expression, Variable, Hashable {
   internal Variable bind { get; set; }
 
   construct {
-    _value = new GConstant.@double (0.0);
+    _value = new Constant.@double (0.0);
   }
   internal GVariable (string name) {
     this.name = name;
diff --git a/gcalc/gcalc-parser.vala b/gcalc/gcalc-parser.vala
index e2905116..f4d62f67 100644
--- a/gcalc/gcalc-parser.vala
+++ b/gcalc/gcalc-parser.vala
@@ -143,7 +143,7 @@ public class GCalc.Parser : Object {
           if (!double.try_parse (n, out res)) {
             throw new ParserError.INVALID_TOKEN_ERROR ("Found an unexpected expression for a constant");
           }
-          var cexp = new GConstant.@double (double.parse (n));
+          var cexp = new Constant.@double (double.parse (n));
           if (current == null) {
             var exp = new Polynomial ();
             eq.expressions.add (exp);
diff --git a/gcalc/gcalc-term.vala b/gcalc/gcalc-term.vala
index b989fbdf..3188691b 100644
--- a/gcalc/gcalc-term.vala
+++ b/gcalc/gcalc-term.vala
@@ -21,7 +21,7 @@
 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);
+      return new Constant.@double (1.0);
     }
     MathExpression res = new GErrorExpression ();
     var e = evaluate ();
@@ -41,7 +41,7 @@ public interface GCalc.Term : Object, MathExpression {
           throw new TermError.INVALID_OPERATOR ("Incorrect position for operator in expression");
         }
         if (e is Minus && first) {
-          var c = new GConstant.@double (-1.0);
+          var c = new Constant.@double (-1.0);
           current = c;
           first = false;
         }
diff --git a/gcalc/meson.build b/gcalc/meson.build
index 39d1a2f5..38cef76a 100644
--- a/gcalc/meson.build
+++ b/gcalc/meson.build
@@ -57,6 +57,7 @@ lib_mpfrg = static_library ('mpfrg',
 
 gcalc_sources = files([
        'gcalc-assign.vala',
+       'gcalc-constant.vala',
        'gcalc-division.vala',
        'gcalc-expression.vala',
        'gcalc-expression-container.vala',
@@ -78,7 +79,6 @@ gcalc_sources = files([
        'gcalc-function-tan.vala',
        'gcalc-function-tanh.vala',
        'gcalc-error-result.vala',
-       'gcalc-gconstant.vala',
        'gcalc-gdivision.vala',
        'gcalc-gerror-result.vala',
        'gcalc-gfunction.vala',
diff --git a/tests/gcalc-parsing.vala b/tests/gcalc-parsing.vala
index f0fed8ad..cc3bf054 100644
--- a/tests/gcalc-parsing.vala
+++ b/tests/gcalc-parsing.vala
@@ -506,7 +506,7 @@ class Tests {
     });
     Test.add_func ("/gcalc/parser/constant/to_string",
     ()=>{
-      MathConstant c = new GConstant.@double (-1.0) as MathConstant;
+      MathConstant c = new Constant.@double (-1.0) as MathConstant;
       assert ("-1" in c.to_string ());
     });
     Test.add_func ("/gcalc/parser/term/parenthesis",
diff --git a/tests/gcalc-solving-basic.vala b/tests/gcalc-solving-basic.vala
index 58339089..2c949ce5 100644
--- a/tests/gcalc-solving-basic.vala
+++ b/tests/gcalc-solving-basic.vala
@@ -25,8 +25,8 @@ class Tests {
     Test.init (ref args);
     Test.add_func ("/gcalc/solve/constant/add",
     ()=>{
-      var c1 = new GConstant.@double (3.0);
-      var c2 = new GConstant.@double (3.0);
+      var c1 = new Constant.@double (3.0);
+      var c2 = new Constant.@double (3.0);
       var c3 = c1.add (c2);
       assert (c3 != null);
       message (c3.to_string ());
@@ -34,8 +34,8 @@ class Tests {
     });
     Test.add_func ("/gcalc/solve/constant/subtract",
     ()=>{
-      var c1 = new GConstant.@double (9.0);
-      var c2 = new GConstant.@double (3.0);
+      var c1 = new Constant.@double (9.0);
+      var c2 = new Constant.@double (3.0);
       var c3 = c1.subtract (c2);
       assert (c3 != null);
       message (c3.to_string ());
@@ -43,8 +43,8 @@ class Tests {
     });
     Test.add_func ("/gcalc/solve/constant/multiply",
     ()=>{
-      var c1 = new GConstant.@double (3.0);
-      var c2 = new GConstant.@double (3.0);
+      var c1 = new Constant.@double (3.0);
+      var c2 = new Constant.@double (3.0);
       var c3 = c1.multiply (c2);
       assert (c3 != null);
       message (c3.to_string ());
@@ -52,8 +52,8 @@ class Tests {
     });
     Test.add_func ("/gcalc/solve/constant/devide",
     ()=>{
-      var c1 = new GConstant.@double (9.0);
-      var c2 = new GConstant.@double (3.0);
+      var c1 = new Constant.@double (9.0);
+      var c2 = new Constant.@double (3.0);
       var c3 = c1.divide (c2);
       assert (c3 != null);
       message (c3.to_string ());
@@ -61,7 +61,7 @@ class Tests {
     });
     Test.add_func ("/gcalc/solve/constant/negation",
     ()=>{
-      var c1 = new GConstant.@double (9.0);
+      var c1 = new Constant.@double (9.0);
       var c3 = c1.neg ();
       assert (c3 != null);
       message (c3.to_string ());
@@ -69,7 +69,7 @@ class Tests {
     });
     Test.add_func ("/gcalc/solve/constant/complex",
     ()=>{
-      var c1 = new GConstant.complex (10.0, 15.0);
+      var c1 = new Constant.complex (10.0, 15.0);
       var c3 = c1.neg ();
       assert (c3 != null);
       message (c3.to_string ());
@@ -469,7 +469,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/sqrt",
     ()=>{
       try {
-        var c1 = new GConstant.@double (9.0);
+        var c1 = new Constant.@double (9.0);
         var f = new GFunctionSqrt ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -483,7 +483,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/exp",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionExp ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -497,7 +497,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/log",
     ()=>{
       try {
-        var c1 = new GConstant.@double (1.0);
+        var c1 = new Constant.@double (1.0);
         var f = new GFunctionLog ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -511,7 +511,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/sin",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionSin ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -525,7 +525,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/cos",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionCos ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -539,7 +539,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/tan",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionTan ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -553,7 +553,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/asin",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionAsin ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -567,7 +567,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/acos",
     ()=>{
       try {
-        var c1 = new GConstant.@double (1.0);
+        var c1 = new Constant.@double (1.0);
         var f = new GFunctionAcos ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -581,7 +581,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/atan",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionAtan ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -595,7 +595,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/sinh",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionSinh ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -609,7 +609,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/cosh",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionCosh ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -623,7 +623,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/tanh",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionTanh ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -637,7 +637,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/asinh",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionAsinh ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -651,7 +651,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/acosh",
     ()=>{
       try {
-        var c1 = new GConstant.@double (1.0);
+        var c1 = new Constant.@double (1.0);
         var f = new GFunctionAcosh ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;
@@ -665,7 +665,7 @@ class Tests {
     Test.add_func ("/gcalc/solve/function/atanh",
     ()=>{
       try {
-        var c1 = new GConstant.@double (0.0);
+        var c1 = new Constant.@double (0.0);
         var f = new GFunctionAtanh ();
         f.expressions.add (c1);
         var c2 = f.evaluate () as MathConstant;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]