This DataflowGraphBuilder extends DataflowGraph with builder methods to easily and compactly add vertices and edges to a dataflow graph. Its usage thus simplifies writing tests for dataflow graphs.

Hierarchy (view full)

Hierarchy-Diagram

UML class diagram of DataflowGraphBuilder

Constructors

Properties

rootVertices: Set<NodeId> = ...

Contains the vertices of the root level graph (i.e., included those vertices from the complete graph, that are nested within function definitions)

Accessors

Methods

  • Adds a new vertex to the graph, for ease of use, some arguments are optional and filled automatically.

    Parameters

    • vertex: DataflowGraphVertexArgument & Omit<DataflowGraphVertexInfo, string | number>

      The vertex to add

    • asRoot: boolean = true

      If false, this will only add the vertex but do not add it to the rootIds|root vertices of the graph. This is probably only of use, when you construct dataflow graphs for tests.

    Returns this

    • DataflowGraphVertexInfo
    • DataflowGraphVertexArgument
  • Returns true if the graph contains a node with the given id.

    Parameters

    • id: NodeId

      The id to check for

    • includeDefinedFunctions: boolean = true

      If true this will check function definitions as well and not just the toplevel

    Returns boolean

  • Merges the other graph into this one (in-place). The return value is only for convenience.

    Parameters

    • otherGraph: undefined | DataflowGraph<DataflowGraphVertexInfo, DataflowGraphEdge>

      The graph to merge into this one

    • mergeRootVertices: boolean = true

      If false, this will only merge the vertices and edges but exclude the root vertices this is probably only of use in the context of function definitions

    Returns this

  • Adds a vertex for variable use (V5). Intended for creating dataflow graphs as part of function tests.

    Parameters

    • id: NodeId

      AST node id

    • Optionalname: string

      Variable name

    • Optionalinfo: Partial<DataflowGraphVertexUse>

      Additional/optional properties; i.e., scope, when, or environment.

    • asRoot: boolean = true

      should the vertex be part of the root vertex set of the graph (i.e., be a valid entry point) or is it nested (e.g., as part of a function definition)

    Returns DataflowGraphBuilder