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 2019/12/03 17:58:59 UTC

[tinkerpop] 07/23: TINKERPOP-2235 Cleanup comments/javadoc a bit for MapStep

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch TINKERPOP-2235
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit f94956a19831706c41bf46f4d9a7c985fb576623
Author: stephen <sp...@gmail.com>
AuthorDate: Wed Nov 6 11:46:45 2019 -0500

    TINKERPOP-2235 Cleanup comments/javadoc a bit for MapStep
---
 .../gremlin/process/traversal/step/map/MapStep.java          | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MapStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MapStep.java
index 2747b9c..51535e7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MapStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MapStep.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraver
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public abstract class MapStep<S, E> extends AbstractStep<S, E> {
 
@@ -36,10 +37,6 @@ public abstract class MapStep<S, E> extends AbstractStep<S, E> {
     protected Traverser.Admin<E> processNextStart() {
         final Traverser.Admin<S> traverser = this.starts.next();
         final E obj = this.map(traverser);
-
-        // maybe looks tricky, but it's just a play on Java generics without having to tear apart every MapStep
-        // instance. basically just want to respect the fact that a subclass can return an EmptyTraverser from
-        // map() and if so, just return that empty.
         return isEmptyTraverser(obj) ? EmptyTraverser.instance() : traverser.split(obj, this);
     }
 
@@ -47,9 +44,12 @@ public abstract class MapStep<S, E> extends AbstractStep<S, E> {
 
     /**
      * Determines if the value returned from {@link #map(Traverser.Admin)} should be representative of an
-     * {@link EmptyTraverser}. Such traversers will effectively be filtered out by the traversal.
+     * {@link EmptyTraverser}. Such traversers will effectively be filtered out by the traversal. This method works in
+     * conjunction with {@link #map(Traverser.Admin)} in the sense that both work are called in the default
+     * implementation of {@link #processNextStart()} which will call this method after "map()"-ing the traverser to
+     * determine if that step consider the returned value as "empty".
      */
-    protected boolean isEmptyTraverser(E obj) {
+    protected boolean isEmptyTraverser(final E obj) {
         return false;
     }