move boilerplate FunctionN into akka.japi.function package
This is a temporary solution until the classes are added to akka-actor.
This commit is contained in:
parent
f5cafd0342
commit
5eb62f0a81
12 changed files with 48 additions and 50 deletions
|
|
@ -20,7 +20,6 @@ import akka.japi.Pair;
|
|||
import akka.stream.*;
|
||||
import akka.stream.testkit.AkkaSpec;
|
||||
import akka.stream.javadsl.FlowGraph.Builder;
|
||||
import akka.stream.javadsl.japi.*;
|
||||
import akka.japi.function.*;
|
||||
import akka.util.ByteString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ import org.reactivestreams.Publisher;
|
|||
import akka.actor.ActorSystem;
|
||||
import akka.stream.*;
|
||||
import akka.stream.javadsl.FlowGraph.Builder;
|
||||
import akka.stream.javadsl.japi.Procedure2;
|
||||
import akka.stream.testkit.AkkaSpec;
|
||||
import scala.concurrent.Await;
|
||||
import scala.concurrent.Future;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import scala.runtime.BoxedUnit;
|
||||
import akka.japi.Pair;
|
||||
import akka.japi.function.Procedure2;
|
||||
|
||||
public class FlexiMergeTest {
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import akka.stream.*;
|
|||
import akka.stream.testkit.AkkaSpec;
|
||||
import akka.stream.javadsl.FlexiRoute;
|
||||
import akka.stream.javadsl.FlowGraph.Builder;
|
||||
import akka.stream.javadsl.japi.Procedure3;
|
||||
import akka.japi.function.Procedure3;
|
||||
import akka.japi.Pair;
|
||||
import scala.concurrent.Await;
|
||||
import scala.concurrent.Future;
|
||||
|
|
|
|||
|
|
@ -4,14 +4,9 @@
|
|||
package akka.stream.javadsl;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.japi.*;
|
||||
import akka.japi.Pair;
|
||||
import akka.stream.*;
|
||||
import akka.stream.javadsl.FlowGraph.Builder;
|
||||
import akka.stream.javadsl.japi.*;
|
||||
import akka.japi.function.Creator;
|
||||
import akka.japi.function.Function;
|
||||
import akka.japi.function.Function2;
|
||||
import akka.japi.function.Procedure;
|
||||
import akka.stream.stage.*;
|
||||
import akka.japi.function.*;
|
||||
import akka.stream.testkit.AkkaSpec;
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@ import akka.stream.OverflowStrategy;
|
|||
import akka.stream.StreamTest;
|
||||
import akka.stream.stage.*;
|
||||
import akka.stream.javadsl.FlowGraph.Builder;
|
||||
import akka.stream.javadsl.japi.*;
|
||||
import akka.japi.function.*;
|
||||
import akka.stream.*;
|
||||
import akka.stream.testkit.AkkaSpec;
|
||||
import akka.testkit.JavaTestKit;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import scala.runtime.Boxed;
|
||||
import scala.runtime.BoxedUnit;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
package akka.stream.javadsl.japi
|
||||
package akka.japi.function
|
||||
|
||||
[3..22#/**
|
||||
* A Function interface. Used to create 1-arg first-class-functions is Java.
|
||||
|
|
@ -6,6 +6,7 @@ package akka.stream.javadsl
|
|||
import akka.stream.scaladsl
|
||||
import akka.stream.{ Inlet, Outlet, Shape, Graph, BidiShape }
|
||||
import akka.japi.Pair
|
||||
import akka.japi.function
|
||||
|
||||
trait BidiFlowCreate {
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ trait BidiFlowCreate {
|
|||
/**
|
||||
* Creates a BidiFlow by applying a [[FlowGraph.Builder]] to the given create function.
|
||||
*/
|
||||
def create[I1, O1, I2, O2](block: akka.japi.function.Function[FlowGraph.Builder[Unit], BidiShape[I1, O1, I2, O2]]): BidiFlow[I1, O1, I2, O2, Unit] =
|
||||
def create[I1, O1, I2, O2](block: function.Function[FlowGraph.Builder[Unit], BidiShape[I1, O1, I2, O2]]): BidiFlow[I1, O1, I2, O2, Unit] =
|
||||
new BidiFlow(scaladsl.BidiFlow() { b ⇒ block.apply(b.asJava) })
|
||||
|
||||
/**
|
||||
|
|
@ -23,23 +24,23 @@ trait BidiFlowCreate {
|
|||
* The given graph will be imported (using `builder.graph()`) and the resulting [[Shape]] will be passed to the create function along with the builder.
|
||||
*/
|
||||
def create[I1, O1, I2, O2, S <: Shape, M](g1: Graph[S, M],
|
||||
block: akka.japi.function.Function2[FlowGraph.Builder[M], S, BidiShape[I1, O1, I2, O2]]): BidiFlow[I1, O1, I2, O2, M] =
|
||||
block: function.Function2[FlowGraph.Builder[M], S, BidiShape[I1, O1, I2, O2]]): BidiFlow[I1, O1, I2, O2, M] =
|
||||
new BidiFlow(scaladsl.BidiFlow(g1) { b ⇒ s => block.apply(b.asJava, s) })
|
||||
|
||||
/**
|
||||
* Creates a BidiFlow by applying a [[FlowGraph.Builder]] to the given create function.
|
||||
* The given graphs will be imported (using `builder.graph()`) and the resulting [[Shape]]s will be passed to the create function along with the builder.
|
||||
*/
|
||||
def create[I1, O1, I2, O2, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: akka.japi.function.Function2[M1, M2, M],
|
||||
block: japi.Function3[FlowGraph.Builder[M], S1, S2, BidiShape[I1, O1, I2, O2]]): BidiFlow[I1, O1, I2, O2, M] =
|
||||
def create[I1, O1, I2, O2, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: function.Function2[M1, M2, M],
|
||||
block: function.Function3[FlowGraph.Builder[M], S1, S2, BidiShape[I1, O1, I2, O2]]): BidiFlow[I1, O1, I2, O2, M] =
|
||||
new BidiFlow(scaladsl.BidiFlow(g1, g2)(combineMat.apply _) { b => (s1, s2) => block.apply(b.asJava, s1, s2) })
|
||||
|
||||
[3..21#/**
|
||||
* Creates a BidiFlow by applying a [[FlowGraph.Builder]] to the given create function.
|
||||
* The given graphs will be imported (using `builder.graph()`) and the resulting [[Shape]]s will be passed to the create function along with the builder.
|
||||
*/
|
||||
def create1[I##1, O##1, I##2, O##2, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: japi.Function1[[#M1#], M],
|
||||
block: japi.Function2[FlowGraph.Builder[M], [#S1#], BidiShape[I##1, O##1, I##2, O##2]]): BidiFlow[I##1, O##1, I##2, O##2, M] =
|
||||
def create1[I##1, O##1, I##2, O##2, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: function.Function1[[#M1#], M],
|
||||
block: function.Function2[FlowGraph.Builder[M], [#S1#], BidiShape[I##1, O##1, I##2, O##2]]): BidiFlow[I##1, O##1, I##2, O##2, M] =
|
||||
new BidiFlow(scaladsl.BidiFlow([#g1#])(combineMat.apply _) { b => ([#s1#]) => block.apply(b.asJava, [#s1#]) })#
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package akka.stream.javadsl
|
|||
import akka.stream.scaladsl
|
||||
import akka.stream.{ Inlet, Outlet, Shape, Graph }
|
||||
import akka.japi.Pair
|
||||
import akka.japi.function
|
||||
|
||||
trait FlowCreate {
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ trait FlowCreate {
|
|||
*
|
||||
* The create function is expected to return a pair of [[Inlet]] and [[Outlet]] which correspond to the created Flows input and output ports.
|
||||
*/
|
||||
def create[I, O](block: akka.japi.function.Function[FlowGraph.Builder[Unit], Inlet[I] Pair Outlet[O]]): Flow[I, O, Unit] =
|
||||
def create[I, O](block: function.Function[FlowGraph.Builder[Unit], Inlet[I] Pair Outlet[O]]): Flow[I, O, Unit] =
|
||||
new Flow(scaladsl.Flow() { b ⇒ block.apply(b.asJava) })
|
||||
|
||||
/**
|
||||
|
|
@ -26,7 +27,7 @@ trait FlowCreate {
|
|||
*
|
||||
* The create function is expected to return a pair of [[Inlet]] and [[Outlet]] which correspond to the created Flows input and output ports.
|
||||
*/
|
||||
def create[I, O, S <: Shape, M](g1: Graph[S, M], block: akka.japi.function.Function2[FlowGraph.Builder[M], S, Inlet[I] Pair Outlet[O]]): Flow[I, O, M] =
|
||||
def create[I, O, S <: Shape, M](g1: Graph[S, M], block: function.Function2[FlowGraph.Builder[M], S, Inlet[I] Pair Outlet[O]]): Flow[I, O, M] =
|
||||
new Flow(scaladsl.Flow(g1) { b ⇒ s => block.apply(b.asJava, s) })
|
||||
|
||||
/**
|
||||
|
|
@ -35,8 +36,8 @@ trait FlowCreate {
|
|||
*
|
||||
* The create function is expected to return a pair of [[Inlet]] and [[Outlet]] which correspond to the created Flows input and output ports.
|
||||
*/
|
||||
def create[I, O, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: akka.japi.function.Function2[M1, M2, M],
|
||||
block: japi.Function3[FlowGraph.Builder[M], S1, S2, Inlet[I] Pair Outlet[O]]): Flow[I, O, M] =
|
||||
def create[I, O, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: function.Function2[M1, M2, M],
|
||||
block: function.Function3[FlowGraph.Builder[M], S1, S2, Inlet[I] Pair Outlet[O]]): Flow[I, O, M] =
|
||||
new Flow(scaladsl.Flow(g1, g2)(combineMat.apply _) { b => (s1, s2) => block.apply(b.asJava, s1, s2) })
|
||||
|
||||
[3..21#/**
|
||||
|
|
@ -45,8 +46,8 @@ trait FlowCreate {
|
|||
*
|
||||
* The create function is expected to return a pair of [[Inlet]] and [[Outlet]] which correspond to the created Flows input and output ports.
|
||||
*/
|
||||
def create1[I, O, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: japi.Function1[[#M1#], M],
|
||||
block: japi.Function2[FlowGraph.Builder[M], [#S1#], Inlet[I] Pair Outlet[O]]): Flow[I, O, M] =
|
||||
def create1[I, O, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: function.Function1[[#M1#], M],
|
||||
block: function.Function2[FlowGraph.Builder[M], [#S1#], Inlet[I] Pair Outlet[O]]): Flow[I, O, M] =
|
||||
new Flow(scaladsl.Flow([#g1#])(combineMat.apply _) { b => ([#s1#]) => block.apply(b.asJava, [#s1#]) })#
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package akka.stream.javadsl
|
|||
|
||||
import akka.stream.scaladsl
|
||||
import akka.stream.{ Inlet, Shape, Graph }
|
||||
import akka.japi.function
|
||||
|
||||
trait GraphCreate {
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ trait GraphCreate {
|
|||
* The created graph must have all ports connected, otherwise an [[IllegalArgumentException]] is thrown.
|
||||
*/
|
||||
@throws(classOf[IllegalArgumentException])
|
||||
def closed(block: akka.japi.function.Procedure[FlowGraph.Builder[Unit]]): RunnableFlow[Unit] =
|
||||
def closed(block: function.Procedure[FlowGraph.Builder[Unit]]): RunnableFlow[Unit] =
|
||||
scaladsl.FlowGraph.closed() { b ⇒ block.apply(b.asJava) }
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +26,7 @@ trait GraphCreate {
|
|||
*
|
||||
* Partial graphs are allowed to have unconnected ports.
|
||||
*/
|
||||
def partial[S <: Shape](block: akka.japi.function.Function[FlowGraph.Builder[Unit], S]): Graph[S, Unit] =
|
||||
def partial[S <: Shape](block: function.Function[FlowGraph.Builder[Unit], S]): Graph[S, Unit] =
|
||||
scaladsl.FlowGraph.partial() { b ⇒ block.apply(b.asJava) }
|
||||
|
||||
/**
|
||||
|
|
@ -36,7 +37,7 @@ trait GraphCreate {
|
|||
*/
|
||||
@throws(classOf[IllegalArgumentException])
|
||||
def closed[S1 <: Shape, M](g1: Graph[S1, M],
|
||||
block: japi.Procedure2[FlowGraph.Builder[M], S1]): RunnableFlow[M] =
|
||||
block: function.Procedure2[FlowGraph.Builder[M], S1]): RunnableFlow[M] =
|
||||
scaladsl.FlowGraph.closed(g1) { b ⇒ s => block.apply(b.asJava, s) }
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +47,7 @@ trait GraphCreate {
|
|||
* Partial graphs are allowed to have unconnected ports.
|
||||
*/
|
||||
def partial[S1 <: Shape, S <: Shape, M](g1: Graph[S1, M],
|
||||
block: akka.japi.function.Function2[FlowGraph.Builder[M], S1, S]): Graph[S, M] =
|
||||
block: function.Function2[FlowGraph.Builder[M], S1, S]): Graph[S, M] =
|
||||
scaladsl.FlowGraph.partial(g1) { b ⇒ s => block.apply(b.asJava, s) }
|
||||
|
||||
/**
|
||||
|
|
@ -56,8 +57,8 @@ trait GraphCreate {
|
|||
* The created graph must have all ports connected, otherwise an [[IllegalArgumentException]] is thrown.
|
||||
*/
|
||||
@throws(classOf[IllegalArgumentException])
|
||||
def closed[S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: akka.japi.function.Function2[M1, M2, M],
|
||||
block: japi.Procedure3[FlowGraph.Builder[M], S1, S2]): RunnableFlow[M] =
|
||||
def closed[S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: function.Function2[M1, M2, M],
|
||||
block: function.Procedure3[FlowGraph.Builder[M], S1, S2]): RunnableFlow[M] =
|
||||
scaladsl.FlowGraph.closed(g1, g2)(combineMat.apply _) { b => (s1, s2) => block.apply(b.asJava, s1, s2) }
|
||||
|
||||
/**
|
||||
|
|
@ -66,8 +67,8 @@ trait GraphCreate {
|
|||
*
|
||||
* Partial graphs are allowed to have unconnected ports.
|
||||
*/
|
||||
def partial[S1 <: Shape, S2 <: Shape, S <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: akka.japi.function.Function2[M1, M2, M],
|
||||
block: japi.Function3[FlowGraph.Builder[M], S1, S2, S]): Graph[S, M] =
|
||||
def partial[S1 <: Shape, S2 <: Shape, S <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: function.Function2[M1, M2, M],
|
||||
block: function.Function3[FlowGraph.Builder[M], S1, S2, S]): Graph[S, M] =
|
||||
scaladsl.FlowGraph.partial(g1, g2)(combineMat.apply _) { b => (s1, s2) => block.apply(b.asJava, s1, s2) }
|
||||
|
||||
[3..21#/**
|
||||
|
|
@ -77,8 +78,8 @@ trait GraphCreate {
|
|||
* The created graph must have all ports connected, otherwise an [[IllegalArgumentException]] is thrown.
|
||||
*/
|
||||
@throws(classOf[IllegalArgumentException])
|
||||
def closed1[[#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: japi.Function1[[#M1#], M],
|
||||
block: japi.Procedure2[FlowGraph.Builder[M], [#S1#]]): RunnableFlow[M] =
|
||||
def closed1[[#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: function.Function1[[#M1#], M],
|
||||
block: function.Procedure2[FlowGraph.Builder[M], [#S1#]]): RunnableFlow[M] =
|
||||
scaladsl.FlowGraph.closed([#g1#])(combineMat.apply _) { b => ([#s1#]) => block.apply(b.asJava, [#s1#]) }
|
||||
|
||||
/**
|
||||
|
|
@ -87,8 +88,8 @@ trait GraphCreate {
|
|||
*
|
||||
* Partial graphs are allowed to have unconnected ports.
|
||||
*/
|
||||
def partial1[[#S1 <: Shape#], S <: Shape, [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: japi.Function1[[#M1#], M],
|
||||
block: japi.Function2[FlowGraph.Builder[M], [#S1#], S]): Graph[S, M] =
|
||||
def partial1[[#S1 <: Shape#], S <: Shape, [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: function.Function1[[#M1#], M],
|
||||
block: function.Function2[FlowGraph.Builder[M], [#S1#], S]): Graph[S, M] =
|
||||
scaladsl.FlowGraph.partial([#g1#])(combineMat.apply _) { b => ([#s1#]) => block.apply(b.asJava, [#s1#]) }#
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package akka.stream.javadsl
|
|||
|
||||
import akka.stream.scaladsl
|
||||
import akka.stream.{ Inlet, Shape, Graph }
|
||||
import akka.japi.function
|
||||
|
||||
trait SinkCreate {
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ trait SinkCreate {
|
|||
* Creates a `Sink` by using a `FlowGraph.Builder[Unit]` on a block that expects
|
||||
* a [[FlowGraph.Builder]] and returns an [[Inlet]].
|
||||
*/
|
||||
def create[T](block: akka.japi.function.Function[FlowGraph.Builder[Unit], Inlet[T]]): Sink[T, Unit] =
|
||||
def create[T](block: function.Function[FlowGraph.Builder[Unit], Inlet[T]]): Sink[T, Unit] =
|
||||
new Sink(scaladsl.Sink() { b ⇒ block.apply(b.asJava) })
|
||||
|
||||
/**
|
||||
|
|
@ -21,7 +22,7 @@ trait SinkCreate {
|
|||
* The create function is expected to return the created Sink's [[Inlet]].
|
||||
*/
|
||||
def create[T, S <: Shape, M](g1: Graph[S, M],
|
||||
block: akka.japi.function.Function2[FlowGraph.Builder[M], S, Inlet[T]]): Sink[T, M] =
|
||||
block: function.Function2[FlowGraph.Builder[M], S, Inlet[T]]): Sink[T, M] =
|
||||
new Sink(scaladsl.Sink(g1) { b ⇒ s => block.apply(b.asJava, s) })
|
||||
|
||||
/**
|
||||
|
|
@ -29,8 +30,8 @@ trait SinkCreate {
|
|||
* with the `FlowGraph.Builder[M]` and the [[Shape]]s resulting from importing the graphs.
|
||||
* The create function is expected to return the created Sink's [[Inlet]].
|
||||
*/
|
||||
def create[T, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: akka.japi.function.Function2[M1, M2, M],
|
||||
block: japi.Function3[FlowGraph.Builder[M], S1, S2, Inlet[T]]): Sink[T, M] =
|
||||
def create[T, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: function.Function2[M1, M2, M],
|
||||
block: function.Function3[FlowGraph.Builder[M], S1, S2, Inlet[T]]): Sink[T, M] =
|
||||
new Sink(scaladsl.Sink(g1, g2)(combineMat.apply _) { b => (s1, s2) => block.apply(b.asJava, s1, s2) })
|
||||
|
||||
[3..21#/**
|
||||
|
|
@ -38,8 +39,8 @@ trait SinkCreate {
|
|||
* with the `FlowGraph.Builder[M]` and the [[Shape]]s resulting from importing the graphs.
|
||||
* The create function is expected to return the created Sink's [[Inlet]].
|
||||
*/
|
||||
def create1[T, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: japi.Function1[[#M1#], M],
|
||||
block: japi.Function2[FlowGraph.Builder[M], [#S1#], Inlet[T]]): Sink[T, M] =
|
||||
def create1[T, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: function.Function1[[#M1#], M],
|
||||
block: function.Function2[FlowGraph.Builder[M], [#S1#], Inlet[T]]): Sink[T, M] =
|
||||
new Sink(scaladsl.Sink([#g1#])(combineMat.apply _) { b => ([#s1#]) => block.apply(b.asJava, [#s1#]) })#
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package akka.stream.javadsl
|
|||
|
||||
import akka.stream.scaladsl
|
||||
import akka.stream.{ Outlet, Shape, Graph }
|
||||
import akka.japi.function
|
||||
|
||||
trait SourceCreate {
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ trait SourceCreate {
|
|||
* Creates a `Source` by using a `FlowGraph.Builder[Unit]` on a block that expects
|
||||
* a [[FlowGraph.Builder]] and returns an [[Outlet]].
|
||||
*/
|
||||
def create[T](block: akka.japi.function.Function[FlowGraph.Builder[Unit], Outlet[T]]): Source[T, Unit] =
|
||||
def create[T](block: function.Function[FlowGraph.Builder[Unit], Outlet[T]]): Source[T, Unit] =
|
||||
new Source(scaladsl.Source() { b ⇒ block.apply(b.asJava) })
|
||||
|
||||
/**
|
||||
|
|
@ -22,7 +23,7 @@ trait SourceCreate {
|
|||
* will be passed into the create block.
|
||||
*/
|
||||
def create[T, S <: Shape, M](g1: Graph[S, M],
|
||||
block: akka.japi.function.Function2[FlowGraph.Builder[M], S, Outlet[T]]): Source[T, M] =
|
||||
block: function.Function2[FlowGraph.Builder[M], S, Outlet[T]]): Source[T, M] =
|
||||
new Source(scaladsl.Source(g1) { b ⇒ s => block.apply(b.asJava, s) })
|
||||
|
||||
/**
|
||||
|
|
@ -31,8 +32,8 @@ trait SourceCreate {
|
|||
* The graphs will be imported (using `Builder.graph()`) and the resulting shapes
|
||||
* will be passed into the create block.
|
||||
*/
|
||||
def create[T, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: akka.japi.function.Function2[M1, M2, M],
|
||||
block: japi.Function3[FlowGraph.Builder[M], S1, S2, Outlet[T]]): Source[T, M] =
|
||||
def create[T, S1 <: Shape, S2 <: Shape, M1, M2, M](g1: Graph[S1, M1], g2: Graph[S2, M2], combineMat: function.Function2[M1, M2, M],
|
||||
block: function.Function3[FlowGraph.Builder[M], S1, S2, Outlet[T]]): Source[T, M] =
|
||||
new Source(scaladsl.Source(g1, g2)(combineMat.apply _) { b => (s1, s2) => block.apply(b.asJava, s1, s2) })
|
||||
|
||||
[3..21#/**
|
||||
|
|
@ -41,8 +42,8 @@ trait SourceCreate {
|
|||
* The graphs will be imported (using `Builder.graph()`) and the resulting shapes
|
||||
* will be passed into the create block.
|
||||
*/
|
||||
def create1[T, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: japi.Function1[[#M1#], M],
|
||||
block: japi.Function2[FlowGraph.Builder[M], [#S1#], Outlet[T]]): Source[T, M] =
|
||||
def create1[T, [#S1 <: Shape#], [#M1#], M]([#g1: Graph[S1, M1]#], combineMat: function.Function1[[#M1#], M],
|
||||
block: function.Function2[FlowGraph.Builder[M], [#S1#], Outlet[T]]): Source[T, M] =
|
||||
new Source(scaladsl.Source([#g1#])(combineMat.apply _) { b => ([#s1#]) => block.apply(b.asJava, [#s1#]) })#
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package akka.stream.javadsl
|
|||
|
||||
import akka.stream._
|
||||
import akka.stream.scaladsl
|
||||
import akka.japi.function
|
||||
|
||||
/**
|
||||
* Combine the elements of multiple streams into a stream of combined elements using a combiner function.
|
||||
|
|
@ -25,7 +26,7 @@ object ZipWith {
|
|||
* @param f zipping-function from the input values to the output value
|
||||
* @param attributes optional attributes for this vertex
|
||||
*/
|
||||
def create[A, B, Out](f: akka.japi.function.Function2[A, B, Out]): Graph[FanInShape2[A, B, Out], Unit] =
|
||||
def create[A, B, Out](f: function.Function2[A, B, Out]): Graph[FanInShape2[A, B, Out], Unit] =
|
||||
scaladsl.ZipWith(f.apply _)
|
||||
|
||||
[3..20#/** Create a new `ZipWith` specialized for 1 inputs.
|
||||
|
|
@ -33,7 +34,7 @@ object ZipWith {
|
|||
* @param f zipping-function from the input values to the output value
|
||||
* @param attributes optional attributes for this vertex
|
||||
*/
|
||||
def create1[[#T1#], Out](f: japi.Function1[[#T1#], Out]): Graph[FanInShape1[[#T1#], Out], Unit] =
|
||||
def create1[[#T1#], Out](f: function.Function1[[#T1#], Out]): Graph[FanInShape1[[#T1#], Out], Unit] =
|
||||
scaladsl.ZipWith(f.apply _)#
|
||||
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue