[gnome-calculator] GCalc: renamed Operator to MathOperator



commit 61f0e6c5c3a1c8ee2fc52c8deccbf4d5f1bd9883
Author: Daniel Espinosa <esodan gmail com>
Date:   Thu Oct 17 10:19:13 2019 -0500

    GCalc: renamed Operator to MathOperator

 gcalc/gcalc-assign.vala                                 |  2 +-
 gcalc/gcalc-binary-operator.vala                        |  2 +-
 gcalc/gcalc-division.vala                               |  2 +-
 gcalc/gcalc-expression.vala                             |  2 +-
 gcalc/gcalc-gassign.vala                                |  2 +-
 gcalc/gcalc-gdivision.vala                              |  2 +-
 gcalc/gcalc-gminus.vala                                 |  2 +-
 gcalc/gcalc-gmultiply.vala                              |  2 +-
 gcalc/gcalc-gparser.vala                                | 14 +++++++-------
 gcalc/gcalc-gplus.vala                                  |  2 +-
 gcalc/gcalc-gpow.vala                                   |  2 +-
 gcalc/gcalc-math-expression.vala                        |  2 +-
 gcalc/{gcalc-operator.vala => gcalc-math-operator.vala} |  7 +++++--
 gcalc/gcalc-minus.vala                                  |  2 +-
 gcalc/gcalc-multiply.vala                               |  2 +-
 gcalc/gcalc-plus.vala                                   |  2 +-
 gcalc/gcalc-pow.vala                                    |  2 +-
 gcalc/gcalc-term.vala                                   |  8 ++++----
 gcalc/meson.build                                       |  6 +++---
 19 files changed, 34 insertions(+), 31 deletions(-)
