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 Details

    • child

      public B child(String id, GraphElement.Component child)
      Add a child component element.
      Parameters:
      id - child ID
      child - 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 ID
      type - child component type
      constructor - builder consumer to configure the component
      Returns:
      this
    • comment

      public B comment(String text)
      Add a comment element.
      Parameters:
      text - comment text
      Returns:
      this
    • comment

      public B comment(GraphElement.Comment 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 ID
      sourcePort - source port ID
      targetComponent - target component ID
      targetPort - target port ID
      Returns:
      this
    • connection

      public B connection(GraphElement.Connection connection)
      Add a connection element.
      Parameters:
      connection - connection element
      Returns:
      this
    • property

      public B property(String id, org.praxislive.core.Value value)
      Add a property element.
      Parameters:
      id - property ID
      value - property value
      Returns:
      this
    • property

      public B property(String id, GraphElement.Property property)
      Add a property element.
      Parameters:
      id - property ID
      property - property element
      Returns:
      this
    • clearChildren

      public B clearChildren()
      Clear the existing children.
      Returns:
      this
    • clearComments

      public B clearComments()
      Clear the existing comments.
      Returns:
      this
    • clearConnections

      public B clearConnections()
      Clear the existing connections.
      Returns:
      this
    • clearProperties

      public B clearProperties()
      Clear the existing properties.
      Returns:
      this
    • transformChildren

      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

      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

      public List<GraphElement.Comment> comments()
      Immutable snapshot of comments.
      Returns:
      comments
    • properties

      Immutable snapshot of properties.
      Returns:
      properties
    • children

      Immutable snapshot of children.
      Returns:
      children
    • connections

      public SequencedSet<GraphElement.Connection> connections()
      Immutable snapshot of connections.
      Returns:
      connections