You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2016/06/09 16:47:24 UTC

[43/50] [abbrv] incubator-tinkerpop git commit: so sorry -- I'm a mess this morning. My last commit was not valid. Parameters can have String, T, or Traversal values. Thus, ElementHelper.legalKeyValues() shouldn't be used. Fixed. CTR.

so sorry -- I'm a mess this morning. My last commit was not valid. Parameters can have String, T, or Traversal values. Thus, ElementHelper.legalKeyValues() shouldn't be used. Fixed. CTR.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f30a84a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f30a84a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f30a84a2

Branch: refs/heads/TINKERPOP-1331
Commit: f30a84a21bddeadf0be3735d6caca995c3484d0b
Parents: ecbb8e8
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Jun 8 08:07:19 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Jun 8 08:07:19 2016 -0600

----------------------------------------------------------------------
 .../process/traversal/step/util/Parameters.java        | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f30a84a2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index f55bac9..5d19d1f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -24,6 +24,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 
 import java.io.Serializable;
@@ -134,7 +136,7 @@ public final class Parameters implements Cloneable, Serializable {
      * Set parameters given key/value pairs.
      */
     public void set(final Object... keyValues) {
-        ElementHelper.legalPropertyKeyValueArray(keyValues);
+        Parameters.legalPropertyKeyValueArray(keyValues);
         for (int i = 0; i < keyValues.length; i = i + 2) {
             if (keyValues[i + 1] != null) {
                 List<Object> values = this.parameters.get(keyValues[i]);
@@ -202,4 +204,13 @@ public final class Parameters implements Cloneable, Serializable {
     public String toString() {
         return this.parameters.toString();
     }
+
+    private static void legalPropertyKeyValueArray(final Object... propertyKeyValues) throws IllegalArgumentException {
+        if (propertyKeyValues.length % 2 != 0)
+            throw Element.Exceptions.providedKeyValuesMustBeAMultipleOfTwo();
+        for (int i = 0; i < propertyKeyValues.length; i = i + 2) {
+            if (!(propertyKeyValues[i] instanceof String) && !(propertyKeyValues[i] instanceof T) && !(propertyKeyValues[i] instanceof Traversal))
+                throw new IllegalArgumentException("The provided key/value array must have a String, T, or Traversal on even array indices");
+        }
+    }
 }