tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkupp...@apache.org
Subject [47/50] tinkerpop git commit: replaced TraversalRing's setTraversal() with replaceTraversal()
Date Fri, 04 Aug 2017 16:59:27 GMT
replaced TraversalRing's setTraversal() with replaceTraversal()


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

Branch: refs/heads/TINKERPOP-1682
Commit: 073ff2ffdc71942033541f6fce7ac9471dcf8cd1
Parents: e5e0911
Author: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Authored: Fri Jun 23 16:05:30 2017 +0200
Committer: Daniel Kuppitz <daniel_kuppitz@hotmail.com>
Committed: Fri Aug 4 09:58:05 2017 -0700

----------------------------------------------------------------------
 .../process/traversal/step/filter/PathFilterStep.java    | 11 +++--------
 .../traversal/step/filter/WherePredicateStep.java        | 11 +++--------
 .../gremlin/process/traversal/step/map/PathStep.java     | 11 +++--------
 .../gremlin/process/traversal/step/map/ProjectStep.java  | 11 +++--------
 .../gremlin/process/traversal/step/map/SelectStep.java   | 11 +++--------
 .../gremlin/process/traversal/step/map/TreeStep.java     | 11 +++--------
 .../traversal/step/sideEffect/TreeSideEffectStep.java    | 11 +++--------
 .../gremlin/process/traversal/util/TraversalRing.java    | 10 ++++++++--
 8 files changed, 29 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
