SPeCS Packages Documentation
    Preparing search index...

    The class with functionality for the base edge type.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Accessors

    • get codirectedEdges(): EdgeCollection<this, D, S>

      Returns EdgeCollection<this, D, S>

      The edges that connect the same nodes as this edge. Direction is taken into account.

    • get data(): D

      Use the data object for JSON serializable data. For temporary or non-serializable data, use BaseEdge.Class.scratchData.

      Returns D

      the data object associated with this edge.

    • get graph(): BaseGraph.Class

      Returns BaseGraph.Class

      the graph that this edge is a part of.

    • get id(): string

      Returns string

      the unique identifier of this edge.

    • get isFake(): boolean

      Returns boolean

      Whether this edge is ControlFlowEdge.Data.isFake | fake.

    • set isFake(value: boolean): void

      Sets whether this edge is ControlFlowEdge.Data.isFake | fake.

      Parameters

      • value: boolean

        Whether this edge is fake.

      Returns void

    • get isLoop(): boolean

      Returns boolean

      whether this edge is a loop (source and target are the same node).

    • get isRemoved(): boolean

      Returns boolean

      whether this edge has been removed from the graph.

    • get parallelEdges(): EdgeCollection<this, D, S>

      Returns EdgeCollection<this, D, S>

      The edges that connect the same nodes as this edge. Direction is not taken into account.

    • get scratchData(): S

      Use the scratch data object for temporary or non-serializable data. For JSON serializable data, use BaseEdge.Class.data.

      The scratch data is stored under the Graph.scratchNamespace | @specs-feup/flow namespace.

      Returns S

      the scratch data object associated with this edge.

    • get source(): BaseNode.Class

      Returns BaseNode.Class

      the source node of this edge.

    • set source(node: BaseNode.Class): void

      Changes the source node of this edge.

      Parameters

      Returns void

    • get target(): BaseNode.Class

      Returns BaseNode.Class

      the target node of this edge.

    • set target(node: BaseNode.Class): void

      Changes the target node of this edge.

      Parameters

      Returns void

    Methods

    • Changes the functionality class of the current edge. This is only possible if the data and scratch data are compatible with the new class. To assert that, use BaseEdge.Class.is.

      Type Parameters

      Parameters

      • EdgeType: { Class: Edge.Class<D, S, E> }

        The edge type to change the functionality class into.

      Returns E

      The same edge, wrapped in the new functionality class.

    • Changes the functionality class of the current edge. Should only be used when it is known (but not statically provable) that the edge is compatible with the new class. If not, an error will be thrown.

      It is bad practice to try and catch the error thrown by this function. For such cases, combine BaseEdge.Class.is with BaseEdge.Class.as, or use BaseEdge.Class.switch instead.

      Type Parameters

      Parameters

      • EdgeType: Edge<D2, S2, E2>

        The edge type to change the functionality class into.

      • Optionalmessage: string

        The message to throw if the edge is not compatible with the type.

      Returns E2

      The edge, wrapped in the new functionality class.

      LaraFlowError if the edge is not compatible with the type. This error should be seen as a logic error and not catched.

    • Initializes the edge with the information of a builder. This is effectively extends the type of the edge to include the data and scratch data of the builder.

      The same edge may simultaneously be of multiple types, as long as the data and scratch data are compatible with the types. The builder methods may overwrite data and scratch data fields with names that collide with its type's fields.

      Type Parameters

      Parameters

      Returns BaseEdge.Class<D2, S2>

      The same edge, with the data and scratch data of the builder. The edge is downcasted to BaseEdge.Class because the builder may overwrite the data and scratch data fields, invalidating the current type.

    • Removes this edge from the graph.

      Returns void

    • Restores this edge if it has been removed. See BaseEdge.Class.remove.

      Returns void

    • Checks if the type of the edge is compatible with several types, calling a callback for the first match. See Edge.Case for the syntax of each case.

      For a default case, match with BaseEdge, which will always be compatible with any edge type.

      Parameters

      • ...cases: { callback: (g: any) => void; EdgeType: Edge<any, any, any> }[]

        The cases to match against.

      Returns void

    • Returns EdgeSingular

      the underlying cytoscape edge object.

    • Tries to change the functionality class of the current edge. If the edge is not compatible with the new class, undefined is returned.

      Type Parameters

      Parameters

      • EdgeType: Edge<D2, S2, E2>

        The edge type to change the functionality class into.

      Returns E2 | undefined

      The edge, wrapped in the new functionality class, or undefined if the edge is not compatible with the type.