Interface TraversalBuilder
-
- All Known Implementing Classes:
AtomicTraversalBuilder
,CompletedTraversalBuilder
,CompositeTraversalBuilder
,LinearTraversalBuilder
public interface TraversalBuilder
INTERNAL APIA builder for a Traversal. The purpose of subclasses of this trait is to eventually build a Traversal that describes the graph. Depending on whether the graph is linear or generic different approaches can be used but they still result in a Traversal.
The resulting Traversal can be accessed via the
traversal
method once the graph is completed (all ports are wired). The Traversal may be accessed earlier, depending on the type of the builder and certain conditions. SeeCompositeTraversalBuilder
andLinearTraversalBuilder
, also comments in akka.stream.impl.package for more details.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TraversalBuilder
add(TraversalBuilder submodule, Shape shape, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> combineMat)
Adds a module to the builder.TraversalBuilder
assign(OutPort out, int relativeSlot)
Finish the wiring of an output port to an input port by assigning the relative slot for the output port.Attributes
attributes()
int
inSlots()
The total number of input ports encountered so far.TraversalBuilder
internalSetAttributes(Attributes attributes)
boolean
isTraversalComplete()
Returns true if the Traversal is available.boolean
isUnwired(InPort in)
Returns whether the given input port has been wired in the graph or not.boolean
isUnwired(OutPort out)
Returns whether the given output port has been wired in the graph or not.TraversalBuilder
makeIsland(IslandTag islandTag)
Wraps the builder in an island that can be materialized differently, using async boundaries to bridge between islands.int
offsetOf(InPort in)
Returns the number assigned to a certain input port *relative* to this module.int
offsetOfModule(OutPort out)
Returns the base offset (the first number an input port would receive if there is any) of the module to which the port belongs *relative to this builder*.TraversalBuilder
setAttributes(Attributes attributes)
TraversalBuilder
transformMat(scala.Function1<scala.runtime.Nothing$,java.lang.Object> f)
Maps the materialized value produced by the module built-up so far with the provided function, providing a new TraversalBuilder returning the mapped materialized value.Traversal
traversal()
Returns the Traversal if ready for this (sub)graph.int
unwiredOuts()
The number of output ports that have not been wired.TraversalBuilder
wire(OutPort out, InPort in)
Connects two unwired ports in the graph.
-
-
-
Method Detail
-
add
TraversalBuilder add(TraversalBuilder submodule, Shape shape, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> combineMat)
Adds a module to the builder. It is possible to add a module with a different Shape (import), in this case the ports of the shape MUST have theirmappedTo
field pointing to the original ports. The act of being imported will not be reflected in the final Traversal, the Shape is only used by the builder to disambiguate between multiple imported instances of the same module.See append in the
LinearTraversalBuilder
for a more efficient alternative for linear graphs.
-
transformMat
TraversalBuilder transformMat(scala.Function1<scala.runtime.Nothing$,java.lang.Object> f)
Maps the materialized value produced by the module built-up so far with the provided function, providing a new TraversalBuilder returning the mapped materialized value.
-
internalSetAttributes
TraversalBuilder internalSetAttributes(Attributes attributes)
-
setAttributes
TraversalBuilder setAttributes(Attributes attributes)
-
attributes
Attributes attributes()
-
wire
TraversalBuilder wire(OutPort out, InPort in)
Connects two unwired ports in the graph. For imported modules, use the ports of their "import shape". These ports must have theirmappedTo
field set and point to the original ports.See append in the
LinearTraversalBuilder
for a more efficient alternative for linear graphs.
-
offsetOfModule
int offsetOfModule(OutPort out)
Returns the base offset (the first number an input port would receive if there is any) of the module to which the port belongs *relative to this builder*. This is used to calculate the relative offset of output port mappings (seeMaterializeAtomic
).This method only guarantees to return the offset of modules for output ports that have not been wired.
-
isUnwired
boolean isUnwired(OutPort out)
Returns whether the given output port has been wired in the graph or not.
-
isUnwired
boolean isUnwired(InPort in)
Returns whether the given input port has been wired in the graph or not.
-
offsetOf
int offsetOf(InPort in)
Returns the number assigned to a certain input port *relative* to this module.This method only guarantees to return the offset of input ports that have not been wired.
-
assign
TraversalBuilder assign(OutPort out, int relativeSlot)
Finish the wiring of an output port to an input port by assigning the relative slot for the output port.(see
MaterializeAtomic
for details of the resolution process)
-
isTraversalComplete
boolean isTraversalComplete()
Returns true if the Traversal is available. Not all builders are able to build up the Traversal incrementally. Generally a traversal is complete if there are no unwired output ports.
-
inSlots
int inSlots()
The total number of input ports encountered so far. Gives the first slot to which a new input port can be assigned (if a new module is added).
-
traversal
Traversal traversal()
Returns the Traversal if ready for this (sub)graph.
-
unwiredOuts
int unwiredOuts()
The number of output ports that have not been wired.
-
makeIsland
TraversalBuilder makeIsland(IslandTag islandTag)
Wraps the builder in an island that can be materialized differently, using async boundaries to bridge between islands.
-
-