You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/03/19 19:26:54 UTC

[36/40] incubator-tinkerpop git commit: the traversal steps provided by TinkerPop are the foundation for all dsl. GraphTraversal is just a dsl of traversal. Refactored the process API to reflect this concept. Fixed #592.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/TimeLimitStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/TimeLimitStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/TimeLimitStep.java
deleted file mode 100644
index de505ec..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/TimeLimitStep.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter;
-
-import org.apache.tinkerpop.gremlin.process.FastNoSuchElementException;
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * @author Randall Barnhart (random pi)
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public final class TimeLimitStep<S> extends FilterStep<S> {
-
-    private AtomicLong startTime = new AtomicLong(-1);
-    private final long timeLimit;
-    private AtomicBoolean timedOut = new AtomicBoolean(false);
-
-
-    public TimeLimitStep(final Traversal.Admin traversal, final long timeLimit) {
-        super(traversal);
-        this.timeLimit = timeLimit;
-    }
-
-    @Override
-    protected boolean filter(final Traverser.Admin<S> traverser) {
-        if (this.startTime.get() == -1l)
-            this.startTime.set(System.currentTimeMillis());
-        if ((System.currentTimeMillis() - this.startTime.get()) >= this.timeLimit) {
-            this.timedOut.set(true);
-            throw FastNoSuchElementException.instance();
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.timeLimit);
-    }
-
-    @Override
-    public void reset() {
-        super.reset();
-        this.startTime.set(-1l);
-        this.timedOut.set(false);
-    }
-
-    public boolean getTimedOut() {
-        return this.timedOut.get();
-    }
-
-    @Override
-    public TimeLimitStep<S> clone() {
-        final TimeLimitStep<S> clone = (TimeLimitStep<S>) super.clone();
-        clone.timedOut = new AtomicBoolean(this.timedOut.get());
-        clone.startTime = new AtomicLong(this.startTime.get());
-        return clone;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/WhereStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/WhereStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/WhereStep.java
deleted file mode 100644
index 1477d11..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/filter/WhereStep.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter;
-
-import org.apache.tinkerpop.gremlin.process.Step;
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.MarkerIdentityStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiPredicate;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class WhereStep<E> extends FilterStep<Map<String, E>> implements TraversalParent {
-
-    private final String firstKey;
-    private final String secondKey;
-    private final BiPredicate biPredicate;
-    private Traversal.Admin constraint;
-
-
-    public WhereStep(final Traversal.Admin traversal, final String firstKey, final String secondKey, final BiPredicate<E, E> biPredicate) {
-        super(traversal);
-        this.firstKey = firstKey;
-        this.secondKey = secondKey;
-        this.biPredicate = biPredicate;
-        this.constraint = null;
-    }
-
-    public WhereStep(final Traversal.Admin traversal, final Traversal.Admin constraint) {
-        super(traversal);
-        this.firstKey = null;
-        this.secondKey = null;
-        this.biPredicate = null;
-        this.constraint = this.integrateChild(constraint);
-    }
-
-    @Override
-    protected boolean filter(final Traverser.Admin<Map<String, E>> traverser) {
-        if (null == this.constraint) {
-            final Map<String, E> map = traverser.get();
-            if (!map.containsKey(this.firstKey))
-                throw new IllegalArgumentException("The provided key is not in the current map: " + this.firstKey);
-            if (!map.containsKey(this.secondKey))
-                throw new IllegalArgumentException("The provided key is not in the current map: " + this.secondKey);
-            return this.biPredicate.test(map.get(this.firstKey), map.get(this.secondKey));
-        } else {
-            final Step<?, ?> startStep = this.constraint.getStartStep();
-            Step<?, ?> endStep = this.constraint.getEndStep();
-            if (endStep instanceof MarkerIdentityStep) // DAH!
-                endStep = endStep.getPreviousStep();
-
-            final Map<String, E> map = traverser.get();
-            if (!map.containsKey(startStep.getLabel().get()))
-                throw new IllegalArgumentException("The provided key is not in the current map: " + startStep.getLabel().get());
-            final Object startObject = map.get(startStep.getLabel().get());
-            final Object endObject;
-            if (endStep.getLabel().isPresent()) {
-                if (!map.containsKey(endStep.getLabel().get()))
-                    throw new IllegalArgumentException("The provided key is not in the current map: " + endStep.getLabel().get());
-                endObject = map.get(endStep.getLabel().get());
-            } else
-                endObject = null;
-
-            startStep.addStart(this.getTraversal().asAdmin().getTraverserGenerator().generate(startObject, (Step) startStep, traverser.bulk()));
-            if (null == endObject) {
-                if (this.constraint.hasNext()) {
-                    this.constraint.reset();
-                    return true;
-                } else {
-                    return false;
-                }
-
-            } else {
-                while (this.constraint.hasNext()) {
-                    if (this.constraint.next().equals(endObject)) {
-                        this.constraint.reset();
-                        return true;
-                    }
-                }
-                return false;
-            }
-        }
-    }
-
-    @Override
-    public List<Traversal.Admin> getLocalChildren() {
-        return null == this.constraint ? Collections.emptyList() : Collections.singletonList(this.constraint);
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.firstKey, this.biPredicate, this.secondKey, this.constraint);
-    }
-
-    @Override
-    public WhereStep<E> clone() {
-        final WhereStep<E> clone = (WhereStep<E>) super.clone();
-        if (null != this.constraint)
-            clone.constraint = clone.integrateChild(this.constraint.clone());
-        return clone;
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeByPathStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeByPathStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeByPathStep.java
deleted file mode 100644
index 6f493d1..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeByPathStep.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.Mutating;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class AddEdgeByPathStep extends MapStep<Vertex, Edge> implements Mutating {
-
-    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
-            TraverserRequirement.PATH,
-            TraverserRequirement.OBJECT
-    );
-
-    // TODO: Weight key based on Traverser.getCount() ?
-
-    private final Direction direction;
-    private final String edgeLabel;
-    private final String stepLabel;
-    private final Object[] keyValues;
-
-    public AddEdgeByPathStep(final Traversal.Admin traversal, final Direction direction, final String edgeLabel, final String stepLabel, final Object... keyValues) {
-        super(traversal);
-        this.direction = direction;
-        if (this.direction.equals(Direction.BOTH))
-            throw new IllegalArgumentException("Only in- and out- directions are supported by " + AddEdgeByPathStep.class.getSimpleName());
-        this.edgeLabel = edgeLabel;
-        this.stepLabel = stepLabel;
-        this.keyValues = keyValues;
-    }
-
-    public Direction getDirection() {
-        return direction;
-    }
-
-    public String getEdgeLabel() {
-        return edgeLabel;
-    }
-
-    public String getStepLabel() {
-        return stepLabel;
-    }
-
-    public Object[] getKeyValues() {
-        return keyValues;
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.direction.name(), this.edgeLabel, this.stepLabel);
-    }
-
-    @Override
-    protected Edge map(Traverser.Admin<Vertex> traverser) {
-        final Vertex currentVertex = traverser.get();
-        final Vertex otherVertex = traverser.path().get(this.stepLabel);
-        if (this.direction.equals(Direction.IN))
-            return otherVertex.addEdge(this.edgeLabel, currentVertex, this.keyValues);
-        else
-            return currentVertex.addEdge(this.edgeLabel, otherVertex, this.keyValues);
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return REQUIREMENTS;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.java
deleted file mode 100644
index 6c5dc6d..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddEdgeStep.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.Mutating;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class AddEdgeStep extends FlatMapStep<Vertex, Edge> implements Mutating {
-
-    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(TraverserRequirement.OBJECT);
-
-    private final String edgeLabel;
-    private final Object[] keyValues;
-    private final List<Vertex> vertices;
-    private final Direction direction;
-
-    public AddEdgeStep(final Traversal.Admin traversal, final Direction direction, final String edgeLabel, final Vertex vertex, final Object... keyValues) {
-        this(traversal, direction, edgeLabel, IteratorUtils.of(vertex), keyValues);
-    }
-
-    public AddEdgeStep(final Traversal.Admin traversal, final Direction direction, final String edgeLabel, final Iterator<Vertex> vertices, final Object... keyValues) {
-        super(traversal);
-        this.direction = direction;
-        this.edgeLabel = edgeLabel;
-        this.vertices = IteratorUtils.list(vertices);
-        this.keyValues = keyValues;
-    }
-
-    public Direction getDirection() {
-        return direction;
-    }
-
-    public String getEdgeLabel() {
-        return edgeLabel;
-    }
-
-    public Object[] getKeyValues() {
-        return keyValues;
-    }
-
-    public List<Vertex> getVertices() {
-        return vertices;
-    }
-
-    @Override
-    protected Iterator<Edge> flatMap(final Traverser.Admin<Vertex> traverser) {
-        return IteratorUtils.map(this.vertices.iterator(), this.direction.equals(Direction.OUT) ?
-                vertex -> traverser.get().addEdge(this.edgeLabel, vertex, this.keyValues) :
-                vertex -> vertex.addEdge(this.edgeLabel, traverser.get(), this.keyValues));
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return REQUIREMENTS;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStartStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStartStep.java
deleted file mode 100644
index 363a4bc..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStartStep.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.FastNoSuchElementException;
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.Mutating;
-import org.apache.tinkerpop.gremlin.process.traversal.step.AbstractStep;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex> implements Mutating {
-
-    private final Object[] keyValues;
-    private boolean first = true;
-
-    public AddVertexStartStep(final Traversal.Admin traversal, final Object... keyValues) {
-        super(traversal);
-        this.keyValues = keyValues;
-    }
-
-    public Object[] getKeyValues() {
-        return keyValues;
-    }
-
-    @Override
-    protected Traverser<Vertex> processNextStart() {
-        if (this.first) {
-            this.first = false;
-            return this.getTraversal().getTraverserGenerator().generate(this.getTraversal().getGraph().get().addVertex(this.keyValues), this, 1l);
-        } else
-            throw FastNoSuchElementException.instance();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java
deleted file mode 100644
index 363a3e6..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/AddVertexStep.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.Mutating;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class AddVertexStep<S> extends MapStep<S, Vertex> implements Mutating {
-
-    private final Object[] keyValues;
-    private final transient Graph graph;
-
-    public AddVertexStep(final Traversal.Admin traversal, final Object... keyValues) {
-        super(traversal);
-        this.keyValues = keyValues;
-        this.graph = this.getTraversal().getGraph().get();
-    }
-
-    public Object[] getKeyValues() {
-        return keyValues;
-    }
-
-    @Override
-    protected Vertex map(final Traverser.Admin<S> traverser) {
-        return this.graph.addVertex(this.keyValues);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackStep.java
deleted file mode 100644
index 6a4c4c1..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackStep.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.TraversalEngine;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.EngineDependent;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class BackStep<S, E> extends MapStep<S, E> implements EngineDependent {
-
-    private final String stepLabel;
-    private boolean requiresPaths = false;
-
-    public BackStep(final Traversal.Admin traversal, final String stepLabel) {
-        super(traversal);
-        this.stepLabel = stepLabel;
-    }
-
-    @Override
-    protected E map(final Traverser.Admin<S> traverser) {
-        return traverser.path(this.stepLabel);
-    }
-
-    @Override
-    public void onEngine(final TraversalEngine traversalEngine) {
-        this.requiresPaths = traversalEngine.isComputer();
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        //return this.requiresPaths ? Collections.singleton(TraverserRequirement.PATH) : Collections.singleton(TraverserRequirement.PATH_ACCESS);
-        return Collections.singleton(TraverserRequirement.PATH); // TODO: if the traversal isn't nested, path access works
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.stepLabel);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CoalesceStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CoalesceStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CoalesceStep.java
deleted file mode 100644
index 26f8488..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CoalesceStep.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.util.iterator.EmptyIterator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public final class CoalesceStep<S, E> extends FlatMapStep<S, E> implements TraversalParent {
-
-    private List<Traversal.Admin<S, E>> coalesceTraversals;
-
-    @SafeVarargs
-    public CoalesceStep(final Traversal.Admin traversal, final Traversal.Admin<S, E>... coalesceTraversals) {
-        super(traversal);
-        this.coalesceTraversals = Arrays.asList(coalesceTraversals);
-        for (final Traversal.Admin<S, ?> conjunctionTraversal : this.coalesceTraversals) {
-            this.integrateChild(conjunctionTraversal);
-        }
-    }
-
-    @Override
-    protected Iterator<E> flatMap(final Traverser.Admin<S> traverser) {
-        for (final Traversal.Admin<S, E> coalesceTraversal : this.coalesceTraversals) {
-            coalesceTraversal.reset();
-            coalesceTraversal.addStart(traverser.asAdmin().split());
-            if (coalesceTraversal.hasNext())
-                return coalesceTraversal;
-        }
-        return EmptyIterator.instance();
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return this.getSelfAndChildRequirements();
-    }
-
-    @Override
-    public List<Traversal.Admin<S, E>> getLocalChildren() {
-        return Collections.unmodifiableList(this.coalesceTraversals);
-    }
-
-    @Override
-    public CoalesceStep<S, E> clone() {
-        final CoalesceStep<S, E> clone = (CoalesceStep<S, E>) super.clone();
-        clone.coalesceTraversals = new ArrayList<>();
-        for (final Traversal.Admin<S, ?> conjunctionTraversal : this.coalesceTraversals) {
-            clone.coalesceTraversals.add(clone.integrateChild(conjunctionTraversal.clone()));
-        }
-        return clone;
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.coalesceTraversals);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountGlobalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountGlobalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountGlobalStep.java
deleted file mode 100644
index e54c96f..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountGlobalStep.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.computer.KeyValue;
-import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.util.StaticMapReduce;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.MapReducer;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.process.util.TraverserSet;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
-
-import java.io.Serializable;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class CountGlobalStep<S> extends ReducingBarrierStep<S, Long> implements MapReducer {
-
-    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(TraverserRequirement.BULK);
-
-    public CountGlobalStep(final Traversal.Admin traversal) {
-        super(traversal);
-        this.setSeedSupplier(new ConstantSupplier<>(0L));
-        this.setBiFunction(CountBiFunction.<S>instance());
-    }
-
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return REQUIREMENTS;
-    }
-
-    @Override
-    public MapReduce<MapReduce.NullObject, Long, MapReduce.NullObject, Long, Long> getMapReduce() {
-        return CountGlobalMapReduce.instance();
-    }
-
-    ///////////
-
-    private static class CountBiFunction<S> implements BiFunction<Long, Traverser<S>, Long>, Serializable {
-
-        private static final CountBiFunction INSTANCE = new CountBiFunction();
-
-        private CountBiFunction() {
-
-        }
-
-        @Override
-        public Long apply(final Long mutatingSeed, final Traverser<S> traverser) {
-            return mutatingSeed + traverser.bulk();
-        }
-
-        public final static <S> CountBiFunction<S> instance() {
-            return INSTANCE;
-        }
-    }
-
-    ///////////
-
-    private static class CountGlobalMapReduce extends StaticMapReduce<MapReduce.NullObject, Long, MapReduce.NullObject, Long, Long> {
-
-        private static CountGlobalMapReduce INSTANCE = new CountGlobalMapReduce();
-
-        private CountGlobalMapReduce() {
-
-        }
-
-        @Override
-        public boolean doStage(final MapReduce.Stage stage) {
-            return true;
-        }
-
-        @Override
-        public void map(final Vertex vertex, final MapEmitter<NullObject, Long> emitter) {
-            vertex.<TraverserSet<?>>property(TraversalVertexProgram.HALTED_TRAVERSERS).ifPresent(traverserSet -> traverserSet.forEach(traverser -> emitter.emit(traverser.bulk())));
-        }
-
-        @Override
-        public void combine(final NullObject key, final Iterator<Long> values, final ReduceEmitter<NullObject, Long> emitter) {
-            this.reduce(key, values, emitter);
-        }
-
-        @Override
-        public void reduce(final NullObject key, final Iterator<Long> values, final ReduceEmitter<NullObject, Long> emitter) {
-            long count = 0l;
-            while (values.hasNext()) {
-                count = count + values.next();
-            }
-            emitter.emit(count);
-        }
-
-        @Override
-        public String getMemoryKey() {
-            return REDUCING;
-        }
-
-        @Override
-        public Long generateFinalResult(final Iterator<KeyValue<NullObject, Long>> keyValues) {
-            return keyValues.hasNext() ? keyValues.next().getValue() : 0L;
-        }
-
-        public static final CountGlobalMapReduce instance() {
-            return INSTANCE;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountLocalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountLocalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountLocalStep.java
deleted file mode 100644
index 14c2a8c..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/CountLocalStep.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public final class CountLocalStep<S> extends MapStep<S, Long> {
-
-    public CountLocalStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected Long map(final Traverser.Admin<S> traverser) {
-        final S item = traverser.get();
-        return (item instanceof Collection) ? ((Collection) item).size()
-                : (item instanceof Map) ? ((Map) item).size() : 1L;
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/DedupLocalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/DedupLocalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/DedupLocalStep.java
deleted file mode 100644
index bfff34e..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/DedupLocalStep.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public final class DedupLocalStep<E, S extends Iterable<E>> extends MapStep<S, Set<E>> {
-
-    public DedupLocalStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected Set<E> map(final Traverser.Admin<S> traverser) {
-        final Set<E> result = new LinkedHashSet<>();
-        for (final E item : traverser.get()) {
-            result.add(item);
-        }
-        return result;
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java
deleted file mode 100644
index 7afc504..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class EdgeOtherVertexStep extends MapStep<Edge, Vertex> {
-
-    public EdgeOtherVertexStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected Vertex map(final Traverser.Admin<Edge> traverser) {
-        final List<Object> objects = traverser.path().objects();
-        for (int i = objects.size() - 2; i >= 0; i--) {
-            if (objects.get(i) instanceof Vertex) {
-                return ElementHelper.areEqual((Vertex) objects.get(i), traverser.get().outVertex()) ?
-                        traverser.get().inVertex() :
-                        traverser.get().outVertex();
-            }
-        }
-        throw new IllegalStateException("The path history of the traverser does not contain a previous vertex: " + traverser.path());
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.PATH);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java
deleted file mode 100644
index 5281999..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class EdgeVertexStep extends FlatMapStep<Edge, Vertex> {
-
-    private Direction direction;
-
-    public EdgeVertexStep(final Traversal.Admin traversal, final Direction direction) {
-        super(traversal);
-        this.direction = direction;
-    }
-
-    @Override
-    protected Iterator<Vertex> flatMap(final Traverser.Admin<Edge> traverser) {
-        return traverser.get().vertices(this.direction);
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.direction);
-    }
-
-    public Direction getDirection() {
-        return this.direction;
-    }
-
-    public void reverseDirection() {
-        this.direction = this.direction.opposite();
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FlatMapStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FlatMapStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FlatMapStep.java
deleted file mode 100644
index 60ea9e3..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FlatMapStep.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.AbstractStep;
-import org.apache.tinkerpop.gremlin.util.iterator.EmptyIterator;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public abstract class FlatMapStep<S, E> extends AbstractStep<S, E> {
-
-    private Traverser.Admin<S> head = null;
-    private Iterator<E> iterator = EmptyIterator.instance();
-
-    public FlatMapStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected Traverser<E> processNextStart() {
-        while (true) {
-            if (this.iterator.hasNext()) {
-                return this.head.split(this.iterator.next(), this);
-            } else {
-                this.head = this.starts.next();
-                this.iterator = this.flatMap(this.head);
-            }
-        }
-    }
-
-    protected abstract Iterator<E> flatMap(final Traverser.Admin<S> traverser);
-
-    @Override
-    public void reset() {
-        super.reset();
-        this.iterator = EmptyIterator.instance();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FoldStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FoldStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FoldStep.java
deleted file mode 100644
index 885c2fe..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/FoldStep.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.util.function.ArrayListSupplier;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.Set;
-import java.util.function.BiFunction;
-import java.util.function.Supplier;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class FoldStep<S, E> extends ReducingBarrierStep<S, E> {
-
-    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(TraverserRequirement.OBJECT);
-
-    public FoldStep(final Traversal.Admin traversal) {
-        this(traversal, (Supplier) ArrayListSupplier.instance(), (BiFunction) ArrayListBiFunction.instance());
-    }
-
-    public FoldStep(final Traversal.Admin traversal, final Supplier<E> seed, final BiFunction<E, S, E> foldFunction) {
-        super(traversal);
-        this.setSeedSupplier(seed);
-        this.setBiFunction(new FoldBiFunction<>(foldFunction));
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return REQUIREMENTS;
-    }
-
-    /////////
-
-    private static class ArrayListBiFunction<S> implements BiFunction<ArrayList<S>, S, ArrayList<S>>, Serializable {
-
-        private static final ArrayListBiFunction INSTANCE = new ArrayListBiFunction();
-
-        private ArrayListBiFunction() {
-
-        }
-
-        @Override
-        public ArrayList<S> apply(final ArrayList<S> mutatingSeed, final S traverser) {
-            mutatingSeed.add(traverser);
-            return mutatingSeed;
-        }
-
-        public final static <S> ArrayListBiFunction<S> instance() {
-            return INSTANCE;
-        }
-    }
-
-    ///////
-
-    public static class FoldBiFunction<S, E> implements BiFunction<E, Traverser<S>, E>, Serializable {
-
-        private final BiFunction<E, S, E> biFunction;
-
-        public FoldBiFunction(final BiFunction<E, S, E> biFunction) {
-            this.biFunction = biFunction;
-        }
-
-        @Override
-        public E apply(final E seed, final Traverser<S> traverser) {
-            return this.biFunction.apply(seed, traverser.get());
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupCountStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupCountStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupCountStep.java
deleted file mode 100644
index 852869b..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupCountStep.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.computer.KeyValue;
-import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.util.StaticMapReduce;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.MapReducer;
-import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.process.util.MapHelper;
-import org.apache.tinkerpop.gremlin.process.util.TraverserSet;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.function.HashMapSupplier;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class GroupCountStep<S, E> extends ReducingBarrierStep<S, Map<E, Long>> implements MapReducer, TraversalParent {
-
-    private Traversal.Admin<S, E> groupTraversal = null;
-
-    public GroupCountStep(final Traversal.Admin traversal) {
-        super(traversal);
-        this.setSeedSupplier(HashMapSupplier.instance());
-        this.setBiFunction(new GroupCountBiFunction());
-    }
-
-
-    @Override
-    public void addLocalChild(final Traversal.Admin<?, ?> groupTraversal) {
-        this.groupTraversal = this.integrateChild(groupTraversal);
-    }
-
-    @Override
-    public List<Traversal.Admin<S, E>> getLocalChildren() {
-        return null == this.groupTraversal ? Collections.emptyList() : Collections.singletonList(this.groupTraversal);
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return this.getSelfAndChildRequirements(TraverserRequirement.BULK);
-    }
-
-    @Override
-    public MapReduce<E, Long, E, Long, Map<E, Long>> getMapReduce() {
-        return GroupCountMapReduce.instance();
-    }
-
-    @Override
-    public GroupCountStep<S, E> clone() {
-        final GroupCountStep<S, E> clone = (GroupCountStep<S, E>) super.clone();
-        if (null != this.groupTraversal)
-            clone.groupTraversal = clone.integrateChild(this.groupTraversal.clone());
-        return clone;
-    }
-
-    @Override
-    public Traverser<Map<E, Long>> processNextStart() {
-        if (this.byPass) {
-            final Traverser.Admin<S> traverser = this.starts.next();
-            return traverser.asAdmin().split(TraversalUtil.applyNullable(traverser, (Traversal.Admin<S, Map<E, Long>>) this.groupTraversal), this);
-        } else {
-            return super.processNextStart();
-        }
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.groupTraversal);
-    }
-
-    ///////////
-
-    private class GroupCountBiFunction implements BiFunction<Map<E, Long>, Traverser<S>, Map<E, Long>>, Serializable {
-
-        private GroupCountBiFunction() {
-
-        }
-
-        @Override
-        public Map<E, Long> apply(final Map<E, Long> mutatingSeed, final Traverser<S> traverser) {
-            MapHelper.incr(mutatingSeed, TraversalUtil.applyNullable(traverser.asAdmin(), GroupCountStep.this.groupTraversal), traverser.bulk());
-            return mutatingSeed;
-        }
-    }
-
-    ///////////
-
-    public static final class GroupCountMapReduce<E> extends StaticMapReduce<E, Long, E, Long, Map<E, Long>> {
-
-        private static final GroupCountMapReduce INSTANCE = new GroupCountMapReduce();
-
-        private GroupCountMapReduce() {
-
-        }
-
-        @Override
-        public boolean doStage(final Stage stage) {
-            return true;
-        }
-
-        @Override
-        public void map(final Vertex vertex, final MapEmitter<E, Long> emitter) {
-            vertex.<TraverserSet<E>>property(TraversalVertexProgram.HALTED_TRAVERSERS).ifPresent(traverserSet -> traverserSet.forEach(traverser -> emitter.emit(traverser.get(), traverser.bulk())));
-        }
-
-        @Override
-        public void reduce(final E key, final Iterator<Long> values, final ReduceEmitter<E, Long> emitter) {
-            long counter = 0;
-            while (values.hasNext()) {
-                counter = counter + values.next();
-            }
-            emitter.emit(key, counter);
-        }
-
-        @Override
-        public void combine(final E key, final Iterator<Long> values, final ReduceEmitter<E, Long> emitter) {
-            reduce(key, values, emitter);
-        }
-
-        @Override
-        public Map<E, Long> generateFinalResult(final Iterator<KeyValue<E, Long>> keyValues) {
-            final Map<E, Long> map = new HashMap<>();
-            keyValues.forEachRemaining(keyValue -> map.put(keyValue.getKey(), keyValue.getValue()));
-            return map;
-        }
-
-        @Override
-        public String getMemoryKey() {
-            return REDUCING;
-        }
-
-        public static final <E> GroupCountMapReduce<E> instance() {
-            return INSTANCE;
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupStep.java
deleted file mode 100644
index 5d26384..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/GroupStep.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.tinkerpop.gremlin.process.Step;
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.computer.KeyValue;
-import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalMatrix;
-import org.apache.tinkerpop.gremlin.process.traversal.step.MapReducer;
-import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.process.util.BulkSet;
-import org.apache.tinkerpop.gremlin.process.util.TraverserSet;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiFunction;
-import java.util.function.Supplier;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class GroupStep<S, K, V, R> extends ReducingBarrierStep<S, Map<K, R>> implements MapReducer, TraversalParent {
-
-    private char state = 'k';
-
-    private Traversal.Admin<S, K> keyTraversal = null;
-    private Traversal.Admin<S, V> valueTraversal = null;
-    private Traversal.Admin<Collection<V>, R> reduceTraversal = null;
-
-    public GroupStep(final Traversal.Admin traversal) {
-        super(traversal);
-        this.setSeedSupplier((Supplier) new GroupMapSupplier());
-        this.setBiFunction((BiFunction) new GroupBiFunction());
-    }
-
-    @Override
-    public <A, B> List<Traversal.Admin<A, B>> getLocalChildren() {
-        final List<Traversal.Admin<A, B>> children = new ArrayList<>(3);
-        if (null != this.keyTraversal)
-            children.add((Traversal.Admin) this.keyTraversal);
-        if (null != this.valueTraversal)
-            children.add((Traversal.Admin) this.valueTraversal);
-        if (null != this.reduceTraversal)
-            children.add((Traversal.Admin) this.reduceTraversal);
-        return children;
-    }
-
-    public Traversal.Admin<Collection<V>, R> getReduceTraversal() {
-        return this.reduceTraversal;
-    }
-
-    @Override
-    public void addLocalChild(final Traversal.Admin<?, ?> kvrTraversal) {
-        if ('k' == this.state) {
-            this.keyTraversal = this.integrateChild(kvrTraversal);
-            this.state = 'v';
-        } else if ('v' == this.state) {
-            this.valueTraversal = this.integrateChild(kvrTraversal);
-            this.state = 'r';
-        } else if ('r' == this.state) {
-            this.reduceTraversal = this.integrateChild(kvrTraversal);
-            this.state = 'x';
-        } else {
-            throw new IllegalStateException("The key, value, and reduce functions for group()-step have already been set");
-        }
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return this.getSelfAndChildRequirements(TraverserRequirement.SIDE_EFFECTS, TraverserRequirement.BULK);
-    }
-
-    @Override
-    public GroupStep<S, K, V, R> clone() {
-        final GroupStep<S, K, V, R> clone = (GroupStep<S, K, V, R>) super.clone();
-        if (null != this.keyTraversal)
-            clone.keyTraversal = clone.integrateChild(this.keyTraversal.clone());
-        if (null != this.valueTraversal)
-            clone.valueTraversal = clone.integrateChild(this.valueTraversal.clone());
-        if (null != this.reduceTraversal)
-            clone.reduceTraversal = clone.integrateChild(this.reduceTraversal.clone());
-        return clone;
-    }
-
-    @Override
-    public MapReduce<K, Collection<V>, K, R, Map<K, R>> getMapReduce() {
-        return new GroupMapReduce<>(this);
-    }
-
-    @Override
-    public Traverser<Map<K, R>> processNextStart() {
-        if (this.byPass) {
-            final Traverser.Admin<S> traverser = this.starts.next();
-            final Object[] kvPair = new Object[]{TraversalUtil.applyNullable(traverser, (Traversal.Admin<S, Map>) this.keyTraversal), TraversalUtil.applyNullable(traverser, (Traversal.Admin<S, Map>) this.valueTraversal)};
-            return traverser.asAdmin().split(kvPair, (Step) this);
-        } else {
-            return super.processNextStart();
-        }
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.keyTraversal, this.valueTraversal, this.reduceTraversal);
-    }
-
-    ///////////
-
-    private class GroupBiFunction implements BiFunction<Map<K, Collection<V>>, Traverser.Admin<S>, Map<K, Collection<V>>>, Serializable {
-
-        private GroupBiFunction() {
-
-        }
-
-        @Override
-        public Map<K, Collection<V>> apply(final Map<K, Collection<V>> mutatingSeed, final Traverser.Admin<S> traverser) {
-            final K key = TraversalUtil.applyNullable(traverser, GroupStep.this.keyTraversal);
-            final V value = TraversalUtil.applyNullable(traverser, GroupStep.this.valueTraversal);
-            Collection<V> values = mutatingSeed.get(key);
-            if (null == values) {
-                values = new BulkSet<>();
-                mutatingSeed.put(key, values);
-            }
-            TraversalHelper.addToCollectionUnrollIterator(values, value, traverser.bulk());
-            return mutatingSeed;
-        }
-    }
-
-    //////////
-
-    private class GroupMap extends HashMap<K, Collection<V>> implements FinalGet<Map<K, R>> {
-
-        @Override
-        public Map<K, R> getFinal() {
-            if (null == GroupStep.this.reduceTraversal)
-                return (Map<K, R>) this;
-            else {
-                final Map<K, R> reduceMap = new HashMap<>();
-                this.forEach((k, vv) -> reduceMap.put(k, TraversalUtil.applyNullable(vv, GroupStep.this.reduceTraversal)));
-                return reduceMap;
-            }
-        }
-    }
-
-    private class GroupMapSupplier implements Supplier<GroupMap>, Serializable {
-
-        private GroupMapSupplier() {
-        }
-
-        @Override
-        public GroupMap get() {
-            return new GroupMap();
-        }
-    }
-
-    ///////////
-
-    public static final class GroupMapReduce<K, V, R> implements MapReduce<K, Collection<V>, K, R, Map<K, R>> {
-
-        public static final String GROUP_BY_STEP_STEP_ID = "gremlin.groupStep.stepId";
-
-        private String groupStepId;
-        private Traversal.Admin<Collection<V>, R> reduceTraversal;
-
-        private GroupMapReduce() {
-
-        }
-
-        public GroupMapReduce(final GroupStep<?, K, V, R> step) {
-            this.groupStepId = step.getId();
-            this.reduceTraversal = step.getReduceTraversal();
-        }
-
-        @Override
-        public void storeState(final Configuration configuration) {
-            MapReduce.super.storeState(configuration);
-            configuration.setProperty(GROUP_BY_STEP_STEP_ID, this.groupStepId);
-        }
-
-        @Override
-        public void loadState(final Configuration configuration) {
-            this.groupStepId = configuration.getString(GROUP_BY_STEP_STEP_ID);
-            final Traversal.Admin<?, ?> traversal = TraversalVertexProgram.getTraversalSupplier(configuration).get();
-            if (!traversal.isLocked())
-                traversal.applyStrategies(); // TODO: this is a scary error prone requirement, but only a problem for GroupStep
-            final GroupStep groupStep = new TraversalMatrix<>(traversal).getStepById(this.groupStepId);
-            this.reduceTraversal = groupStep.getReduceTraversal();
-        }
-
-        @Override
-        public boolean doStage(final Stage stage) {
-            return !stage.equals(Stage.COMBINE);
-        }
-
-        @Override
-        public void map(final Vertex vertex, final MapEmitter<K, Collection<V>> emitter) {
-            vertex.<TraverserSet<Object[]>>property(TraversalVertexProgram.HALTED_TRAVERSERS).ifPresent(traverserSet -> traverserSet.forEach(traverser -> {
-                final Object[] objects = traverser.get();
-                if (objects[1] instanceof Collection)
-                    emitter.emit((K) objects[0], (Collection<V>) objects[1]);
-                else {
-                    final List<V> collection = new ArrayList<>();
-                    collection.add((V) objects[1]);
-                    emitter.emit((K) objects[0], collection);
-                }
-            }));
-        }
-
-        @Override
-        public void reduce(final K key, final Iterator<Collection<V>> values, final ReduceEmitter<K, R> emitter) {
-            final Set<V> set = new BulkSet<>();
-            values.forEachRemaining(set::addAll);
-            emitter.emit(key, TraversalUtil.applyNullable(set, this.reduceTraversal));
-        }
-
-        @Override
-        public Map<K, R> generateFinalResult(final Iterator<KeyValue<K, R>> keyValues) {
-            final Map<K, R> map = new HashMap<>();
-            keyValues.forEachRemaining(keyValue -> map.put(keyValue.getKey(), keyValue.getValue()));
-            return map;
-        }
-
-        @Override
-        public String getMemoryKey() {
-            return REDUCING;
-        }
-
-        @Override
-        public GroupMapReduce<K, V, R> clone() {
-            try {
-                final GroupMapReduce<K, V, R> clone = (GroupMapReduce<K, V, R>) super.clone();
-                if (null != clone.reduceTraversal)
-                    clone.reduceTraversal = this.reduceTraversal.clone();
-                return clone;
-            } catch (final CloneNotSupportedException e) {
-                throw new IllegalStateException(e.getMessage(), e);
-            }
-        }
-
-        @Override
-        public String toString() {
-            return StringFactory.mapReduceString(this, this.getMemoryKey());
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/IdStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/IdStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/IdStep.java
deleted file mode 100644
index 17d0fe6..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/IdStep.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Element;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class IdStep<S extends Element> extends MapStep<S, Object> {
-
-    public IdStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected Object map(final Traverser.Admin<S> traverser) {
-        return traverser.get().id();
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/KeyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/KeyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/KeyStep.java
deleted file mode 100644
index 74460a5..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/KeyStep.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Property;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class KeyStep extends MapStep<Property, String> {
-
-    public KeyStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected String map(final Traverser.Admin<Property> traverser) {
-        return traverser.get().key();
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LabelStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LabelStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LabelStep.java
deleted file mode 100644
index e54c07f..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LabelStep.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Element;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class LabelStep<S extends Element> extends MapStep<S, String> {
-
-    public LabelStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected String map(final Traverser.Admin<S> traverser) {
-        return traverser.get().label();
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaFlatMapStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaFlatMapStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaFlatMapStep.java
deleted file mode 100644
index acd6416..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaFlatMapStep.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-
-import java.util.Iterator;
-import java.util.function.Function;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class LambdaFlatMapStep<S, E> extends FlatMapStep<S, E> {
-
-    private final Function<Traverser<S>, Iterator<E>> function;
-
-    public LambdaFlatMapStep(final Traversal.Admin traversal, final Function<Traverser<S>, Iterator<E>> function) {
-        super(traversal);
-        this.function = function;
-    }
-
-    @Override
-    protected Iterator<E> flatMap(final Traverser.Admin<S> traverser) {
-        return this.function.apply(traverser);
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.function);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java
deleted file mode 100644
index d22e630..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-
-import java.util.function.Function;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class LambdaMapStep<S, E> extends MapStep<S, E> {
-
-    private final Function<Traverser<S>, E> function;
-
-    public LambdaMapStep(final Traversal.Admin traversal, final Function<Traverser<S>, E> function) {
-        super(traversal);
-        this.function = function;
-    }
-
-    @Override
-    protected E map(final Traverser.Admin<S> traverser) {
-        return this.function.apply(traverser);
-    }
-
-    @Override
-    public String toString() {
-        return TraversalHelper.makeStepString(this, this.function);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c97e964/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MapStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MapStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MapStep.java
deleted file mode 100644
index 8f5c0f2..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MapStep.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.AbstractStep;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public abstract class MapStep<S, E> extends AbstractStep<S, E> {
-
-    public MapStep(final Traversal.Admin traversal) {
-        super(traversal);
-    }
-
-    @Override
-    protected Traverser<E> processNextStart() {
-        while (true) {
-            final Traverser.Admin<S> traverser = this.starts.next();
-            return traverser.split(this.map(traverser), this);
-        }
-    }
-
-    protected abstract E map(final Traverser.Admin<S> traverser);
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.PATH_ACCESS); // TODO: this is bad -- just a hack right now.
-    }
-}
-