tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject [6/7] tinkerpop git commit: starting to move Computer out of the Bytecode picture.
Date Thu, 06 Oct 2016 23:17:10 GMT
starting to move Computer out of the Bytecode picture.


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

Branch: refs/heads/TINKERPOP-1455-redux
Commit: af97a5c9e7157996b3cf7f516ee34ee5c81895af
Parents: a33dfc0
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Thu Oct 6 15:38:19 2016 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Thu Oct 6 16:16:38 2016 -0600

----------------------------------------------------------------------
 .../tinkerpop/gremlin/process/traversal/Bytecode.java     | 10 ++++++++--
 .../tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java |  3 +++
 .../tinkerpop/gremlin/python/jsr223/PythonTranslator.java |  3 +++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af97a5c9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
index 83c802d..a19ab83 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
@@ -20,9 +20,7 @@
 package org.apache.tinkerpop.gremlin.process.traversal;
 
 import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
@@ -31,8 +29,10 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * When a {@link TraversalSource} is manipulated and then a {@link Traversal} is spawned
and mutated, a language
@@ -287,6 +287,12 @@ public final class Bytecode implements Cloneable, Serializable {
                 list.add(convertArgument(item, true));
             }
             return list;
+        } else if (argument instanceof Set) {
+            final Set<Object> set = new LinkedHashSet<>(((Set) argument).size());
+            for (final Object item : (Set) argument) {
+                set.add(convertArgument(item, true));
+            }
+            return set;
         } else
             return argument;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af97a5c9/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 9a09595..c08aebe 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
 import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
@@ -157,6 +158,8 @@ public final class GroovyTranslator implements Translator.ScriptTranslator
{
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";
         } else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
+        else if (object instanceof Computer)
+            return convertToString(ConfigurationConverter.getMap(((Computer) object).getConf()));
         else if (object instanceof TraversalStrategy) {
             final TraversalStrategy strategy = (TraversalStrategy) object;
             if (strategy.getConfiguration().isEmpty())

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af97a5c9/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 41dbe4b..b591f00 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
 import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -182,6 +183,8 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertStatic(((Enum) object).getDeclaringClass().getSimpleName() + ".")
+ SymbolHelper.toPython(object.toString());
         else if (object instanceof P)
             return convertPToString((P) object, new StringBuilder()).toString();
+        else if (object instanceof Computer)
+            return convertToString(ConfigurationConverter.getMap(((Computer) object).getConf()));
         else if (object instanceof Element)
             return convertToString(((Element) object).id()); // hack
         else if (object instanceof Bytecode)


Mime
View raw message