---
diff --git a/gcalc/gcalc-assign.vala b/gcalc/gcalc-assign.vala
index 5a461ff9..91be058e 100644
--- a/gcalc/gcalc-assign.vala
+++ b/gcalc/gcalc-assign.vala
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public interface GCalc.Assign : Object, MathExpression, Operator, BinaryOperator {
+public interface GCalc.Assign : Object, MathExpression, MathOperator, 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 b133a29a..a22fcaf6 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, MathExpression, Operator {}
+public interface GCalc.BinaryOperator : Object, MathExpression, MathOperator {}
 
diff --git a/gcalc/gcalc-division.vala b/gcalc/gcalc-division.vala
index fab3cb5b..a10fbd29 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, MathExpression, Operator, BinaryOperator {}
+public interface GCalc.Division : Object, MathExpression, MathOperator, BinaryOperator {}
 
diff --git a/gcalc/gcalc-expression.vala b/gcalc/gcalc-expression.vala
index 84bae3d4..f5b90fbf 100644
--- a/gcalc/gcalc-expression.vala
+++ b/gcalc/gcalc-expression.vala
@@ -1,4 +1,4 @@
-/* gcalc-gexpresion.vala
+/* gcalc-expresion.vala
  *
  * Copyright (C) 2018  Daniel Espinosa <esodan gmail com>
  *
diff --git a/gcalc/gcalc-gassign.vala b/gcalc/gcalc-gassign.vala
index be3d6a41..dce1a7c7 100644
--- a/gcalc/gcalc-gassign.vala
+++ b/gcalc/gcalc-gassign.vala
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public class GCalc.GAssign : Expression, Operator, BinaryOperator, Assign {
+public class GCalc.GAssign : Expression, MathOperator, BinaryOperator, Assign {
   internal override string to_string () {
     if (expressions.get_n_items () != 2) {
       return "Invalid Assigment structure";
diff --git a/gcalc/gcalc-gdivision.vala b/gcalc/gcalc-gdivision.vala
index 1d748533..5f4abdd9 100644
--- a/gcalc/gcalc-gdivision.vala
+++ b/gcalc/gcalc-gdivision.vala
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public class GCalc.GDivision : Expression, Operator, BinaryOperator, Division {
+public class GCalc.GDivision : Expression, MathOperator, BinaryOperator, Division {
   internal override string to_string () {
     return "/";
   }
diff --git a/gcalc/gcalc-gminus.vala b/gcalc/gcalc-gminus.vala
index 82721419..2e0fa930 100644
--- a/gcalc/gcalc-gminus.vala
+++ b/gcalc/gcalc-gminus.vala
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public class GCalc.GMinus : Expression, Operator, BinaryOperator, Minus {
+public class GCalc.GMinus : Expression, MathOperator, BinaryOperator, Minus {
   internal override string to_string () {
     return "-";
   }
diff --git a/gcalc/gcalc-gmultiply.vala b/gcalc/gcalc-gmultiply.vala
index 76935734..fa3061a8 100644
--- a/gcalc/gcalc-gmultiply.vala
+++ b/gcalc/gcalc-gmultiply.vala
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public class GCalc.GMultiply : Expression, Operator, BinaryOperator, Multiply {
+public class GCalc.GMultiply : Expression, MathOperator, BinaryOperator, Multiply {
   internal override string to_string () {
     return "*";
   }
diff --git a/gcalc/gcalc-gparser.vala b/gcalc/gcalc-gparser.vala
index 8e38d8b1..ab88fb1b 100644
--- a/gcalc/gcalc-gparser.vala
+++ b/gcalc/gcalc-gparser.vala
@@ -82,7 +82,7 @@ public class GCalc.GParser : Object {
               top_parent = exp;
               expected.clear ();
               expected.add(TokenType.OPEN_PARENS);
-            } else if (current is Operator && current_parent is Term && top_parent is Polynomial) {
+            } else if (current is MathOperator && current_parent is Term && top_parent is Polynomial) {
                 current_parent.expressions.add (sfunc);
                 current = sfunc;
                 expected.clear ();
@@ -124,7 +124,7 @@ public class GCalc.GParser : Object {
               current_parent = v.parent;
               top_parent = current_parent.parent;
               expected.clear ();
-            } else if (current is Operator && current_parent is Term && top_parent is Polynomial) {
+            } else if (current is MathOperator && current_parent is Term && top_parent is Polynomial) {
                 current_parent.expressions.add (v);
                 current = v;
                 expected.clear ();
@@ -153,7 +153,7 @@ public class GCalc.GParser : Object {
             current = cexp;
             current_parent = t;
             top_parent = exp;
-          } else if ((current is Operator || current is Term) && current_parent is Term && top_parent is 
Polynomial) {
+          } else if ((current is MathOperator || current is Term) && current_parent is Term && top_parent is 
Polynomial) {
             current_parent.expressions.add (cexp);
             expected.clear ();
             current = cexp;
@@ -245,7 +245,7 @@ public class GCalc.GParser : Object {
             current = t;
             current_parent = fexp;
             expected.clear ();
-          } else if (current is Operator && current_parent is Term && top_parent is Polynomial) {
+          } else if (current is MathOperator && current_parent is Term && top_parent is Polynomial) {
             var g = new GGroup ();
             current_parent.expressions.add (g);
             var exp = new GPolynomial ();
@@ -334,7 +334,7 @@ public class GCalc.GParser : Object {
     }
     eqman.equations.add (eq);
   }
-  private void process_operator (Operator opp, GMathEquation eq) throws GLib.Error {
+  private void process_operator (MathOperator opp, GMathEquation eq) throws GLib.Error {
     if (current is BinaryOperator) {
       throw new ParserError.INVALID_TOKEN_ERROR ("Found an unexpected expression for a plus operator");
     }
@@ -388,8 +388,8 @@ public class GCalc.GParser : Object {
       expected.clear ();
     }
   }
-  private void process_term_operator (Operator op, GMathEquation eq) throws GLib.Error {
-    if (current is Operator) {
+  private void process_term_operator (MathOperator op, GMathEquation eq) throws GLib.Error {
+    if (current is MathOperator) {
       throw new ParserError.INVALID_TOKEN_ERROR ("Found an unexpected expression for a multiply operator");
     }
     if ((current is Constant || current is Variable || current is Group || current is Function)
diff --git a/gcalc/gcalc-gplus.vala b/gcalc/gcalc-gplus.vala
index 5eb95d5e..87b75779 100644
--- a/gcalc/gcalc-gplus.vala
+++ b/gcalc/gcalc-gplus.vala
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public class GCalc.GPlus : Expression, Operator, BinaryOperator, Plus {
+public class GCalc.GPlus : Expression, MathOperator, BinaryOperator, Plus {
   internal override string to_string () {
     return "+";
   }
diff --git a/gcalc/gcalc-gpow.vala b/gcalc/gcalc-gpow.vala
index 5dded934..923bfd85 100644
--- a/gcalc/gcalc-gpow.vala
+++ b/gcalc/gcalc-gpow.vala
@@ -18,7 +18,7 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public class GCalc.GPow : Expression, Operator, Pow {
+public class GCalc.GPow : Expression, MathOperator, Pow {
   internal override string to_string () {
     return "^";
   }
diff --git a/gcalc/gcalc-math-expression.vala b/gcalc/gcalc-math-expression.vala
index de54d19b..05ba3229 100644
--- a/gcalc/gcalc-math-expression.vala
+++ b/gcalc/gcalc-math-expression.vala
@@ -1,4 +1,4 @@
-/* gcalc-expresion.vala
+/* gcalc-math-expresion.vala
  *
  * Copyright (C) 2018  Daniel Espinosa <esodan gmail com>
  *
diff --git a/gcalc/gcalc-operator.vala b/gcalc/gcalc-math-operator.vala
similarity index 85%
rename from gcalc/gcalc-operator.vala
rename to gcalc/gcalc-math-operator.vala
index 149fde02..333ef884 100644
--- a/gcalc/gcalc-operator.vala
+++ b/gcalc/gcalc-math-operator.vala
@@ -1,4 +1,4 @@
-/* gcalc-operator.vala
+/* gcalc-math-operator.vala
  *
  * Copyright (C) 2018  Daniel Espinosa <esodan gmail com>
  *
@@ -18,5 +18,8 @@
  * Authors:
  *      Daniel Espinosa <esodan gmail com>
  */
-public interface GCalc.Operator : Object, MathExpression {}
+/**
+ * An operator in a math expression
+ */
+public interface GCalc.MathOperator : Object, MathExpression {}
 
diff --git a/gcalc/gcalc-minus.vala b/gcalc/gcalc-minus.vala
index 4e247fad..93bcdc5b 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, MathExpression, Operator, BinaryOperator {}
+public interface GCalc.Minus : Object, MathExpression, MathOperator, BinaryOperator {}
 
diff --git a/gcalc/gcalc-multiply.vala b/gcalc/gcalc-multiply.vala
index b9f5ea14..0a60d428 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, MathExpression, Operator, BinaryOperator {}
+public interface GCalc.Multiply : Object, MathExpression, MathOperator, BinaryOperator {}
 
diff --git a/gcalc/gcalc-plus.vala b/gcalc/gcalc-plus.vala
index 47ffea88..6559d517 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, MathExpression, Operator, BinaryOperator {}
+public interface GCalc.Plus : Object, MathExpression, MathOperator, BinaryOperator {}
 
diff --git a/gcalc/gcalc-pow.vala b/gcalc/gcalc-pow.vala
index cbe71db7..c2a5851a 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, MathExpression, Operator {}
+public interface GCalc.Pow : Object, MathExpression, MathOperator {}
 
diff --git a/gcalc/gcalc-term.vala b/gcalc/gcalc-term.vala
index f2390130..93300e96 100644
--- a/gcalc/gcalc-term.vala
+++ b/gcalc/gcalc-term.vala
@@ -33,10 +33,10 @@ public interface GCalc.Term : Object, MathExpression {
   }
   public virtual MathExpression evaluate () throws GLib.Error {
     MathExpression current = null;
-    Operator current_operator = null;
+    MathOperator current_operator = null;
     bool first = true;
     foreach (MathExpression e in expressions) {
-      if (e is Operator) {
+      if (e is MathOperator) {
         if (!(e is Minus || e is Plus) && first) {
           throw new TermError.INVALID_OPERATOR ("Incorrect position for operator in expression");
         }
@@ -45,7 +45,7 @@ public interface GCalc.Term : Object, MathExpression {
           current = c;
           first = false;
         }
-        current_operator = e as Operator;
+        current_operator = e as MathOperator;
         continue;
       } else if (e is Constant) {
         if (current == null) {
@@ -93,7 +93,7 @@ public interface GCalc.Term : Object, MathExpression {
     }
     return current;
   }
-  public static MathExpression evaluate_constants (Constant c1, Constant c2, Operator op)
+  public static MathExpression evaluate_constants (Constant c1, Constant c2, MathOperator op)
     throws GLib.Error
   {
     MathExpression res = null;
diff --git a/gcalc/meson.build b/gcalc/meson.build
index 87b79dec..74b448ad 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-math-expression.vala',
+       'gcalc-expression.vala',
        'gcalc-expression-container.vala',
        'gcalc-expression-hash-map.vala',
        'gcalc-function.vala',
@@ -80,7 +80,6 @@ gcalc_sources = files([
        'gcalc-function-tan.vala',
        'gcalc-function-tanh.vala',
        'gcalc-error-result.vala',
-       'gcalc-expression.vala',
        'gcalc-gassign.vala',
        'gcalc-gconstant.vala',
        'gcalc-gdivision.vala',
@@ -104,9 +103,10 @@ gcalc_sources = files([
        'gcalc-hashable.vala',
        'gcalc-math-equation.vala',
        'gcalc-math-equation-manager.vala',
+       'gcalc-math-expression.vala',
+       'gcalc-math-operator.vala',
        'gcalc-minus.vala',
        'gcalc-multiply.vala',
-       'gcalc-operator.vala',
        'gcalc-parameter.vala',
        'gcalc-plus.vala',
        'gcalc-polynomial.vala',


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