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 2019/03/18 20:45:45 UTC
[tinkerpop] branch tp4 updated: starting to flush out strategies --
decoration, optimization, provider, finalization, verification.
This is an automated email from the ASF dual-hosted git repository.
okram pushed a commit to branch tp4
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/tp4 by this push:
new 3daa44f starting to flush out strategies -- decoration, optimization, provider, finalization, verification.
3daa44f is described below
commit 3daa44fd4203651210b6157d1f0f2918c22ed0a6
Author: Marko A. Rodriguez <ok...@gmail.com>
AuthorDate: Mon Mar 18 14:45:33 2019 -0600
starting to flush out strategies -- decoration, optimization, provider, finalization, verification.
---
.../tinkerpop/machine/bytecode/BytecodeUtil.java | 19 ++-
.../tinkerpop/machine/bytecode/Compilation.java | 2 +-
.../tinkerpop/machine/bytecode/CoreCompiler.java | 6 +
.../tinkerpop/machine/strategy/Strategy.java | 179 ++++++++++++++++++++-
.../{ => finalization}/CoefficientStrategy.java | 9 +-
.../TraverserFactoryStrategy.java | 6 +-
.../{ => optimization}/IdentityStrategy.java | 7 +-
.../CoefficientVerificationStrategy.java | 5 +-
.../language/gremlin/TraversalSource.java | 10 +-
.../machine/beam/strategy/BeamStrategy.java | 2 +-
.../apache/tinkerpop/machine/beam/BeamTest.java | 2 +-
.../beam/functions/TraversalSourceLibrary.java | 2 +-
.../machine/pipes/strategy/PipesStrategy.java | 2 +-
.../apache/tinkerpop/machine/pipes/PipesTest.java | 2 +-
.../pipes/function/TraversalSourceLibrary.java | 2 +-
.../tinkergraph/TinkerGraphStructure.java | 2 +-
.../strategy/{ => provider}/VerticesStrategy.java | 6 +-
17 files changed, 224 insertions(+), 39 deletions(-)
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/BytecodeUtil.java b/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/BytecodeUtil.java
index b9a750c..bfae7ba 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/BytecodeUtil.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/BytecodeUtil.java
@@ -18,6 +18,7 @@
*/
package org.apache.tinkerpop.machine.bytecode;
+import org.apache.tinkerpop.machine.bytecode.CoreCompiler.Symbols;
import org.apache.tinkerpop.machine.coefficient.Coefficient;
import org.apache.tinkerpop.machine.processor.ProcessorFactory;
import org.apache.tinkerpop.machine.strategy.Strategy;
@@ -56,10 +57,14 @@ public final class BytecodeUtil {
try {
final List<Strategy> strategies = new ArrayList<>();
for (final SourceInstruction sourceInstruction : bytecode.getSourceInstructions()) {
- if (sourceInstruction.op().equals(CoreCompiler.Symbols.WITH_STRATEGY))
+ if (sourceInstruction.op().equals(Symbols.WITH_STRATEGY)) {
strategies.add(((Class<? extends Strategy>) sourceInstruction.args()[0]).getConstructor().newInstance());
+ } else if (sourceInstruction.op().equals(Symbols.WITH_PROCESSOR)) {
+ strategies.addAll(ProcessorFactory.processorStrategies(((Class<? extends ProcessorFactory>) sourceInstruction.args()[0])));
+ } else if (sourceInstruction.op().equals(Symbols.WITH_STRUCTURE)) {
+ strategies.addAll(StructureFactory.structureStrategies(((Class<? extends StructureFactory>) sourceInstruction.args()[0])));
+ }
}
- // TODO: sort strategies
return strategies;
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
throw new RuntimeException(e.getMessage(), e);
@@ -70,7 +75,7 @@ public final class BytecodeUtil {
try {
Coefficient<C> coefficient = null;
for (final SourceInstruction sourceInstruction : bytecode.getSourceInstructions()) {
- if (sourceInstruction.op().equals(CoreCompiler.Symbols.WITH_COEFFICIENT)) {
+ if (sourceInstruction.op().equals(Symbols.WITH_COEFFICIENT)) {
coefficient = ((Class<? extends Coefficient<C>>) sourceInstruction.args()[0]).getConstructor().newInstance();
}
}
@@ -85,7 +90,7 @@ public final class BytecodeUtil {
try {
ProcessorFactory processor = null;
for (final SourceInstruction sourceInstruction : bytecode.getSourceInstructions()) {
- if (sourceInstruction.op().equals(CoreCompiler.Symbols.WITH_PROCESSOR)) {
+ if (sourceInstruction.op().equals(Symbols.WITH_PROCESSOR)) {
processor = (ProcessorFactory) ((Class<? extends Coefficient<C>>) sourceInstruction.args()[0]).getConstructor().newInstance();
}
}
@@ -99,7 +104,7 @@ public final class BytecodeUtil {
try {
StructureFactory structure = null;
for (final SourceInstruction sourceInstruction : bytecode.getSourceInstructions()) {
- if (sourceInstruction.op().equals(CoreCompiler.Symbols.WITH_STRUCTURE)) {
+ if (sourceInstruction.op().equals(Symbols.WITH_STRUCTURE)) {
structure = (StructureFactory) ((Class<? extends Coefficient<C>>) sourceInstruction.args()[0]).getConstructor().newInstance();
}
}
@@ -126,9 +131,9 @@ public final class BytecodeUtil {
public static <C> Optional<TraverserFactory<C>> getTraverserFactory(final Bytecode<C> bytecode) {
// TODO: make this real
for (final Instruction<C> instruction : bytecode.getInstructions()) {
- if (instruction.op().equals(CoreCompiler.Symbols.PATH))
+ if (instruction.op().equals(Symbols.PATH))
return Optional.of(COPTraverserFactory.instance());
- else if (instruction.op().equals(CoreCompiler.Symbols.REPEAT))
+ else if (instruction.op().equals(Symbols.REPEAT))
return Optional.of(CORTraverserFactory.instance());
}
return Optional.of(COPTraverserFactory.instance());
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/Compilation.java b/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/Compilation.java
index 1368cf0..d4283f4 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/Compilation.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/Compilation.java
@@ -51,7 +51,7 @@ public final class Compilation<C, S, E> implements Serializable {
this.structureFactory = BytecodeUtil.getStructureFactory(bytecode).orElse(EmptyStructure.instance());
this.processorFactory = BytecodeUtil.getProcessorFactory(bytecode).get();
this.traverserFactory = BytecodeUtil.getTraverserFactory(bytecode).get();
- this.functions = CompositeCompiler.compile(bytecode, new CoreCompiler(), this.structureFactory.getCompiler().orElse(new CoreCompiler()));
+ this.functions = CompositeCompiler.compile(bytecode, CoreCompiler.instance(), this.structureFactory.getCompiler().orElse(new CoreCompiler()));
}
public Compilation(final ProcessorFactory processorFactory) {
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/CoreCompiler.java b/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/CoreCompiler.java
index 9e90ed2..e00df0d 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/CoreCompiler.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/bytecode/CoreCompiler.java
@@ -48,6 +48,12 @@ import java.util.Set;
*/
public final class CoreCompiler implements BytecodeCompiler {
+ private static final CoreCompiler INSTANCE = new CoreCompiler();
+
+ public static final CoreCompiler instance() {
+ return INSTANCE;
+ }
+
@Override
public <C> CFunction<C> compile(final Instruction<C> instruction) {
final String op = instruction.op();
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/Strategy.java b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/Strategy.java
index 8894fb0..9e20518 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/Strategy.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/Strategy.java
@@ -20,10 +20,187 @@ package org.apache.tinkerpop.machine.strategy;
import org.apache.tinkerpop.machine.bytecode.Bytecode;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
+
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public interface Strategy {
+public interface Strategy<S extends Strategy> extends Serializable, Comparable<Class<? extends Strategy>> {
public <C> void apply(final Bytecode<C> bytecode);
+
+ /**
+ * The set of strategies that must be executed before this strategy is executed.
+ * If there are no ordering requirements, the default implementation returns an empty set.
+ *
+ * @return the set of strategies that must be executed prior to this one.
+ */
+ public default Set<Class<? extends S>> applyPrior() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * The set of strategies that must be executed after this strategy is executed.
+ * If there are no ordering requirements, the default implementation returns an empty set.
+ *
+ * @return the set of strategies that must be executed post this one
+ */
+ public default Set<Class<? extends S>> applyPost() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * The type of traversal strategy -- i.e. {@link DecorationStrategy}, {@link OptimizationStrategy}, {@link FinalizationStrategy}, or {@link VerificationStrategy}.
+ *
+ * @return the traversal strategy category class
+ */
+ public default Class<S> getStrategyCategory() {
+ return (Class) Strategy.class;
+ }
+
+ @Override
+ public default int compareTo(final Class<? extends Strategy> otherStrategyCategory) {
+ return 0;
+ }
+
+ /**
+ * Implemented by strategies that adds "application logic" to the traversal.
+ */
+ public interface DecorationStrategy extends Strategy<DecorationStrategy> {
+
+ @Override
+ public default Class<DecorationStrategy> getStrategyCategory() {
+ return DecorationStrategy.class;
+ }
+
+ @Override
+ public default int compareTo(final Class<? extends Strategy> otherTraversalCategory) {
+ if (otherTraversalCategory.equals(DecorationStrategy.class))
+ return 0;
+ else if (otherTraversalCategory.equals(OptimizationStrategy.class))
+ return -1;
+ else if (otherTraversalCategory.equals(ProviderStrategy.class))
+ return -1;
+ else if (otherTraversalCategory.equals(FinalizationStrategy.class))
+ return -1;
+ else if (otherTraversalCategory.equals(VerificationStrategy.class))
+ return -1;
+ else
+ return 0;
+ }
+ }
+
+ /**
+ * Implemented by strategies that rewrite the traversal to be more efficient, but with the same semantics.
+ * During a re-write ONLY TinkerPop steps should be used.
+ * For strategies that utilize provider specific steps, use {@link ProviderStrategy}.
+ */
+ public interface OptimizationStrategy extends Strategy<OptimizationStrategy> {
+
+ @Override
+ public default Class<OptimizationStrategy> getStrategyCategory() {
+ return OptimizationStrategy.class;
+ }
+
+ @Override
+ public default int compareTo(final Class<? extends Strategy> otherTraversalCategory) {
+ if (otherTraversalCategory.equals(DecorationStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(OptimizationStrategy.class))
+ return 0;
+ else if (otherTraversalCategory.equals(ProviderStrategy.class))
+ return -1;
+ else if (otherTraversalCategory.equals(FinalizationStrategy.class))
+ return -1;
+ else if (otherTraversalCategory.equals(VerificationStrategy.class))
+ return -1;
+ else
+ return 0;
+ }
+ }
+
+ /**
+ * Implemented by strategies that rewrite the traversal to be more efficient, but with the same semantics.
+ * This is for graph system/language/driver providers that want to rewrite a traversal using provider specific steps.
+ */
+ public interface ProviderStrategy extends Strategy<ProviderStrategy> {
+
+ @Override
+ public default Class<ProviderStrategy> getStrategyCategory() {
+ return ProviderStrategy.class;
+ }
+
+ @Override
+ public default int compareTo(final Class<? extends Strategy> otherTraversalCategory) {
+ if (otherTraversalCategory.equals(DecorationStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(OptimizationStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(ProviderStrategy.class))
+ return 0;
+ else if (otherTraversalCategory.equals(FinalizationStrategy.class))
+ return -1;
+ else if (otherTraversalCategory.equals(VerificationStrategy.class))
+ return -1;
+ else
+ return 0;
+ }
+ }
+
+ /**
+ * Implemented by strategies that do final behaviors that require a fully compiled traversal to work.
+ */
+ public interface FinalizationStrategy extends Strategy<FinalizationStrategy> {
+
+ @Override
+ public default Class<FinalizationStrategy> getStrategyCategory() {
+ return FinalizationStrategy.class;
+ }
+
+ @Override
+ public default int compareTo(final Class<? extends Strategy> otherTraversalCategory) {
+ if (otherTraversalCategory.equals(DecorationStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(OptimizationStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(ProviderStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(FinalizationStrategy.class))
+ return 0;
+ else if (otherTraversalCategory.equals(VerificationStrategy.class))
+ return -1;
+ else
+ return 0;
+ }
+ }
+
+ /**
+ * Implemented by strategies where there is no more behavioral tweaking of the traversal required. Strategies that
+ * implement this category will simply analyze the traversal and throw exceptions if the traversal is not correct
+ * for the execution context.
+ */
+ public interface VerificationStrategy extends Strategy<VerificationStrategy> {
+
+ @Override
+ public default Class<VerificationStrategy> getStrategyCategory() {
+ return VerificationStrategy.class;
+ }
+
+ @Override
+ public default int compareTo(final Class<? extends Strategy> otherTraversalCategory) {
+ if (otherTraversalCategory.equals(DecorationStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(OptimizationStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(ProviderStrategy.class))
+ return 1;
+ else if (otherTraversalCategory.equals(FinalizationStrategy.class))
+ return 1;
+ else
+ return 0;
+ }
+ }
+
}
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/CoefficientStrategy.java b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/finalization/CoefficientStrategy.java
similarity index 89%
rename from java/core/src/main/java/org/apache/tinkerpop/machine/strategy/CoefficientStrategy.java
rename to java/core/src/main/java/org/apache/tinkerpop/machine/strategy/finalization/CoefficientStrategy.java
index 67d700c..da47a64 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/CoefficientStrategy.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/finalization/CoefficientStrategy.java
@@ -16,21 +16,22 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tinkerpop.machine.strategy;
+package org.apache.tinkerpop.machine.strategy.finalization;
-import org.apache.tinkerpop.machine.bytecode.CoreCompiler;
import org.apache.tinkerpop.machine.bytecode.Bytecode;
import org.apache.tinkerpop.machine.bytecode.BytecodeUtil;
+import org.apache.tinkerpop.machine.bytecode.CoreCompiler;
import org.apache.tinkerpop.machine.bytecode.Instruction;
import org.apache.tinkerpop.machine.coefficient.Coefficient;
import org.apache.tinkerpop.machine.coefficient.LongCoefficient;
+import org.apache.tinkerpop.machine.strategy.Strategy;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public final class CoefficientStrategy implements Strategy {
+public final class CoefficientStrategy implements Strategy.FinalizationStrategy {
@Override
- public <C> void apply(Bytecode<C> bytecode) {
+ public <C> void apply(final Bytecode<C> bytecode) {
Coefficient<C> coefficient = BytecodeUtil.getCoefficient(bytecode).orElse(null);
if (null == coefficient) {
coefficient = (Coefficient<C>) LongCoefficient.create();
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/TraverserFactoryStrategy.java b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/finalization/TraverserFactoryStrategy.java
similarity index 85%
rename from java/core/src/main/java/org/apache/tinkerpop/machine/strategy/TraverserFactoryStrategy.java
rename to java/core/src/main/java/org/apache/tinkerpop/machine/strategy/finalization/TraverserFactoryStrategy.java
index 9cd0542..a499fe8 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/TraverserFactoryStrategy.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/finalization/TraverserFactoryStrategy.java
@@ -16,16 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tinkerpop.machine.strategy;
+package org.apache.tinkerpop.machine.strategy.finalization;
import org.apache.tinkerpop.machine.bytecode.Bytecode;
-import org.apache.tinkerpop.machine.bytecode.BytecodeUtil;
+import org.apache.tinkerpop.machine.strategy.Strategy;
import org.apache.tinkerpop.machine.traverser.TraverserFactory;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class TraverserFactoryStrategy implements Strategy {
+public class TraverserFactoryStrategy implements Strategy.FinalizationStrategy {
private TraverserFactory traverserFactory;
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/IdentityStrategy.java b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/optimization/IdentityStrategy.java
similarity index 87%
rename from java/core/src/main/java/org/apache/tinkerpop/machine/strategy/IdentityStrategy.java
rename to java/core/src/main/java/org/apache/tinkerpop/machine/strategy/optimization/IdentityStrategy.java
index 5772914..3676e9f 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/IdentityStrategy.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/optimization/IdentityStrategy.java
@@ -16,15 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tinkerpop.machine.strategy;
+package org.apache.tinkerpop.machine.strategy.optimization;
-import org.apache.tinkerpop.machine.bytecode.CoreCompiler;
import org.apache.tinkerpop.machine.bytecode.Bytecode;
+import org.apache.tinkerpop.machine.bytecode.CoreCompiler;
+import org.apache.tinkerpop.machine.strategy.Strategy;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public final class IdentityStrategy implements Strategy {
+public final class IdentityStrategy implements Strategy.OptimizationStrategy {
@Override
public <C> void apply(final Bytecode<C> bytecode) {
diff --git a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/CoefficientVerificationStrategy.java b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/verification/CoefficientVerificationStrategy.java
similarity index 91%
rename from java/core/src/main/java/org/apache/tinkerpop/machine/strategy/CoefficientVerificationStrategy.java
rename to java/core/src/main/java/org/apache/tinkerpop/machine/strategy/verification/CoefficientVerificationStrategy.java
index 0bfb420..886fd28 100644
--- a/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/CoefficientVerificationStrategy.java
+++ b/java/core/src/main/java/org/apache/tinkerpop/machine/strategy/verification/CoefficientVerificationStrategy.java
@@ -16,16 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tinkerpop.machine.strategy;
+package org.apache.tinkerpop.machine.strategy.verification;
import org.apache.tinkerpop.machine.bytecode.Bytecode;
import org.apache.tinkerpop.machine.bytecode.CoreCompiler;
import org.apache.tinkerpop.machine.bytecode.Instruction;
+import org.apache.tinkerpop.machine.strategy.Strategy;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public final class CoefficientVerificationStrategy implements Strategy {
+public final class CoefficientVerificationStrategy implements Strategy.VerificationStrategy {
@Override
public <C> void apply(final Bytecode<C> bytecode) {
diff --git a/java/language/gremlin/src/main/java/org/apache/tinkerpop/language/gremlin/TraversalSource.java b/java/language/gremlin/src/main/java/org/apache/tinkerpop/language/gremlin/TraversalSource.java
index 389e429..9867e96 100644
--- a/java/language/gremlin/src/main/java/org/apache/tinkerpop/language/gremlin/TraversalSource.java
+++ b/java/language/gremlin/src/main/java/org/apache/tinkerpop/language/gremlin/TraversalSource.java
@@ -22,8 +22,8 @@ import org.apache.tinkerpop.machine.bytecode.Bytecode;
import org.apache.tinkerpop.machine.bytecode.CoreCompiler.Symbols;
import org.apache.tinkerpop.machine.coefficient.Coefficient;
import org.apache.tinkerpop.machine.processor.ProcessorFactory;
-import org.apache.tinkerpop.machine.strategy.CoefficientStrategy;
-import org.apache.tinkerpop.machine.strategy.CoefficientVerificationStrategy;
+import org.apache.tinkerpop.machine.strategy.finalization.CoefficientStrategy;
+import org.apache.tinkerpop.machine.strategy.verification.CoefficientVerificationStrategy;
import org.apache.tinkerpop.machine.strategy.Strategy;
import org.apache.tinkerpop.machine.structure.StructureFactory;
import org.apache.tinkerpop.machine.structure.data.TVertex;
@@ -50,18 +50,12 @@ public class TraversalSource<C> {
public TraversalSource<C> withProcessor(final Class<? extends ProcessorFactory> processor) {
this.bytecode = this.bytecode.clone();
this.bytecode.addSourceInstruction(Symbols.WITH_PROCESSOR, processor);
- for (final Strategy strategy : ProcessorFactory.processorStrategies(processor)) { // TODO: do this at compile time so errant strategies don't exist.
- this.bytecode.addSourceInstruction(Symbols.WITH_STRATEGY, strategy.getClass());
- }
return this;
}
public TraversalSource<C> withStructure(final Class<? extends StructureFactory> structure) {
this.bytecode = this.bytecode.clone();
this.bytecode.addSourceInstruction(Symbols.WITH_STRUCTURE, structure);
- for (final Strategy strategy : StructureFactory.structureStrategies(structure)) { // TODO: do this at compile time so errant strategies don't exist.
- this.bytecode.addSourceInstruction(Symbols.WITH_STRATEGY, strategy.getClass());
- }
return this;
}
diff --git a/java/machine/processor/beam/src/main/java/org/apache/tinkerpop/machine/beam/strategy/BeamStrategy.java b/java/machine/processor/beam/src/main/java/org/apache/tinkerpop/machine/beam/strategy/BeamStrategy.java
index b793b3b..c6915ce 100644
--- a/java/machine/processor/beam/src/main/java/org/apache/tinkerpop/machine/beam/strategy/BeamStrategy.java
+++ b/java/machine/processor/beam/src/main/java/org/apache/tinkerpop/machine/beam/strategy/BeamStrategy.java
@@ -27,7 +27,7 @@ import org.apache.tinkerpop.machine.strategy.Strategy;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class BeamStrategy implements Strategy {
+public class BeamStrategy implements Strategy.ProviderStrategy {
@Override
diff --git a/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/BeamTest.java b/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/BeamTest.java
index 7a2c4b7..32d2315 100644
--- a/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/BeamTest.java
+++ b/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/BeamTest.java
@@ -25,7 +25,7 @@ import org.apache.tinkerpop.language.gremlin.TraversalSource;
import org.apache.tinkerpop.language.gremlin.TraversalUtil;
import org.apache.tinkerpop.language.gremlin.__;
import org.apache.tinkerpop.machine.coefficient.LongCoefficient;
-import org.apache.tinkerpop.machine.strategy.IdentityStrategy;
+import org.apache.tinkerpop.machine.strategy.optimization.IdentityStrategy;
import org.apache.tinkerpop.machine.structure.tinkergraph.TinkerGraphStructure;
import org.junit.jupiter.api.Test;
diff --git a/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/functions/TraversalSourceLibrary.java b/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/functions/TraversalSourceLibrary.java
index 63acc87..8b7c846 100644
--- a/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/functions/TraversalSourceLibrary.java
+++ b/java/machine/processor/beam/src/test/java/org/apache/tinkerpop/machine/beam/functions/TraversalSourceLibrary.java
@@ -22,7 +22,7 @@ import org.apache.tinkerpop.language.gremlin.Gremlin;
import org.apache.tinkerpop.language.gremlin.TraversalSource;
import org.apache.tinkerpop.machine.beam.BeamProcessor;
import org.apache.tinkerpop.machine.coefficient.LongCoefficient;
-import org.apache.tinkerpop.machine.strategy.IdentityStrategy;
+import org.apache.tinkerpop.machine.strategy.optimization.IdentityStrategy;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
diff --git a/java/machine/processor/pipes/src/main/java/org/apache/tinkerpop/machine/pipes/strategy/PipesStrategy.java b/java/machine/processor/pipes/src/main/java/org/apache/tinkerpop/machine/pipes/strategy/PipesStrategy.java
index 271e174..f5c31fe 100644
--- a/java/machine/processor/pipes/src/main/java/org/apache/tinkerpop/machine/pipes/strategy/PipesStrategy.java
+++ b/java/machine/processor/pipes/src/main/java/org/apache/tinkerpop/machine/pipes/strategy/PipesStrategy.java
@@ -27,7 +27,7 @@ import org.apache.tinkerpop.machine.strategy.Strategy;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public final class PipesStrategy implements Strategy {
+public final class PipesStrategy implements Strategy.ProviderStrategy {
@Override
public <C> void apply(final Bytecode<C> bytecode) {
if (!BytecodeUtil.hasSourceInstruction(bytecode, Symbols.WITH_PROCESSOR))
diff --git a/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/PipesTest.java b/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/PipesTest.java
index ede8377..4545720 100644
--- a/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/PipesTest.java
+++ b/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/PipesTest.java
@@ -25,7 +25,7 @@ import org.apache.tinkerpop.language.gremlin.TraversalSource;
import org.apache.tinkerpop.language.gremlin.TraversalUtil;
import org.apache.tinkerpop.language.gremlin.__;
import org.apache.tinkerpop.machine.coefficient.LongCoefficient;
-import org.apache.tinkerpop.machine.strategy.IdentityStrategy;
+import org.apache.tinkerpop.machine.strategy.optimization.IdentityStrategy;
import org.apache.tinkerpop.machine.structure.tinkergraph.TinkerGraphStructure;
import org.junit.jupiter.api.Test;
diff --git a/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/function/TraversalSourceLibrary.java b/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/function/TraversalSourceLibrary.java
index 96b65b2..eb9e61c 100644
--- a/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/function/TraversalSourceLibrary.java
+++ b/java/machine/processor/pipes/src/test/java/org/apache/tinkerpop/machine/pipes/function/TraversalSourceLibrary.java
@@ -22,7 +22,7 @@ import org.apache.tinkerpop.language.gremlin.Gremlin;
import org.apache.tinkerpop.language.gremlin.TraversalSource;
import org.apache.tinkerpop.machine.coefficient.LongCoefficient;
import org.apache.tinkerpop.machine.pipes.PipesProcessor;
-import org.apache.tinkerpop.machine.strategy.IdentityStrategy;
+import org.apache.tinkerpop.machine.strategy.optimization.IdentityStrategy;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
diff --git a/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/TinkerGraphStructure.java b/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/TinkerGraphStructure.java
index 7adb5db..c473d50 100644
--- a/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/TinkerGraphStructure.java
+++ b/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/TinkerGraphStructure.java
@@ -23,7 +23,7 @@ import org.apache.tinkerpop.machine.strategy.Strategy;
import org.apache.tinkerpop.machine.structure.Structure;
import org.apache.tinkerpop.machine.structure.StructureFactory;
import org.apache.tinkerpop.machine.structure.tinkergraph.bytecode.TinkerGraphCompiler;
-import org.apache.tinkerpop.machine.structure.tinkergraph.strategy.VerticesStrategy;
+import org.apache.tinkerpop.machine.structure.tinkergraph.strategy.provider.VerticesStrategy;
import java.util.Arrays;
import java.util.List;
diff --git a/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/strategy/VerticesStrategy.java b/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/strategy/provider/VerticesStrategy.java
similarity index 95%
rename from java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/strategy/VerticesStrategy.java
rename to java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/strategy/provider/VerticesStrategy.java
index f5163e5..f44d176 100644
--- a/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/strategy/VerticesStrategy.java
+++ b/java/machine/structure/tinkergraph/src/main/java/org/apache/tinkerpop/machine/structure/tinkergraph/strategy/provider/VerticesStrategy.java
@@ -16,19 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tinkerpop.machine.structure.tinkergraph.strategy;
+package org.apache.tinkerpop.machine.structure.tinkergraph.strategy.provider;
import org.apache.tinkerpop.machine.bytecode.Bytecode;
import org.apache.tinkerpop.machine.bytecode.BytecodeUtil;
-import org.apache.tinkerpop.machine.bytecode.Instruction;
import org.apache.tinkerpop.machine.bytecode.CoreCompiler;
+import org.apache.tinkerpop.machine.bytecode.Instruction;
import org.apache.tinkerpop.machine.strategy.Strategy;
import org.apache.tinkerpop.machine.structure.tinkergraph.bytecode.TinkerGraphCompiler;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class VerticesStrategy implements Strategy {
+public class VerticesStrategy implements Strategy.ProviderStrategy {
@Override
public <C> void apply(final Bytecode<C> bytecode) {
Instruction<C> temp = null;