Class LinearTraversalBuilder
- java.lang.Object
-
- akka.stream.impl.LinearTraversalBuilder
-
- All Implemented Interfaces:
TraversalBuilder,java.io.Serializable,scala.Equals,scala.Product,scala.Serializable
public final class LinearTraversalBuilder extends java.lang.Object implements TraversalBuilder, scala.Product, scala.Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LinearTraversalBuilder(OptionVal<InPort> inPort, OptionVal<OutPort> outPort, int inOffset, int inSlots, Traversal traversalSoFar, OptionVal<TraversalBuilder> pendingBuilder, Attributes attributes, Traversal beforeBuilder, OptionVal<IslandTag> islandTag)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Traversal$lessinit$greater$default$8()INTERNAL APIstatic OptionVal<IslandTag>$lessinit$greater$default$9()TraversalBuilderadd(TraversalBuilder submodule, Shape shape, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> combineMat)Adds a module to the builder.static TraversaladdMatCompose(Traversal t, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> matCompose)LinearTraversalBuilderappend(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.LinearTraversalBuilderappend(TraversalBuilder toAppend, Shape shape, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> matCompose)static LinearTraversalBuilderapply(OptionVal<InPort> inPort, OptionVal<OutPort> outPort, int inOffset, int inSlots, Traversal traversalSoFar, OptionVal<TraversalBuilder> pendingBuilder, Attributes attributes, Traversal beforeBuilder, OptionVal<IslandTag> islandTag)INTERNAL APIstatic Traversalapply$default$8()static OptionVal<IslandTag>apply$default$9()TraversalBuilderassign(OutPort out, int relativeSlot)Finish the wiring of an output port to an input port by assigning the relative slot for the output port.Attributesattributes()TraversalbeforeBuilder()booleancanEqual(java.lang.Object x$1)LinearTraversalBuildercopy(OptionVal<InPort> inPort, OptionVal<OutPort> outPort, int inOffset, int inSlots, Traversal traversalSoFar, OptionVal<TraversalBuilder> pendingBuilder, Attributes attributes, Traversal beforeBuilder, OptionVal<IslandTag> islandTag)OptionVal<InPort>copy$default$1()OptionVal<OutPort>copy$default$2()intcopy$default$3()intcopy$default$4()Traversalcopy$default$5()OptionVal<TraversalBuilder>copy$default$6()Attributescopy$default$7()Traversalcopy$default$8()OptionVal<IslandTag>copy$default$9()static LinearTraversalBuilderempty(Attributes attributes)static Attributesempty$default$1()booleanequals(java.lang.Object x$1)static LinearTraversalBuilderfromBuilder(TraversalBuilder traversalBuilder, Shape shape, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> combine)static scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object>fromBuilder$default$3()static LinearTraversalBuilderfromModule(StreamLayout.AtomicModule<Shape,java.lang.Object> module, Attributes attributes)Create a traversal builder specialized for linear graphs.inthashCode()intinOffset()OptionVal<InPort>inPort()intinSlots()The total number of input ports encountered so far.LinearTraversalBuilderinternalSetAttributes(Attributes attributes)protected booleanisEmpty()OptionVal<IslandTag>islandTag()booleanisTraversalComplete()Returns true if the Traversal is available.booleanisUnwired(InPort in)Returns whether the given input port has been wired in the graph or not.booleanisUnwired(OutPort out)Returns whether the given output port has been wired in the graph or not.LinearTraversalBuildermakeIsland(IslandTag islandTag)Wraps the builder in an island that can be materialized differently, using async boundaries to bridge between islands.intoffsetOf(InPort in)Returns the number assigned to a certain input port *relative* to this module.intoffsetOfModule(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*.OptionVal<OutPort>outPort()OptionVal<TraversalBuilder>pendingBuilder()intproductArity()java.lang.ObjectproductElement(int x$1)scala.collection.Iterator<java.lang.Object>productIterator()java.lang.StringproductPrefix()LinearTraversalBuildersetAttributes(Attributes attributes)java.lang.StringtoString()LinearTraversalBuildertransformMat(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.Traversaltraversal()This builder can always return a traversal.TraversaltraversalSoFar()static scala.Option<scala.Tuple9<OptionVal<InPort>,OptionVal<OutPort>,java.lang.Object,java.lang.Object,Traversal,OptionVal<TraversalBuilder>,Attributes,Traversal,OptionVal<IslandTag>>>unapply(LinearTraversalBuilder x$0)intunwiredOuts()The number of output ports that have not been wired.TraversalBuilderwire(OutPort out, InPort in)Since this is a linear traversal, this should not be called in most of the cases.
-
-
-
Method Detail
-
$lessinit$greater$default$8
public static Traversal $lessinit$greater$default$8()
INTERNAL APITraversal 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
CompositeTraversalBuilderare 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.- Returns:
- (undocumented)
-
empty
public static LinearTraversalBuilder empty(Attributes attributes)
-
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.- Parameters:
module- (undocumented)attributes- (undocumented)- Returns:
- (undocumented)
-
addMatCompose
public static Traversal addMatCompose(Traversal t, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> matCompose)
-
fromBuilder
public static LinearTraversalBuilder fromBuilder(TraversalBuilder traversalBuilder, Shape shape, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> combine)
-
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 APITraversal 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
CompositeTraversalBuilderare 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.- Parameters:
inPort- (undocumented)outPort- (undocumented)inOffset- (undocumented)inSlots- (undocumented)traversalSoFar- (undocumented)pendingBuilder- (undocumented)attributes- (undocumented)beforeBuilder- (undocumented)islandTag- (undocumented)- Returns:
- (undocumented)
-
apply$default$8
public static Traversal apply$default$8()
-
unapply
public static scala.Option<scala.Tuple9<OptionVal<InPort>,OptionVal<OutPort>,java.lang.Object,java.lang.Object,Traversal,OptionVal<TraversalBuilder>,Attributes,Traversal,OptionVal<IslandTag>>> unapply(LinearTraversalBuilder x$0)
-
inOffset
public int inOffset()
-
inSlots
public int inSlots()
Description copied from interface:TraversalBuilderThe 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:
inSlotsin interfaceTraversalBuilder- Returns:
- (undocumented)
-
traversalSoFar
public Traversal traversalSoFar()
-
pendingBuilder
public OptionVal<TraversalBuilder> pendingBuilder()
-
attributes
public Attributes attributes()
- Specified by:
attributesin interfaceTraversalBuilder
-
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:TraversalBuilderAdds 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 theirmappedTofield 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
LinearTraversalBuilderfor a more efficient alternative for linear graphs.- Specified by:
addin interfaceTraversalBuilder- Parameters:
submodule- (undocumented)shape- (undocumented)combineMat- (undocumented)- Returns:
- (undocumented)
-
traversal
public Traversal traversal()
This builder can always return a traversal.- Specified by:
traversalin interfaceTraversalBuilder- Returns:
- (undocumented)
-
internalSetAttributes
public LinearTraversalBuilder internalSetAttributes(Attributes attributes)
- Specified by:
internalSetAttributesin interfaceTraversalBuilder
-
setAttributes
public LinearTraversalBuilder setAttributes(Attributes attributes)
- Specified by:
setAttributesin interfaceTraversalBuilder
-
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:
wirein interfaceTraversalBuilder- Parameters:
out- (undocumented)in- (undocumented)- Returns:
- (undocumented)
-
offsetOfModule
public int offsetOfModule(OutPort out)
Description copied from interface:TraversalBuilderReturns 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.
- Specified by:
offsetOfModulein interfaceTraversalBuilder- Parameters:
out- (undocumented)- Returns:
- (undocumented)
-
isUnwired
public boolean isUnwired(OutPort out)
Description copied from interface:TraversalBuilderReturns whether the given output port has been wired in the graph or not.- Specified by:
isUnwiredin interfaceTraversalBuilder- Parameters:
out- (undocumented)- Returns:
- (undocumented)
-
isUnwired
public boolean isUnwired(InPort in)
Description copied from interface:TraversalBuilderReturns whether the given input port has been wired in the graph or not.- Specified by:
isUnwiredin interfaceTraversalBuilder- Parameters:
in- (undocumented)- Returns:
- (undocumented)
-
offsetOf
public int offsetOf(InPort in)
Description copied from interface:TraversalBuilderReturns 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:
offsetOfin interfaceTraversalBuilder- Parameters:
in- (undocumented)- Returns:
- (undocumented)
-
assign
public TraversalBuilder assign(OutPort out, int relativeSlot)
Description copied from interface:TraversalBuilderFinish the wiring of an output port to an input port by assigning the relative slot for the output port.(see
MaterializeAtomicfor details of the resolution process)- Specified by:
assignin interfaceTraversalBuilder- Parameters:
out- (undocumented)relativeSlot- (undocumented)- Returns:
- (undocumented)
-
isTraversalComplete
public boolean isTraversalComplete()
Description copied from interface:TraversalBuilderReturns 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:
isTraversalCompletein interfaceTraversalBuilder- Returns:
- (undocumented)
-
unwiredOuts
public int unwiredOuts()
Description copied from interface:TraversalBuilderThe number of output ports that have not been wired.- Specified by:
unwiredOutsin interfaceTraversalBuilder- Returns:
- (undocumented)
-
append
public LinearTraversalBuilder append(TraversalBuilder toAppend, Shape shape, scala.Function2<scala.runtime.Nothing$,scala.runtime.Nothing$,java.lang.Object> matCompose)
-
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.- Parameters:
toAppend- (undocumented)matCompose- (undocumented)- Returns:
- (undocumented)
-
transformMat
public LinearTraversalBuilder transformMat(scala.Function1<scala.runtime.Nothing$,java.lang.Object> f)
Description copied from interface:TraversalBuilderMaps 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:
transformMatin interfaceTraversalBuilder- Parameters:
f- (undocumented)- Returns:
- (undocumented)
-
makeIsland
public LinearTraversalBuilder makeIsland(IslandTag islandTag)
Wraps the builder in an island that can be materialized differently, using async boundaries to bridge between islands.- Specified by:
makeIslandin interfaceTraversalBuilder- Parameters:
islandTag- (undocumented)- Returns:
- (undocumented)
-
copy
public LinearTraversalBuilder copy(OptionVal<InPort> inPort, OptionVal<OutPort> outPort, int inOffset, int inSlots, Traversal traversalSoFar, OptionVal<TraversalBuilder> pendingBuilder, Attributes attributes, Traversal beforeBuilder, OptionVal<IslandTag> islandTag)
-
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$6
public OptionVal<TraversalBuilder> copy$default$6()
-
copy$default$7
public Attributes copy$default$7()
-
copy$default$8
public Traversal copy$default$8()
-
productPrefix
public java.lang.String productPrefix()
- Specified by:
productPrefixin interfacescala.Product
-
productArity
public int productArity()
- Specified by:
productArityin interfacescala.Product
-
productElement
public java.lang.Object productElement(int x$1)
- Specified by:
productElementin interfacescala.Product
-
productIterator
public scala.collection.Iterator<java.lang.Object> productIterator()
- Specified by:
productIteratorin interfacescala.Product
-
canEqual
public boolean canEqual(java.lang.Object x$1)
- Specified by:
canEqualin interfacescala.Equals
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object x$1)
- Specified by:
equalsin interfacescala.Equals- Overrides:
equalsin classjava.lang.Object
-
-