Class LinearTraversalBuilder

  • All Implemented Interfaces:
    TraversalBuilder, java.io.Serializable, scala.Equals, scala.Product

    public final class LinearTraversalBuilder
    extends java.lang.Object
    implements TraversalBuilder, scala.Product, java.io.Serializable
    See Also:
    Serialized Form
    • Method Detail

      • $lessinit$greater$default$8

        public static Traversal $lessinit$greater$default$8()
        INTERNAL API

        Traversal builder that is optimized for linear graphs (those that contain modules with at most one input and at most one output port). The Traversal is simply built up in reverse order and output ports are automatically assigned to -1 due to the nature of the graph. The only exception is when composites created by CompositeTraversalBuilder are embedded. These are not guaranteed to have their unwired input/output ports in a fixed location, therefore the last step of the Traversal might need to be changed in those cases from the -1 relative offset to something else (see rewireLastOutTo). See comments in akka.stream.impl.package for more details.

      • $lessinit$greater$default$9

        public static OptionVal<IslandTag> $lessinit$greater$default$9()
      • empty$default$1

        public static Attributes empty$default$1()
      • fromModule

        public static LinearTraversalBuilder fromModule​(StreamLayout.AtomicModule<Shape,​java.lang.Object> module,
                                                        Attributes attributes)
        Create a traversal builder specialized for linear graphs. This is designed to be much faster and lightweight than its generic counterpart. It can be freely mixed with the generic builder in both ways.
      • addMatCompose

        public static Traversal addMatCompose​(Traversal t,
                                              scala.Function2<scala.runtime.Nothing$,​scala.runtime.Nothing$,​java.lang.Object> matCompose)
      • fromBuilder$default$3

        public static scala.Function2<scala.runtime.Nothing$,​scala.runtime.Nothing$,​java.lang.Object> fromBuilder$default$3()
      • apply

        public static LinearTraversalBuilder apply​(OptionVal<InPort> inPort,
                                                   OptionVal<OutPort> outPort,
                                                   int inOffset,
                                                   int inSlots,
                                                   Traversal traversalSoFar,
                                                   OptionVal<TraversalBuilder> pendingBuilder,
                                                   Attributes attributes,
                                                   Traversal beforeBuilder,
                                                   OptionVal<IslandTag> islandTag)
        INTERNAL API

        Traversal builder that is optimized for linear graphs (those that contain modules with at most one input and at most one output port). The Traversal is simply built up in reverse order and output ports are automatically assigned to -1 due to the nature of the graph. The only exception is when composites created by CompositeTraversalBuilder are embedded. These are not guaranteed to have their unwired input/output ports in a fixed location, therefore the last step of the Traversal might need to be changed in those cases from the -1 relative offset to something else (see rewireLastOutTo). See comments in akka.stream.impl.package for more details.

      • apply$default$8

        public static Traversal apply$default$8()
      • inOffset

        public int inOffset()
      • inSlots

        public int inSlots()
        Description copied from interface: TraversalBuilder
        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).
        Specified by:
        inSlots in interface TraversalBuilder
      • traversalSoFar

        public Traversal traversalSoFar()
      • beforeBuilder

        public Traversal beforeBuilder()
      • isEmpty

        protected boolean isEmpty()
      • add

        public TraversalBuilder add​(TraversalBuilder submodule,
                                    Shape shape,
                                    scala.Function2<scala.runtime.Nothing$,​scala.runtime.Nothing$,​java.lang.Object> combineMat)
        Description copied from interface: TraversalBuilder
        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.

        Specified by:
        add in interface TraversalBuilder
      • wire

        public TraversalBuilder wire​(OutPort out,
                                     InPort in)
        Since this is a linear traversal, this should not be called in most of the cases. The only notable exception is when a Flow is wired to itself.
        Specified by:
        wire in interface TraversalBuilder
      • offsetOfModule

        public int offsetOfModule​(OutPort out)
        Description copied from interface: TraversalBuilder
        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.

        Specified by:
        offsetOfModule in interface TraversalBuilder
      • isUnwired

        public boolean isUnwired​(InPort in)
        Description copied from interface: TraversalBuilder
        Returns whether the given input port has been wired in the graph or not.
        Specified by:
        isUnwired in interface TraversalBuilder
      • offsetOf

        public int offsetOf​(InPort in)
        Description copied from interface: TraversalBuilder
        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.

        Specified by:
        offsetOf in interface TraversalBuilder
      • isTraversalComplete

        public boolean isTraversalComplete()
        Description copied from interface: TraversalBuilder
        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.
        Specified by:
        isTraversalComplete in interface TraversalBuilder
      • append

        public LinearTraversalBuilder append​(LinearTraversalBuilder toAppend,
                                             scala.Function2<scala.runtime.Nothing$,​scala.runtime.Nothing$,​java.lang.Object> matCompose)
        Append any builder that is linear shaped (have at most one input and at most one output port) to the end of this graph, connecting the output of the last module to the input of the appended module.
      • transformMat

        public LinearTraversalBuilder transformMat​(scala.Function1<scala.runtime.Nothing$,​java.lang.Object> f)
        Description copied from interface: TraversalBuilder
        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.
        Specified by:
        transformMat in interface TraversalBuilder
      • copy$default$3

        public int copy$default$3()
      • copy$default$4

        public int copy$default$4()
      • copy$default$5

        public Traversal copy$default$5()
      • copy$default$7

        public Attributes copy$default$7()
      • copy$default$8

        public Traversal copy$default$8()
      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • productElementName

        public java.lang.String productElementName​(int x$1)
        Specified by:
        productElementName in interface scala.Product
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object x$1)
        Specified by:
        equals in interface scala.Equals
        Overrides:
        equals in class java.lang.Object