commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r618014 - /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/
Date Sun, 03 Feb 2008 16:30:03 GMT
Author: mbenson
Date: Sun Feb  3 08:30:01 2008
New Revision: 618014

URL: http://svn.apache.org/viewvc?rev=618014&view=rev
Log:
get rid of operator precedence magic #s

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAdd.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperation.java
Sun Feb  3 08:30:01 2008
@@ -27,6 +27,23 @@
  */
 public abstract class CoreOperation extends Operation {
 
+    /** or precedence */
+    protected static final int OR_PRECEDENCE = 0;
+    /** and precedence */
+    protected static final int AND_PRECEDENCE = 1;
+    /** compare precedence */
+    protected static final int COMPARE_PRECEDENCE = 2;
+    /** relational expression precedence */
+    protected static final int RELATIONAL_EXPR_PRECEDENCE = 3;
+    /** add/subtract precedence */
+    protected static final int ADD_PRECEDENCE = 4;
+    /** multiply/divide/mod precedence */
+    protected static final int MULTIPLY_PRECEDENCE = 5;
+    /** negate precedence */
+    protected static final int NEGATE_PRECEDENCE = 6;
+    /** union precedence */
+    protected static final int UNION_PRECEDENCE = 7;
+
     /**
      * Create a new CoreOperation.
      * @param args Expression[]

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAdd.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAdd.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAdd.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAdd.java
Sun Feb  3 08:30:01 2008
@@ -50,7 +50,7 @@
      * {@inheritDoc}
      */
     protected int getPrecedence() {
-        return 4;
+        return ADD_PRECEDENCE;
     }
 
     /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationAnd.java
Sun Feb  3 08:30:01 2008
@@ -41,7 +41,7 @@
     }
 
     protected int getPrecedence() {
-        return 1;
+        return AND_PRECEDENCE;
     }
 
     protected boolean isSymmetric() {

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java
Sun Feb  3 08:30:01 2008
@@ -50,7 +50,7 @@
     }
 
     protected int getPrecedence() {
-        return 2;
+        return COMPARE_PRECEDENCE;
     }
 
     protected boolean isSymmetric() {

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationDivide.java
Sun Feb  3 08:30:01 2008
@@ -49,7 +49,7 @@
      * {@inheritDoc}
      */
     protected int getPrecedence() {
-        return 5;
+        return MULTIPLY_PRECEDENCE;
     }
 
     /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMod.java
Sun Feb  3 08:30:01 2008
@@ -49,7 +49,7 @@
      * {@inheritDoc}
      */
     protected int getPrecedence() {
-        return 5;
+        return MULTIPLY_PRECEDENCE;
     }
 
     /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationMultiply.java
Sun Feb  3 08:30:01 2008
@@ -49,7 +49,7 @@
      * {@inheritDoc}
      */
     protected int getPrecedence() {
-        return 5;
+        return MULTIPLY_PRECEDENCE;
     }
 
     /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationNegate.java
Sun Feb  3 08:30:01 2008
@@ -47,7 +47,7 @@
      * {@inheritDoc}
      */
     protected int getPrecedence() {
-        return 6;
+        return NEGATE_PRECEDENCE;
     }
 
     /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationOr.java
Sun Feb  3 08:30:01 2008
@@ -51,7 +51,7 @@
      * {@inheritDoc}
      */
     protected int getPrecedence() {
-        return 0;
+        return OR_PRECEDENCE;
     }
 
     /**

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
Sun Feb  3 08:30:01 2008
@@ -44,7 +44,7 @@
     }
 
     protected final int getPrecedence() {
-        return 3;
+        return RELATIONAL_EXPR_PRECEDENCE;
     }
 
     protected final boolean isSymmetric() {

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationSubtract.java
Sun Feb  3 08:30:01 2008
@@ -38,7 +38,7 @@
     }
 
     protected int getPrecedence() {
-        return 4;
+        return ADD_PRECEDENCE;
     }
 
     protected boolean isSymmetric() {

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java?rev=618014&r1=618013&r2=618014&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationUnion.java
Sun Feb  3 08:30:01 2008
@@ -56,7 +56,7 @@
      * {@inheritDoc}
      */
     protected int getPrecedence() {
-        return 7;
+        return UNION_PRECEDENCE;
     }
 
     /**



Mime
View raw message