You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2015/06/28 21:18:29 UTC

[07/14] vxquery git commit: redundant code from AbstractNodePositionalCheckEvaluator removed

redundant code from AbstractNodePositionalCheckEvaluator removed


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/24c4fff6
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/24c4fff6
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/24c4fff6

Branch: refs/heads/master
Commit: 24c4fff6799693cfdfc7458c3549342159f31f9f
Parents: bd05276
Author: Shivani Mall <sm...@ucr.edu>
Authored: Fri Jun 26 15:03:58 2015 -0700
Committer: Shivani Mall <sm...@ucr.edu>
Committed: Fri Jun 26 15:03:58 2015 -0700

----------------------------------------------------------------------
 .../AbstractNodePositionalCheckEvaluator.java   | 22 +++++++-------------
 1 file changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/24c4fff6/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java
index 8ea3e6d..953b72d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AbstractNodePositionalCheckEvaluator.java
@@ -19,7 +19,6 @@ package org.apache.vxquery.runtime.functions.node;
 
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.TypedPointables;
-import org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.datamodel.values.XDMConstants;
 import org.apache.vxquery.exceptions.ErrorCode;
@@ -36,15 +35,17 @@ public abstract class AbstractNodePositionalCheckEvaluator extends AbstractTagge
         super(args);
     }
 
-    private final NodeTreePointable ntp1 = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
-    private final NodeTreePointable ntp2 = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
     private final TypedPointables tp = new TypedPointables();
 
     @Override
     protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
 
-        parameterTypeCheck(args[0], ntp1);
-        parameterTypeCheck(args[1], ntp2);
+        if (args[0].getTag() != ValueTag.NODE_TREE_TAG) {
+            throw new SystemException(ErrorCode.FORG0006);
+        }
+        if (args[1].getTag() != ValueTag.NODE_TREE_TAG) {
+            throw new SystemException(ErrorCode.FORG0006);
+        }
 
         if (nodeCompare(FunctionHelper.getLocalNodeId(args[0], tp), FunctionHelper.getLocalNodeId(args[1], tp))) {
             XDMConstants.setTrue(result);
@@ -53,14 +54,5 @@ public abstract class AbstractNodePositionalCheckEvaluator extends AbstractTagge
         }
     }
 
-    protected void parameterTypeCheck(TaggedValuePointable node, NodeTreePointable ntp) throws SystemException {
-        if (node.getTag() == ValueTag.NODE_TREE_TAG) {
-            node.getValue(ntp);
-            return;
-        }
-        throw new SystemException(ErrorCode.FORG0006);
-    }
-
     abstract protected boolean nodeCompare(int firstId, int secondId);
-
-}
+}
\ No newline at end of file