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 6b39526 I have a working implementation of recurssive-based repeat()
in RxJava. This was an intense slog. Learned alot. I have written some pretty
nasty nested branching test cases and the model is holding up.
6b39526 is described below
commit 6b39526f4bd0109d6789af5c1d300bc18463c6d3
Author: Marko A. Rodriguez
AuthorDate: Thu Apr 18 11:12:23 2019 -0600
I have a working implementation of recurssive-based repeat() in RxJava.
This was an intense slog. Learned alot. I have written some pretty nasty nested
branching test cases and the model is holding up.
---
.../apache/tinkerpop/machine/SimpleTestSuite.java | 14 +++
.../machine/processor/rxjava/RepeatHead.java | 135 +
.../machine/processor/rxjava/RepeatTail.java | 119 ++
.../machine/processor/rxjava/SerialRxJava.java | 41 ---
4 files changed, 290 insertions(+), 19 deletions(-)
diff --git
a/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
b/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
index 862ff71..7b1b6e8 100644
---
a/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
+++
b/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
@@ -24,6 +24,8 @@ import org.apache.tinkerpop.machine.bytecode.compiler.Order;
import org.junit.jupiter.api.Test;
import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static org.apache.tinkerpop.language.gremlin.P.gt;
import static org.apache.tinkerpop.language.gremlin.P.lt;
@@ -225,6 +227,18 @@ public class SimpleTestSuite extends
AbstractTestSuite {
g.inject(1L).repeat(union(incr(),
__.incr().incr())).times(2));
}
+// @Test (Parallel RxJava finds this too compute intensive)
+void g_injectX1X_repeatXunionXincr__incrX_unionXincr__incrXX_timesX3X() {
+verify(Stream.generate(() ->
7L).limit(64).collect(Collectors.toList()),
+g.inject(1L).repeat(__.union(incr(),
incr()).union(incr(),incr())).times(3));
+}
+
+// @Test (Parallel RxJava finds this too compute intensive)
+void
g_injectX1X_repeatXunionXincr__unionXincr__incrXX_unionXincr__incrXX_timesX3X()
{
+verify(Stream.generate(() ->
7L).limit(216).collect(Collectors.toList()),
+g.inject(1L).repeat(__.union(incr(),
__.union(incr(),incr())).union(incr(),incr())).times(3));
+}
+
@Test
void g_injectX1X_repeatXunionXincr__incr_incrXX_timesX3X() {
verify(List.of(4L, 5L, 5L, 6L, 5L, 6L, 6L, 7L),
diff --git
a/java/machine/processor/rxjava/src/main/java/org/apache/tinkerpop/machine/processor/rxjava/RepeatHead.java
b/java/machine/processor/rxjava/src/main/java/org/apache/tinkerpop/machine/processor/rxjava/RepeatHead.java
new file mode 100644
index 000..ef94b8b
--- /dev/null
+++
b/java/machine/processor/rxjava/src/main/java/org/apache/tinkerpop/machine/processor/rxjava/RepeatHead.java
@@ -0,0 +1,135 @@
+/*
+ * 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.machine.processor.rxjava;
+
+import io.reactivex.Flowable;
+import io.reactivex.FlowableTransformer;
+import org.apache.tinkerpop.machine.function.branch.RepeatBranch;
+import org.apache.tinkerpop.machine.traverser.Traverser;
+import org.apache.tinkerpop.machine.traverser.TraverserSet;
+import org.reactivestreams.Processor;
+import org.reactivestreams.Publisher;
+import org.reactivestreams.Subscriber;
+import org.reactivestreams.Subscription;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+final class RepeatHead implements Processor,
Traverser>, FlowableTransformer, Traverser> {
+
+private final TraverserSet starts = new TraverserSet<>();
+private final RepeatBranch repeatBranch;
+private Publisher> source;
+private Subscription upstream;
+private