index 1631f70..e3280d9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/PathFilterStep.java
@@ -109,14 +109,9 @@ public final class PathFilterStep<S> extends FilterStep<S>
implements FromToModu
 
     @Override
     public void replaceLocalChild(final Traversal.Admin<?, ?> oldTraversal, final Traversal.Admin<?,
?> newTraversal) {
-        int i = 0;
-        for (final Traversal.Admin<?, ?> traversal : this.traversalRing.getTraversals())
{
-            if (null != traversal && traversal.equals(oldTraversal)) {
-                this.traversalRing.setTraversal(i, this.integrateChild(newTraversal));
-                break;
-            }
-            i++;
-        }
+        this.traversalRing.replaceTraversal(
+                (Traversal.Admin<Object, Object>) oldTraversal,
+                (Traversal.Admin<Object, Object>) newTraversal);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
index f386219..4351272 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
@@ -166,13 +166,8 @@ public final class WherePredicateStep<S> extends FilterStep<S>
implements Scopin
 
     @Override
     public void replaceLocalChild(final Traversal.Admin<?, ?> oldTraversal, final Traversal.Admin<?,
?> newTraversal) {
-        int i = 0;
-        for (final Traversal.Admin<?, ?> traversal : this.traversalRing.getTraversals())
{
-            if (null != traversal && traversal.equals(oldTraversal)) {
-                this.traversalRing.setTraversal(i, this.integrateChild(newTraversal));
-                break;
-            }
-            i++;
-        }
+        this.traversalRing.replaceTraversal(
+                (Traversal.Admin) oldTraversal,
+                (Traversal.Admin) newTraversal);
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
index 3645007..9dcd6fb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PathStep.java
@@ -99,14 +99,9 @@ public final class PathStep<S> extends MapStep<S, Path> implements
TraversalPare
 
     @Override
     public void replaceLocalChild(final Traversal.Admin<?, ?> oldTraversal, final Traversal.Admin<?,
?> newTraversal) {
-        int i = 0;
-        for (final Traversal.Admin<?, ?> traversal : this.traversalRing.getTraversals())
{
-            if (null != traversal && traversal.equals(oldTraversal)) {
-                this.traversalRing.setTraversal(i, this.integrateChild(newTraversal));
-                break;
-            }
-            i++;
-        }
+        this.traversalRing.replaceTraversal(
+                (Traversal.Admin<Object, Object>) oldTraversal,
+                (Traversal.Admin<Object, Object>) newTraversal);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
index 380a64a..f31d587 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
@@ -99,14 +99,9 @@ public final class ProjectStep<S, E> extends MapStep<S, Map<String,
E>> implemen
 
     @Override
     public void replaceLocalChild(final Traversal.Admin<?, ?> oldTraversal, final Traversal.Admin<?,
?> newTraversal) {
-        int i = 0;
-        for (final Traversal.Admin<?, ?> traversal : this.traversalRing.getTraversals())
{
-            if (null != traversal && traversal.equals(oldTraversal)) {
-                this.traversalRing.setTraversal(i, this.integrateChild(newTraversal));
-                break;
-            }
-            i++;
-        }
+        this.traversalRing.replaceTraversal(
+                (Traversal.Admin<S, E>) oldTraversal,
+                (Traversal.Admin<S, E>) newTraversal);
     }
 
     public List<String> getProjectKeys() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
index 57fe488..bdbbe07 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
@@ -119,14 +119,9 @@ public final class SelectStep<S, E> extends MapStep<S, Map<String,
E>> implement
 
     @Override
     public void replaceLocalChild(final Traversal.Admin<?, ?> oldTraversal, final Traversal.Admin<?,
?> newTraversal) {
-        int i = 0;
-        for (final Traversal.Admin<?, ?> traversal : this.traversalRing.getTraversals())
{
-            if (null != traversal && traversal.equals(oldTraversal)) {
-                this.traversalRing.setTraversal(i, this.integrateChild(newTraversal));
-                break;
-            }
-            i++;
-        }
+        this.traversalRing.replaceTraversal(
+                (Traversal.Admin<Object, E>) oldTraversal,
+                (Traversal.Admin<Object, E>) newTraversal);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
index 1950222..6938f4b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TreeStep.java
@@ -64,14 +64,9 @@ public final class TreeStep<S> extends ReducingBarrierStep<S,
Tree> implements T
 
     @Override
     public void replaceLocalChild(final Traversal.Admin<?, ?> oldTraversal, final Traversal.Admin<?,
?> newTraversal) {
-        int i = 0;
-        for (final Traversal.Admin<?, ?> traversal : this.traversalRing.getTraversals())
{
-            if (null != traversal && traversal.equals(oldTraversal)) {
-                this.traversalRing.setTraversal(i, this.integrateChild(newTraversal));
-                break;
-            }
-            i++;
-        }
+        this.traversalRing.replaceTraversal(
+                (Traversal.Admin<Object, Object>) oldTraversal,
+                (Traversal.Admin<Object, Object>) newTraversal);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
index c0db156..8e2d64d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/TreeSideEffectStep.java
@@ -119,14 +119,9 @@ public final class TreeSideEffectStep<S> extends SideEffectStep<S>
implements Si
 
     @Override
     public void replaceLocalChild(final Traversal.Admin<?, ?> oldTraversal, final Traversal.Admin<?,
?> newTraversal) {
-        int i = 0;
-        for (final Traversal.Admin<?, ?> traversal : this.traversalRing.getTraversals())
{
-            if (null != traversal && traversal.equals(oldTraversal)) {
-                this.traversalRing.setTraversal(i, this.integrateChild(newTraversal));
-                break;
-            }
-            i++;
-        }
+        this.traversalRing.replaceTraversal(
+                (Traversal.Admin<Object, Object>) oldTraversal,
+                (Traversal.Admin<Object, Object>) newTraversal);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/073ff2ff/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalRing.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalRing.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalRing.java
index a3d6972..bbdf701 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalRing.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalRing.java
@@ -24,6 +24,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -62,8 +63,13 @@ public final class TraversalRing<A, B> implements Serializable, Cloneable
{
         this.traversals.add(traversal);
     }
 
-    public void setTraversal(final int index, final Traversal.Admin<A, B> traversal)
{
-        this.traversals.set(index, traversal);
+    public void replaceTraversal(final Traversal.Admin<A, B> oldTraversal, final Traversal.Admin<A,
B> newTraversal) {
+        for (int i = 0, j = this.traversals.size(); i < j; i++) {
+            if (Objects.equals(oldTraversal, this.traversals.get(i))) {
+                this.traversals.set(i, newTraversal);
+                break;
+            }
+        }
     }
 
     public List<Traversal.Admin<A, B>> getTraversals() {


Mime
View raw message