this is an intense commit. No more traverser species. There is now JUST DefaultTraverser. Its super ghetto rigged right now, but I will be able to make it cleaner. This completely changes the complexity of traversal compilation and traverser generation. I was a fool to overoptimize all this. Next up -- get rid of TraverserRequirements and add Path.onlyLabeledObjects().
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/beebbbc7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/beebbbc7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/beebbbc7
Branch: refs/heads/TINKERPOP3-1014
Commit: beebbbc7fcf9f8e1d57437d55937aa02ce988710
Parents: e6a1141
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Tue Dec 1 15:56:13 2015 -0700
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Tue Dec 1 15:56:13 2015 -0700
----------------------------------------------------------------------
.../lambda/AbstractLambdaTraversal.java | 5 +-
.../traversal/step/map/AddVertexStartStep.java | 2 +-
.../traverser/B_LP_O_P_S_SE_SL_Traverser.java | 97 --------
.../B_LP_O_P_S_SE_SL_TraverserGenerator.java | 59 -----
.../traverser/B_LP_O_S_SE_SL_Traverser.java | 102 --------
.../B_LP_O_S_SE_SL_TraverserGenerator.java | 58 -----
.../traverser/B_O_S_SE_SL_Traverser.java | 126 ----------
.../B_O_S_SE_SL_TraverserGenerator.java | 59 -----
.../traversal/traverser/B_O_Traverser.java | 70 ------
.../traverser/B_O_TraverserGenerator.java | 55 -----
.../traversal/traverser/DefaultTraverser.java | 244 +++++++++++++++++++
.../traverser/DefaultTraverserGenerator.java | 61 +++++
.../DefaultTraverserGeneratorFactory.java | 73 ++++++
.../traversal/traverser/EmptyTraverser.java | 167 +++++++++++++
.../traverser/LP_O_OB_P_S_SE_SL_Traverser.java | 98 --------
.../LP_O_OB_P_S_SE_SL_TraverserGenerator.java | 62 -----
.../traverser/LP_O_OB_S_SE_SL_Traverser.java | 99 --------
.../LP_O_OB_S_SE_SL_TraverserGenerator.java | 61 -----
.../traverser/O_OB_S_SE_SL_Traverser.java | 137 -----------
.../O_OB_S_SE_SL_TraverserGenerator.java | 59 -----
.../traversal/traverser/O_Traverser.java | 72 ------
.../traverser/O_TraverserGenerator.java | 52 ----
.../traverser/util/AbstractTraverser.java | 191 ---------------
.../util/DefaultTraverserGeneratorFactory.java | 82 -------
.../traverser/util/EmptyTraverser.java | 167 -------------
.../util/DefaultTraversalStrategies.java | 2 +-
.../util/EmptyTraversalStrategies.java | 2 +-
.../gremlin/structure/io/gryo/GryoMapper.java | 21 +-
.../traversal/step/map/MatchStepTest.java | 7 +-
.../DefaultTraverserGeneratorFactoryTest.java | 85 -------
.../apache/tinkerpop/gremlin/GraphProvider.java | 15 +-
31 files changed, 561 insertions(+), 1829 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/AbstractLambdaTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/AbstractLambdaTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/AbstractLambdaTraversal.java
index 3f3af00..abd6011 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/AbstractLambdaTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/AbstractLambdaTraversal.java
@@ -28,7 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_TraverserGenerator;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.DefaultTraverserGenerator;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversalStrategies;
@@ -37,7 +37,6 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import java.util.Set;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -79,7 +78,7 @@ public abstract class AbstractLambdaTraversal<S, E> implements Traversal.Admin<S
@Override
public TraverserGenerator getTraverserGenerator() {
- return O_TraverserGenerator.instance();
+ return DefaultTraverserGenerator.instance();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
index 7313bd8..14db397 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
@@ -29,7 +29,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.CallbackRe
import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.ListCallbackRegistry;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.EmptyTraverser;
import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
deleted file mode 100644
index 30641bb..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_Traverser.java
+++ /dev/null
@@ -1,97 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.ImmutablePath;
-import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
-
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class B_LP_O_P_S_SE_SL_Traverser<T> extends B_O_S_SE_SL_Traverser<T> {
-
- protected Path path;
-
- protected B_LP_O_P_S_SE_SL_Traverser() {
- }
-
- public B_LP_O_P_S_SE_SL_Traverser(final T t, final Step<T, ?> step, final long initialBulk) {
- super(t, step, initialBulk);
- this.path = ImmutablePath.make().extend(t, step.getLabels());
- }
-
- /////////////////
-
- @Override
- public Path path() {
- return this.path;
- }
-
- /////////////////
-
- @Override
- public Traverser.Admin<T> detach() {
- super.detach();
- this.path = ReferenceFactory.detach(this.path);
- return this;
- }
-
- /////////////////
-
- @Override
- public <R> Traverser.Admin<R> split(final R r, final Step<T, R> step) {
- final B_LP_O_P_S_SE_SL_Traverser<R> clone = (B_LP_O_P_S_SE_SL_Traverser<R>) super.split(r, step);
- clone.path = clone.path.clone().extend(r, step.getLabels());
- return clone;
- }
-
- @Override
- public Traverser.Admin<T> split() {
- final B_LP_O_P_S_SE_SL_Traverser<T> clone = (B_LP_O_P_S_SE_SL_Traverser<T>) super.split();
- clone.path = clone.path.clone();
- return clone;
- }
-
- @Override
- public void addLabels(final Set<String> labels) {
- if (!labels.isEmpty())
- this.path = this.path.extend(labels);
- }
-
- @Override
- public int hashCode() {
- return super.hashCode() + this.path.hashCode();
- }
-
- @Override
- public boolean equals(final Object object) {
- return (object instanceof B_LP_O_P_S_SE_SL_Traverser)
- && ((B_LP_O_P_S_SE_SL_Traverser) object).get().equals(this.t)
- && ((B_LP_O_P_S_SE_SL_Traverser) object).getStepId().equals(this.getStepId())
- && ((B_LP_O_P_S_SE_SL_Traverser) object).loops() == this.loops()
- && (null == this.sack || null != this.sideEffects.getSackMerger())
- && ((B_LP_O_P_S_SE_SL_Traverser) object).path().equals(this.path);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_TraverserGenerator.java
deleted file mode 100644
index d0c4d78..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_P_S_SE_SL_TraverserGenerator.java
+++ /dev/null
@@ -1,59 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class B_LP_O_P_S_SE_SL_TraverserGenerator implements TraverserGenerator {
-
- private static final B_LP_O_P_S_SE_SL_TraverserGenerator INSTANCE = new B_LP_O_P_S_SE_SL_TraverserGenerator();
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.BULK,
- TraverserRequirement.LABELED_PATH,
- TraverserRequirement.OBJECT,
- TraverserRequirement.PATH,
- TraverserRequirement.SACK,
- TraverserRequirement.SIDE_EFFECTS,
- TraverserRequirement.SINGLE_LOOP);
-
- private B_LP_O_P_S_SE_SL_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new B_LP_O_P_S_SE_SL_Traverser<>(start, startStep, initialBulk);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static B_LP_O_P_S_SE_SL_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
deleted file mode 100644
index b32126b..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
+++ /dev/null
@@ -1,102 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.Pop;
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.ImmutablePath;
-import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
-
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class B_LP_O_S_SE_SL_Traverser<T> extends B_O_S_SE_SL_Traverser<T> {
-
- protected Path path;
-
- protected B_LP_O_S_SE_SL_Traverser() {
- }
-
- public B_LP_O_S_SE_SL_Traverser(final T t, final Step<T, ?> step, final long initialBulk) {
- super(t, step, initialBulk);
- this.path = ImmutablePath.make();
- if (!step.getLabels().isEmpty()) this.path = this.path.extend(t, step.getLabels());
- }
-
- /////////////////
-
- @Override
- public Path path() {
- return this.path;
- }
-
- /////////////////
-
- @Override
- public Traverser.Admin<T> detach() {
- super.detach();
- this.path = ReferenceFactory.detach(this.path);
- return this;
- }
-
- /////////////////
-
- @Override
- public <R> Traverser.Admin<R> split(final R r, final Step<T, R> step) {
- final B_LP_O_S_SE_SL_Traverser<R> clone = (B_LP_O_S_SE_SL_Traverser<R>) super.split(r, step);
- clone.path = clone.path.clone();
- if (!step.getLabels().isEmpty()) clone.path = clone.path.extend(r, step.getLabels());
- return clone;
- }
-
- @Override
- public Traverser.Admin<T> split() {
- final B_LP_O_S_SE_SL_Traverser<T> clone = (B_LP_O_S_SE_SL_Traverser<T>) super.split();
- clone.path = clone.path.clone();
- return clone;
- }
-
- @Override
- public void addLabels(final Set<String> labels) {
- if (!labels.isEmpty())
- this.path = this.path.size() == 0 || !this.path.get(this.path.size() - 1).equals(this.t) ?
- this.path.extend(this.t, labels) :
- this.path.extend(labels);
- }
-
- @Override
- public int hashCode() {
- return super.hashCode() + this.path.hashCode();
- }
-
- @Override
- public boolean equals(final Object object) {
- return (object instanceof B_LP_O_S_SE_SL_Traverser)
- && ((B_LP_O_S_SE_SL_Traverser) object).get().equals(this.t)
- && ((B_LP_O_S_SE_SL_Traverser) object).getStepId().equals(this.getStepId())
- && ((B_LP_O_S_SE_SL_Traverser) object).loops() == this.loops()
- && (null == this.sack || null != this.sideEffects.getSackMerger())
- && ((B_LP_O_S_SE_SL_Traverser) object).path().popEquals(Pop.last, this.path); // this should be Pop.all?
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_TraverserGenerator.java
deleted file mode 100644
index 1c7e0d6..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_TraverserGenerator.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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class B_LP_O_S_SE_SL_TraverserGenerator implements TraverserGenerator {
-
- private static final B_LP_O_S_SE_SL_TraverserGenerator INSTANCE = new B_LP_O_S_SE_SL_TraverserGenerator();
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.BULK,
- TraverserRequirement.LABELED_PATH,
- TraverserRequirement.OBJECT,
- TraverserRequirement.SACK,
- TraverserRequirement.SIDE_EFFECTS,
- TraverserRequirement.SINGLE_LOOP);
-
- private B_LP_O_S_SE_SL_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new B_LP_O_S_SE_SL_Traverser<>(start, startStep, initialBulk);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static B_LP_O_S_SE_SL_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_Traverser.java
deleted file mode 100644
index 5dc1313..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_Traverser.java
+++ /dev/null
@@ -1,126 +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.traversal.traverser;
-
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class B_O_S_SE_SL_Traverser<T> extends B_O_Traverser<T> {
-
- protected Object sack = null;
- protected short loops = 0; // an optimization hack to use a short internally to save bits :)
- protected transient TraversalSideEffects sideEffects;
-
- protected B_O_S_SE_SL_Traverser() {
- }
-
- public B_O_S_SE_SL_Traverser(final T t, final Step<T, ?> step, final long initialBulk) {
- super(t, initialBulk);
- this.sideEffects = step.getTraversal().getSideEffects();
- if (null != this.sideEffects.getSackInitialValue())
- this.sack = this.sideEffects.getSackInitialValue().get();
- }
-
- /////////////////
-
- @Override
- public <S> S sack() {
- return (S) this.sack;
- }
-
- @Override
- public <S> void sack(final S object) {
- this.sack = object;
- }
-
- /////////////////
-
- @Override
- public int loops() {
- return this.loops;
- }
-
- @Override
- public void incrLoops(final String stepLabel) {
- this.loops++;
- }
-
- @Override
- public void resetLoops() {
- this.loops = 0;
- }
-
- /////////////////
-
- @Override
- public TraversalSideEffects getSideEffects() {
- return this.sideEffects;
- }
-
-
- @Override
- public void setSideEffects(final TraversalSideEffects sideEffects) {
- this.sideEffects = sideEffects;
- }
-
- /////////////////
-
- @Override
- public <R> Traverser.Admin<R> split(final R r, final Step<T, R> step) {
- final B_O_S_SE_SL_Traverser<R> clone = (B_O_S_SE_SL_Traverser<R>) super.split(r, step);
- clone.sack = null == clone.sack ? null : null == clone.sideEffects.getSackSplitter() ? clone.sack : clone.sideEffects.getSackSplitter().apply(clone.sack);
- return clone;
- }
-
- @Override
- public Traverser.Admin<T> split() {
- final B_O_S_SE_SL_Traverser<T> clone = (B_O_S_SE_SL_Traverser<T>) super.split();
- clone.sack = null == clone.sack ? null : null == clone.sideEffects.getSackSplitter() ? clone.sack : clone.sideEffects.getSackSplitter().apply(clone.sack);
- return clone;
- }
-
- @Override
- public void merge(final Traverser.Admin<?> other) {
- super.merge(other);
- if (null != this.sack && null != this.sideEffects.getSackMerger())
- this.sack = this.sideEffects.getSackMerger().apply(this.sack, other.sack());
-
- }
-
- /////////////////
-
- @Override
- public int hashCode() {
- return this.t.hashCode() + this.future.hashCode() + this.loops;
- }
-
- @Override
- public boolean equals(final Object object) {
- return object instanceof B_O_S_SE_SL_Traverser
- && ((B_O_S_SE_SL_Traverser) object).get().equals(this.t)
- && ((B_O_S_SE_SL_Traverser) object).getStepId().equals(this.getStepId())
- && ((B_O_S_SE_SL_Traverser) object).loops() == this.loops()
- && (null == this.sack || (null != this.sideEffects && null != this.sideEffects.getSackMerger())); // hmmm... serialization in OLAP destroys the transient sideEffects
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_TraverserGenerator.java
deleted file mode 100644
index 4c5ce57..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_S_SE_SL_TraverserGenerator.java
+++ /dev/null
@@ -1,59 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class B_O_S_SE_SL_TraverserGenerator implements TraverserGenerator {
-
- private static final B_O_S_SE_SL_TraverserGenerator INSTANCE = new B_O_S_SE_SL_TraverserGenerator();
-
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.BULK,
- TraverserRequirement.OBJECT,
- TraverserRequirement.SACK,
- TraverserRequirement.SIDE_EFFECTS,
- TraverserRequirement.SINGLE_LOOP);
-
-
- private B_O_S_SE_SL_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new B_O_S_SE_SL_Traverser<>(start, startStep, initialBulk);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static B_O_S_SE_SL_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_Traverser.java
deleted file mode 100644
index 4c64fb0..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_Traverser.java
+++ /dev/null
@@ -1,70 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class B_O_Traverser<T> extends O_Traverser<T> {
-
- protected long bulk = 1l;
- protected String future = HALT;
-
- protected B_O_Traverser() {
- }
-
- public B_O_Traverser(final T t, final long initialBulk) {
- super(t);
- this.bulk = initialBulk;
- }
-
- @Override
- public void setBulk(final long count) {
- this.bulk = count;
- }
-
- @Override
- public long bulk() {
- return this.bulk;
- }
-
- @Override
- public void merge(final Traverser.Admin<?> other) {
- this.bulk = this.bulk + other.bulk();
- }
-
- @Override
- public String getStepId() {
- return this.future;
- }
-
- @Override
- public void setStepId(final String stepId) {
- this.future = stepId;
- }
-
- @Override
- public boolean equals(final Object object) {
- return object instanceof B_O_Traverser &&
- ((B_O_Traverser) object).t.equals(this.t) &&
- ((B_O_Traverser) object).future.equals(this.future);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_TraverserGenerator.java
deleted file mode 100644
index 0ee1e68..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_O_TraverserGenerator.java
+++ /dev/null
@@ -1,55 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class B_O_TraverserGenerator implements TraverserGenerator {
-
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.BULK,
- TraverserRequirement.OBJECT);
-
- private static final B_O_TraverserGenerator INSTANCE = new B_O_TraverserGenerator();
-
- private B_O_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new B_O_Traverser<>(start, initialBulk);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static B_O_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverser.java
new file mode 100644
index 0000000..7f71ad9
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverser.java
@@ -0,0 +1,244 @@
+/*
+ * 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.traversal.traverser;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Path;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyPath;
+import org.apache.tinkerpop.gremlin.structure.util.Attachable;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.function.Function;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class DefaultTraverser<T> implements Traverser.Admin<T> {
+
+ private T t;
+ private long bulk = 1l;
+ private String stepId;
+ private Path path;
+ private short loops = 0;
+ private Set<String> tags = null;
+ private transient TraversalSideEffects sideEffects;
+ private boolean onlyLabeledPaths;
+ private boolean oneBulk;
+ private Object sack = null;
+
+ /**
+ * A no-args constructor is necessary for Kryo serialization.
+ */
+ private DefaultTraverser() {
+
+ }
+
+ public DefaultTraverser(final T t, final Step<T, ?> step, final long initialBulk, final Path path, boolean onlyLabeledPaths, boolean oneBulk) {
+ this.t = t;
+ this.stepId = step.getId();
+ this.bulk = initialBulk;
+ this.path = path;
+ this.sideEffects = step.getTraversal().getSideEffects();
+ this.onlyLabeledPaths = onlyLabeledPaths;
+ this.oneBulk = oneBulk;
+ if (null != this.sideEffects.getSackInitialValue())
+ this.sack = this.sideEffects.getSackInitialValue().get();
+ }
+
+
+ @Override
+ public void addLabels(final Set<String> labels) {
+ if (this.onlyLabeledPaths) {
+ if (!labels.isEmpty())
+ this.path = this.path.size() == 0 || !this.path.get(this.path.size() - 1).equals(this.t) ?
+ this.path.extend(this.t, labels) :
+ this.path.extend(labels);
+ } else
+ this.path = this.path.extend(labels);
+ }
+
+ @Override
+ public void set(final T t) {
+ this.t = t;
+ }
+
+ @Override
+ public void incrLoops(final String stepLabel) {
+ if (!this.oneBulk)
+ this.loops++;
+ }
+
+ @Override
+ public void resetLoops() {
+ this.loops = 0;
+ }
+
+ @Override
+ public String getStepId() {
+ return this.stepId;
+ }
+
+ @Override
+ public void setStepId(final String stepId) {
+ this.stepId = stepId;
+ }
+
+ @Override
+ public void setBulk(final long count) {
+ this.bulk = count;
+ }
+
+ @Override
+ public Admin<T> detach() {
+ this.t = ReferenceFactory.detach(this.t);
+ if (!(this.path instanceof EmptyPath))
+ this.path = ReferenceFactory.detach(this.path);
+ return this;
+ }
+
+ @Override
+ public T attach(final Function<Attachable<T>, T> method) {
+ // you do not want to attach a path because it will reference graph objects not at the current vertex
+ if (this.t instanceof Attachable && !(((Attachable) this.t).get() instanceof Path))
+ this.t = ((Attachable<T>) this.t).attach(method);
+ return this.t;
+ }
+
+ @Override
+ public void setSideEffects(final TraversalSideEffects sideEffects) {
+ this.sideEffects = sideEffects;
+ }
+
+ @Override
+ public TraversalSideEffects getSideEffects() {
+ return this.sideEffects;
+ }
+
+ public Set<String> getTags() {
+ if (null == this.tags) this.tags = new HashSet<>();
+ return this.tags;
+ }
+
+ @Override
+ public <R> Admin<R> split(final R r, final Step<T, R> step) {
+ final DefaultTraverser<R> clone = (DefaultTraverser<R>) this.clone();
+ clone.t = r;
+ if (this.onlyLabeledPaths) {
+ if (!step.getLabels().isEmpty())
+ clone.path = this.path.clone().extend(r, step.getLabels());
+ } else
+ clone.path = this.path.clone().extend(r, step.getLabels());
+ if (null != this.tags)
+ clone.tags = new HashSet<>(this.tags);
+ clone.sack = null == clone.sack ? null : null == clone.sideEffects.getSackSplitter() ? clone.sack : clone.sideEffects.getSackSplitter().apply(clone.sack);
+ return clone;
+ }
+
+ @Override
+ public Admin<T> split() {
+ final DefaultTraverser<T> clone = (DefaultTraverser<T>) this.clone();
+ clone.path = this.path.clone();
+ if (null != this.tags)
+ clone.tags = new HashSet<>(this.tags);
+ clone.sack = null == clone.sack ? null : null == clone.sideEffects.getSackSplitter() ? clone.sack : clone.sideEffects.getSackSplitter().apply(clone.sack);
+ return clone;
+ }
+
+ @Override
+ public void merge(final Traverser.Admin<?> other) {
+ if (!this.oneBulk)
+ this.bulk = this.bulk + other.bulk();
+ if (!other.getTags().isEmpty()) {
+ if (this.tags == null) this.tags = new HashSet<>();
+ this.tags.addAll(other.getTags());
+ }
+ if (null != this.sack && null != this.sideEffects.getSackMerger())
+ this.sack = this.sideEffects.getSackMerger().apply(this.sack, other.sack());
+ }
+
+ @Override
+ public T get() {
+ return this.t;
+ }
+
+ @Override
+ public <S> S sack() {
+ return (S) this.sack;
+ }
+
+ @Override
+ public <S> void sack(final S object) {
+ this.sack = object;
+ }
+
+ @Override
+ public Path path() {
+ return this.path;
+ }
+
+ @Override
+ public int loops() {
+ return this.loops;
+ }
+
+ @Override
+ public long bulk() {
+ return this.bulk;
+ }
+
+ @Override
+ public Traverser<T> clone() {
+ try {
+ final DefaultTraverser<T> clone = (DefaultTraverser<T>) super.clone();
+ if (this.tags != null)
+ clone.getTags().addAll(this.tags);
+ clone.path = this.path.clone();
+ return clone;
+ } catch (final CloneNotSupportedException e) {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
+ }
+
+ ///////////
+
+ @Override
+ public int hashCode() {
+ return this.t.hashCode() + this.stepId.hashCode() + this.loops + this.path.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ return object instanceof DefaultTraverser &&
+ ((DefaultTraverser) object).get().equals(this.t) &&
+ ((DefaultTraverser) object).stepId.equals(this.stepId) &&
+ ((DefaultTraverser) object).loops() == this.loops &&
+ (null == this.sack || (null != this.sideEffects && null != this.sideEffects.getSackMerger())) && // hmmm... serialization in OLAP destroys the transient sideEffects
+ ((DefaultTraverser) object).path().equals(this.path);
+ }
+
+ @Override
+ public String toString() {
+ return this.t.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGenerator.java
new file mode 100644
index 0000000..f399549
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGenerator.java
@@ -0,0 +1,61 @@
+/*
+ * 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.traversal.traverser;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyPath;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.ImmutablePath;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class DefaultTraverserGenerator implements TraverserGenerator {
+
+ private static final DefaultTraverserGenerator INSTANCE = new DefaultTraverserGenerator();
+
+ private DefaultTraverserGenerator() {
+ }
+
+ @Override
+ public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
+ final Set<TraverserRequirement> requirements = TraversalHelper.getRootTraversal(startStep.getTraversal()).getTraverserRequirements();
+ if (requirements.contains(TraverserRequirement.PATH))
+ return new DefaultTraverser<>(start, startStep, initialBulk, ImmutablePath.make().extend(start, startStep.getLabels()), false, requirements.contains(TraverserRequirement.ONE_BULK));
+ else if (requirements.contains(TraverserRequirement.LABELED_PATH))
+ return new DefaultTraverser<>(start, startStep, initialBulk, ImmutablePath.make().extend(start, startStep.getLabels()), true, requirements.contains(TraverserRequirement.ONE_BULK));
+ else
+ return new DefaultTraverser<>(start, startStep, initialBulk, EmptyPath.instance(), true, requirements.contains(TraverserRequirement.ONE_BULK));
+ }
+
+ @Override
+ public Set<TraverserRequirement> getProvidedRequirements() {
+ return Collections.emptySet();
+ }
+
+ public static DefaultTraverserGenerator instance() {
+ return INSTANCE;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGeneratorFactory.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGeneratorFactory.java
new file mode 100644
index 0000000..85957a2
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/DefaultTraverserGeneratorFactory.java
@@ -0,0 +1,73 @@
+/*
+ * 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.traversal.traverser;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
+
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class DefaultTraverserGeneratorFactory implements TraverserGeneratorFactory {
+
+ private static DefaultTraverserGeneratorFactory INSTANCE = new DefaultTraverserGeneratorFactory();
+
+ public static DefaultTraverserGeneratorFactory instance() {
+ return INSTANCE;
+ }
+
+ private DefaultTraverserGeneratorFactory() {
+ }
+
+ @Override
+ public TraverserGenerator getTraverserGenerator(final Traversal.Admin<?, ?> traversal) {
+ final Set<TraverserRequirement> requirements = traversal.getTraverserRequirements();
+
+ return DefaultTraverserGenerator.instance();
+ /*if (requirements.contains(TraverserRequirement.ONE_BULK)) {
+ if (O_OB_S_SE_SL_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return O_OB_S_SE_SL_TraverserGenerator.instance();
+
+ if (LP_O_OB_S_SE_SL_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return LP_O_OB_S_SE_SL_TraverserGenerator.instance();
+
+ if (LP_O_OB_P_S_SE_SL_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return LP_O_OB_P_S_SE_SL_TraverserGenerator.instance();
+ } else {
+ if (O_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return O_TraverserGenerator.instance();
+
+ if (B_O_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return B_O_TraverserGenerator.instance();
+
+ if (B_O_S_SE_SL_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return B_O_S_SE_SL_TraverserGenerator.instance();
+
+ if (B_LP_O_S_SE_SL_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return B_LP_O_S_SE_SL_TraverserGenerator.instance();
+
+ if (B_LP_O_P_S_SE_SL_TraverserGenerator.instance().getProvidedRequirements().containsAll(requirements))
+ return B_LP_O_P_S_SE_SL_TraverserGenerator.instance();
+ }*/
+
+ //throw new IllegalStateException("The provided traverser generator factory does not support the requirements of the traversal: " + this.getClass().getCanonicalName() + requirements);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/EmptyTraverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/EmptyTraverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/EmptyTraverser.java
new file mode 100644
index 0000000..0ed2d48
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/EmptyTraverser.java
@@ -0,0 +1,167 @@
+/*
+ * 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.traversal.traverser;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Path;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyPath;
+import org.apache.tinkerpop.gremlin.structure.util.Attachable;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.function.Function;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class EmptyTraverser<T> implements Traverser<T>, Traverser.Admin<T> {
+
+ private static final EmptyTraverser INSTANCE = new EmptyTraverser();
+
+ public static <R> EmptyTraverser<R> instance() {
+ return INSTANCE;
+ }
+
+ private EmptyTraverser() {
+
+ }
+
+ @Override
+ public void addLabels(final Set<String> labels) {
+
+ }
+
+ @Override
+ public void set(final T t) {
+
+ }
+
+ @Override
+ public void incrLoops(final String stepLabel) {
+
+ }
+
+ @Override
+ public void resetLoops() {
+
+ }
+
+ @Override
+ public String getStepId() {
+ return HALT;
+ }
+
+ @Override
+ public void setStepId(final String stepId) {
+
+ }
+
+ @Override
+ public void setBulk(long count) {
+
+ }
+
+ @Override
+ public <R> Admin<R> split(final R r, final Step<T, R> step) {
+ return INSTANCE;
+ }
+
+ @Override
+ public Admin<T> split() {
+ return this;
+ }
+
+ @Override
+ public Admin<T> detach() {
+ return this;
+ }
+
+ @Override
+ public T attach(final Function<Attachable<T>, T> method) {
+ return null;
+ }
+
+ @Override
+ public void setSideEffects(final TraversalSideEffects sideEffects) {
+
+ }
+
+ @Override
+ public T get() {
+ return null;
+ }
+
+ @Override
+ public <S> S sack() {
+ return null;
+ }
+
+ @Override
+ public <S> void sack(final S object) {
+
+ }
+
+ @Override
+ public void merge(final Traverser.Admin<?> other) {
+
+ }
+
+ @Override
+ public Path path() {
+ return EmptyPath.instance();
+ }
+
+ @Override
+ public int loops() {
+ return 0;
+ }
+
+ @Override
+ public long bulk() {
+ return 0l;
+ }
+
+ @Override
+ public TraversalSideEffects getSideEffects() {
+ return null;
+ }
+
+ @Override
+ public Set<String> getTags() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public int hashCode() {
+ return 380473707;
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ return object instanceof EmptyTraverser;
+ }
+
+ @Override
+ @SuppressWarnings("CloneDoesntCallSuperClone")
+ public EmptyTraverser<T> clone() {
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_Traverser.java
deleted file mode 100644
index 353d1ef..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_Traverser.java
+++ /dev/null
@@ -1,98 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.ImmutablePath;
-import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
-
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class LP_O_OB_P_S_SE_SL_Traverser<T> extends O_OB_S_SE_SL_Traverser<T> {
-
- protected Path path;
-
- protected LP_O_OB_P_S_SE_SL_Traverser() {
- }
-
- public LP_O_OB_P_S_SE_SL_Traverser(final T t, final Step<T, ?> step) {
- super(t, step);
- this.path = ImmutablePath.make().extend(t, step.getLabels());
- }
-
- /////////////////
-
- @Override
- public Path path() {
- return this.path;
- }
-
- /////////////////
-
- @Override
- public Traverser.Admin<T> detach() {
- super.detach();
- this.path = ReferenceFactory.detach(this.path);
- return this;
- }
-
- /////////////////
-
- @Override
- public <R> Traverser.Admin<R> split(final R r, final Step<T, R> step) {
- final LP_O_OB_P_S_SE_SL_Traverser<R> clone = (LP_O_OB_P_S_SE_SL_Traverser<R>) super.split(r, step);
- clone.path = clone.path.clone().extend(r, step.getLabels());
- return clone;
- }
-
- @Override
- public Traverser.Admin<T> split() {
- final LP_O_OB_P_S_SE_SL_Traverser<T> clone = (LP_O_OB_P_S_SE_SL_Traverser<T>) super.split();
- clone.path = clone.path.clone();
- return clone;
- }
-
- @Override
- public void addLabels(final Set<String> labels) {
- if (!labels.isEmpty())
- this.path = this.path.extend(labels);
- }
-
- @Override
- public int hashCode() {
- return super.hashCode() + this.path.hashCode();
- }
-
- @Override
- public boolean equals(final Object object) {
- return (object instanceof LP_O_OB_P_S_SE_SL_Traverser)
- && ((LP_O_OB_P_S_SE_SL_Traverser) object).get().equals(this.t)
- && ((LP_O_OB_P_S_SE_SL_Traverser) object).getStepId().equals(this.getStepId())
- && ((LP_O_OB_P_S_SE_SL_Traverser) object).loops() == this.loops()
- && (null == this.sack || null != this.sideEffects.getSackMerger())
- && ((LP_O_OB_P_S_SE_SL_Traverser) object).path().equals(this.path);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_TraverserGenerator.java
deleted file mode 100644
index 546ed6d..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_P_S_SE_SL_TraverserGenerator.java
+++ /dev/null
@@ -1,62 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class LP_O_OB_P_S_SE_SL_TraverserGenerator implements TraverserGenerator {
-
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.LABELED_PATH,
- TraverserRequirement.OBJECT,
- TraverserRequirement.ONE_BULK,
- TraverserRequirement.PATH,
- TraverserRequirement.SACK,
- TraverserRequirement.SIDE_EFFECTS,
- TraverserRequirement.SINGLE_LOOP);
-
-
- private static final LP_O_OB_P_S_SE_SL_TraverserGenerator INSTANCE = new LP_O_OB_P_S_SE_SL_TraverserGenerator();
-
- private LP_O_OB_P_S_SE_SL_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new LP_O_OB_P_S_SE_SL_Traverser<>(start, startStep);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static LP_O_OB_P_S_SE_SL_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_Traverser.java
deleted file mode 100644
index 9781f84..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_Traverser.java
+++ /dev/null
@@ -1,99 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.Pop;
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.ImmutablePath;
-import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
-
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class LP_O_OB_S_SE_SL_Traverser<T> extends O_OB_S_SE_SL_Traverser<T> {
-
- protected Path path;
-
- public LP_O_OB_S_SE_SL_Traverser(final T t, final Step<T, ?> step) {
- super(t, step);
- this.path = ImmutablePath.make();
- if (!step.getLabels().isEmpty()) this.path = this.path.extend(t, step.getLabels());
- }
-
- /////////////////
-
- @Override
- public Path path() {
- return this.path;
- }
-
- /////////////////
-
- @Override
- public Traverser.Admin<T> detach() {
- super.detach();
- this.path = ReferenceFactory.detach(this.path);
- return this;
- }
-
- /////////////////
-
- @Override
- public <R> Traverser.Admin<R> split(final R r, final Step<T, R> step) {
- final LP_O_OB_S_SE_SL_Traverser<R> clone = (LP_O_OB_S_SE_SL_Traverser<R>) super.split(r, step);
- clone.path = clone.path.clone();
- if (!step.getLabels().isEmpty()) clone.path = clone.path.extend(r, step.getLabels());
- return clone;
- }
-
- @Override
- public Traverser.Admin<T> split() {
- final LP_O_OB_S_SE_SL_Traverser<T> clone = (LP_O_OB_S_SE_SL_Traverser<T>) super.split();
- clone.path = clone.path.clone();
- return clone;
- }
-
- @Override
- public void addLabels(final Set<String> labels) {
- if (!labels.isEmpty())
- this.path = this.path.size() == 0 || !this.path.get(this.path.size() - 1).equals(this.t) ?
- this.path.extend(this.t, labels) :
- this.path.extend(labels);
- }
-
- @Override
- public int hashCode() {
- return super.hashCode() + this.path.hashCode();
- }
-
- @Override
- public boolean equals(final Object object) {
- return (object instanceof LP_O_OB_S_SE_SL_Traverser)
- && ((LP_O_OB_S_SE_SL_Traverser) object).get().equals(this.t)
- && ((LP_O_OB_S_SE_SL_Traverser) object).getStepId().equals(this.getStepId())
- && ((LP_O_OB_S_SE_SL_Traverser) object).loops() == this.loops()
- && (null == this.sack || null != this.sideEffects.getSackMerger())
- && ((LP_O_OB_S_SE_SL_Traverser) object).path().popEquals(Pop.last, this.path); // this should be Pop.all?
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_TraverserGenerator.java
deleted file mode 100644
index f30eced..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/LP_O_OB_S_SE_SL_TraverserGenerator.java
+++ /dev/null
@@ -1,61 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class LP_O_OB_S_SE_SL_TraverserGenerator implements TraverserGenerator {
-
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.LABELED_PATH,
- TraverserRequirement.OBJECT,
- TraverserRequirement.ONE_BULK,
- TraverserRequirement.SACK,
- TraverserRequirement.SIDE_EFFECTS,
- TraverserRequirement.SINGLE_LOOP);
-
-
- private static final LP_O_OB_S_SE_SL_TraverserGenerator INSTANCE = new LP_O_OB_S_SE_SL_TraverserGenerator();
-
- private LP_O_OB_S_SE_SL_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new LP_O_OB_S_SE_SL_Traverser<>(start, startStep);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static LP_O_OB_S_SE_SL_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_Traverser.java
deleted file mode 100644
index 7196e72..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_Traverser.java
+++ /dev/null
@@ -1,137 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class O_OB_S_SE_SL_Traverser<T> extends O_Traverser<T> {
-
- protected Object sack = null;
- protected short loops = 0; // an optimization hack to use a short internally to save bits :)
- protected transient TraversalSideEffects sideEffects;
- protected String future = HALT;
-
- protected O_OB_S_SE_SL_Traverser() {
- }
-
- public O_OB_S_SE_SL_Traverser(final T t, final Step<T, ?> step) {
- super(t);
- this.sideEffects = step.getTraversal().getSideEffects();
- if (null != this.sideEffects.getSackInitialValue())
- this.sack = this.sideEffects.getSackInitialValue().get();
- }
-
- /////////////////
-
- @Override
- public <S> S sack() {
- return (S) this.sack;
- }
-
- @Override
- public <S> void sack(final S object) {
- this.sack = object;
- }
-
- /////////////////
-
- @Override
- public int loops() {
- return this.loops;
- }
-
- @Override
- public void incrLoops(final String stepLabel) {
- this.loops++;
- }
-
- @Override
- public void resetLoops() {
- this.loops = 0;
- }
-
- /////////////////
-
- @Override
- public String getStepId() {
- return this.future;
- }
-
- @Override
- public void setStepId(final String stepId) {
- this.future = stepId;
- }
-
- /////////////////
-
- @Override
- public TraversalSideEffects getSideEffects() {
- return this.sideEffects;
- }
-
-
- @Override
- public void setSideEffects(final TraversalSideEffects sideEffects) {
- this.sideEffects = sideEffects;
- }
-
- /////////////////
-
- @Override
- public <R> Traverser.Admin<R> split(final R r, final Step<T, R> step) {
- final O_OB_S_SE_SL_Traverser<R> clone = (O_OB_S_SE_SL_Traverser<R>) super.split(r, step);
- clone.sack = null == clone.sack ? null : null == clone.sideEffects.getSackSplitter() ? clone.sack : clone.sideEffects.getSackSplitter().apply(clone.sack);
- return clone;
- }
-
- @Override
- public Traverser.Admin<T> split() {
- final O_OB_S_SE_SL_Traverser<T> clone = (O_OB_S_SE_SL_Traverser<T>) super.split();
- clone.sack = null == clone.sack ? null : null == clone.sideEffects.getSackSplitter() ? clone.sack : clone.sideEffects.getSackSplitter().apply(clone.sack);
- return clone;
- }
-
- @Override
- public void merge(final Traverser.Admin<?> other) {
- if (null != this.sack && null != this.sideEffects.getSackMerger())
- this.sack = this.sideEffects.getSackMerger().apply(this.sack, other.sack());
- }
-
- /////////////////
-
- @Override
- public int hashCode() {
- return this.t.hashCode() + this.future.hashCode() + this.loops;
- }
-
- @Override
- public boolean equals(final Object object) {
- return object instanceof O_OB_S_SE_SL_Traverser
- && ((O_OB_S_SE_SL_Traverser) object).get().equals(this.t)
- && ((O_OB_S_SE_SL_Traverser) object).getStepId().equals(this.getStepId())
- && ((O_OB_S_SE_SL_Traverser) object).loops() == this.loops()
- && (null == this.sack || (null != this.sideEffects && null != this.sideEffects.getSackMerger())); // hmmm... serialization in OLAP destroys the transient sideEffects
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_TraverserGenerator.java
deleted file mode 100644
index 8369bef..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_OB_S_SE_SL_TraverserGenerator.java
+++ /dev/null
@@ -1,59 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.EnumSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class O_OB_S_SE_SL_TraverserGenerator implements TraverserGenerator {
-
- private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
- TraverserRequirement.OBJECT,
- TraverserRequirement.ONE_BULK,
- TraverserRequirement.SACK,
- TraverserRequirement.SIDE_EFFECTS,
- TraverserRequirement.SINGLE_LOOP);
-
- private static final O_OB_S_SE_SL_TraverserGenerator INSTANCE = new O_OB_S_SE_SL_TraverserGenerator();
-
- private O_OB_S_SE_SL_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new O_OB_S_SE_SL_Traverser<>(start, startStep);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static O_OB_S_SE_SL_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_Traverser.java
deleted file mode 100644
index 44e0f6e..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_Traverser.java
+++ /dev/null
@@ -1,72 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.AbstractTraverser;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class O_Traverser<T> extends AbstractTraverser<T> {
-
- protected Set<String> tags = null;
-
- protected O_Traverser() {
- }
-
- public O_Traverser(final T t) {
- super(t);
- }
-
-
- public Set<String> getTags() {
- if (null == this.tags) this.tags = new HashSet<>();
- return this.tags;
- }
-
- @Override
- public <R> Admin<R> split(final R r, final Step<T, R> step) {
- final O_Traverser<R> clone = (O_Traverser<R>) super.split(r, step);
- if (null != this.tags)
- clone.tags = new HashSet<>(this.tags);
- return clone;
- }
-
- @Override
- public Admin<T> split() {
- final O_Traverser<T> clone = (O_Traverser<T>) super.split();
- if (null != this.tags)
- clone.tags = new HashSet<>(this.tags);
- return clone;
- }
-
- @Override
- public void merge(final Traverser.Admin<?> other) {
- super.merge(other);
- if (!other.getTags().isEmpty()) {
- if (this.tags == null) this.tags = new HashSet<>();
- this.tags.addAll(other.getTags());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/beebbbc7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_TraverserGenerator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_TraverserGenerator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_TraverserGenerator.java
deleted file mode 100644
index 8a67b18..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/O_TraverserGenerator.java
+++ /dev/null
@@ -1,52 +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.traversal.traverser;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class O_TraverserGenerator implements TraverserGenerator {
-
- private static final Set<TraverserRequirement> REQUIREMENTS = Collections.singleton(TraverserRequirement.OBJECT);
- private static final O_TraverserGenerator INSTANCE = new O_TraverserGenerator();
-
- private O_TraverserGenerator() {
- }
-
- @Override
- public <S> Traverser.Admin<S> generate(final S start, final Step<S, ?> startStep, final long initialBulk) {
- return new O_Traverser<>(start);
- }
-
- @Override
- public Set<TraverserRequirement> getProvidedRequirements() {
- return REQUIREMENTS;
- }
-
- public static O_TraverserGenerator instance() {
- return INSTANCE;
- }
-}
\ No newline at end of file
|