Module org.praxislive.project
Package org.praxislive.project
Class GraphBuilder.Base<B extends GraphBuilder.Base<B>>
java.lang.Object
org.praxislive.project.GraphBuilder.Base<B>
- Type Parameters:
B- builder type
- Direct Known Subclasses:
GraphBuilder.Component,GraphBuilder.Root
- Enclosing class:
GraphBuilder
public abstract static sealed class GraphBuilder.Base<B extends GraphBuilder.Base<B>>
extends Object
permits GraphBuilder.Component, GraphBuilder.Root
Abstract base class of component and root element builders.
-
Method Summary
Modifier and TypeMethodDescriptionchild(String id, org.praxislive.core.ComponentType type, Consumer<GraphBuilder.Component> constructor) Add a child of the given type, configured by the passed in builder consumer.child(String id, GraphElement.Component child) Add a child component element.children()Immutable snapshot of children.Clear the existing children.Clear the existing comments.Clear the existing connections.Clear the existing properties.Add a comment element.comment(GraphElement.Comment comment) Add a comment element.comments()Immutable snapshot of comments.connection(String sourceComponent, String sourcePort, String targetComponent, String targetPort) Add a connection element.connection(GraphElement.Connection connection) Add a connection element.Immutable snapshot of connections.Immutable snapshot of properties.Add a property element.property(String id, GraphElement.Property property) Add a property element.transformChildren(Function<Stream<Map.Entry<String, GraphElement.Component>>, List<Map.Entry<String, GraphElement.Component>>> transform) Transform the existing children.transformComments(Function<Stream<GraphElement.Comment>, List<GraphElement.Comment>> transform) Transform the existing comments.transformConnections(Function<Stream<GraphElement.Connection>, List<GraphElement.Connection>> transform) Transform the existing connections.transformProperties(Function<Stream<Map.Entry<String, GraphElement.Property>>, List<Map.Entry<String, GraphElement.Property>>> transform) Transform the existing properties.org.praxislive.core.ComponentTypetype()Component type.
-
Method Details
-
child
Add a child component element.- Parameters:
id- child IDchild- child element- Returns:
- this
-
child
public B child(String id, org.praxislive.core.ComponentType type, Consumer<GraphBuilder.Component> constructor) Add a child of the given type, configured by the passed in builder consumer.- Parameters:
id- child IDtype- child component typeconstructor- builder consumer to configure the component- Returns:
- this
-
comment
Add a comment element.- Parameters:
text- comment text- Returns:
- this
-
comment
Add a comment element.- Parameters:
comment- comment element- Returns:
- this
-
connection
public B connection(String sourceComponent, String sourcePort, String targetComponent, String targetPort) Add a connection element.- Parameters:
sourceComponent- source component IDsourcePort- source port IDtargetComponent- target component IDtargetPort- target port ID- Returns:
- this
-
connection
Add a connection element.- Parameters:
connection- connection element- Returns:
- this
-
property
Add a property element.- Parameters:
id- property IDvalue- property value- Returns:
- this
-
property
Add a property element.- Parameters:
id- property IDproperty- property element- Returns:
- this
-
clearChildren
Clear the existing children.- Returns:
- this
-
clearComments
Clear the existing comments.- Returns:
- this
-
clearConnections
Clear the existing connections.- Returns:
- this
-
clearProperties
Clear the existing properties.- Returns:
- this
-
transformChildren
public B transformChildren(Function<Stream<Map.Entry<String, GraphElement.Component>>, List<Map.Entry<String, GraphElement.Component>>> transform) Transform the existing children. The transform function is called with a stream of the existing child map entries, and should return a list of desired child elements. The returned list will be used to replace the existing children. The map entries in the stream are immutable, but the component elements may be reused.- Parameters:
transform- children transform function- Returns:
- this
-
transformComments
public B transformComments(Function<Stream<GraphElement.Comment>, List<GraphElement.Comment>> transform) Transform the existing comments. The transform function is called with a stream of the existing comment elements, and should return a list of desired comment elements. The returned list will be used to replace the existing comments.- Parameters:
transform- comment transform function- Returns:
- this
-
transformConnections
public B transformConnections(Function<Stream<GraphElement.Connection>, List<GraphElement.Connection>> transform) Transform the existing connections. The transform function is called with a stream of the existing connection elements, and should return a list of desired connection elements. The returned list will be used to replace the existing connections.- Parameters:
transform- connection transform function- Returns:
- this
-
transformProperties
public B transformProperties(Function<Stream<Map.Entry<String, GraphElement.Property>>, List<Map.Entry<String, GraphElement.Property>>> transform) Transform the existing properties. The transform function is called with a stream of the existing property map entries, and should return a list of desired property elements. The returned list will be used to replace the existing properties. The map entries in the stream are immutable, but the property elements may be reused.- Parameters:
transform- property transform function- Returns:
- this
-
type
public org.praxislive.core.ComponentType type()Component type.- Returns:
- type
-
comments
Immutable snapshot of comments.- Returns:
- comments
-
properties
Immutable snapshot of properties.- Returns:
- properties
-
children
Immutable snapshot of children.- Returns:
- children
-
connections
Immutable snapshot of connections.- Returns:
- connections
-