Interface TraversalBuilder

  • All Known Implementing Classes:
    AtomicTraversalBuilder, CompletedTraversalBuilder, CompositeTraversalBuilder, LinearTraversalBuilder

    public interface TraversalBuilder
    INTERNAL API

    A 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. See CompositeTraversalBuilder and LinearTraversalBuilder, also comments in akka.stream.impl.package for more details.

    • 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 their mappedTo 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.

        Parameters:
        submodule - (undocumented)
        shape - (undocumented)
        combineMat - (undocumented)
        Returns:
        (undocumented)
      • 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.
        Parameters:
        f - (undocumented)
        Returns:
        (undocumented)
      • 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 their mappedTo field set and point to the original ports.

        See append in the LinearTraversalBuilder for a more efficient alternative for linear graphs.

        Parameters:
        out - (undocumented)
        in - (undocumented)
        Returns:
        (undocumented)
      • 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 (see MaterializeAtomic).

        This method only guarantees to return the offset of modules for output ports that have not been wired.

        Parameters:
        out - (undocumented)
        Returns:
        (undocumented)
      • isUnwired

        boolean isUnwired​(OutPort out)
        Returns whether the given output port has been wired in the graph or not.
        Parameters:
        out - (undocumented)
        Returns:
        (undocumented)
      • isUnwired

        boolean isUnwired​(InPort in)
        Returns whether the given input port has been wired in the graph or not.
        Parameters:
        in - (undocumented)
        Returns:
        (undocumented)
      • 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.

        Parameters:
        in - (undocumented)
        Returns:
        (undocumented)
      • 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)

        Parameters:
        out - (undocumented)
        relativeSlot - (undocumented)
        Returns:
        (undocumented)
      • 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.
        Returns:
        (undocumented)
      • 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).
        Returns:
        (undocumented)
      • traversal

        Traversal traversal()
        Returns the Traversal if ready for this (sub)graph.
        Returns:
        (undocumented)
      • unwiredOuts

        int unwiredOuts()
        The number of output ports that have not been wired.
        Returns:
        (undocumented)
      • makeIsland

        TraversalBuilder makeIsland​(IslandTag islandTag)
        Wraps the builder in an island that can be materialized differently, using async boundaries to bridge between islands.
        Parameters:
        islandTag - (undocumented)
        Returns:
        (undocumented)