You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/06/08 20:32:00 UTC
[5/8] 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/8753407c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8753407c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8753407c
Branch: refs/heads/graphml-no-edge-label
Commit: 8753407cd566e7398638bd9c3842837ad71429e2
Parents: 5ffe1a7
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Jun 8 08:07:19 2016 -0600
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jun 8 16:24:33 2016 -0400
----------------------------------------------------------------------
.../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/8753407c/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");
+ }
+ }
}