Table of Contents

Class AdjacencyCollection<TInstruction>

Namespace
Echo.ControlFlow.Collections
Assembly
Echo.ControlFlow.dll

Represents a collection of edges originating from a single node.

public class AdjacencyCollection<TInstruction> : ICollection<ControlFlowEdge<TInstruction>>, IEnumerable<ControlFlowEdge<TInstruction>>, IEnumerable where TInstruction : notnull

Type Parameters

TInstruction

The type of data that each node stores.

Inheritance
AdjacencyCollection<TInstruction>
Implements
Inherited Members

Properties

Count

public int Count { get; }

Property Value

int

EdgeType

Gets the type of edges that are stored in this collection.

public ControlFlowEdgeType EdgeType { get; }

Property Value

ControlFlowEdgeType

IsReadOnly

public bool IsReadOnly { get; }

Property Value

bool

Owner

Gets the node that all edges are originating from.

public ControlFlowNode<TInstruction> Owner { get; }

Property Value

ControlFlowNode<TInstruction>

Methods

Add(ControlFlowEdge<TInstruction>)

Adds an edge to the adjacency collection.

public ControlFlowEdge<TInstruction> Add(ControlFlowEdge<TInstruction> edge)

Parameters

edge ControlFlowEdge<TInstruction>

The edge to add.

Returns

ControlFlowEdge<TInstruction>

The edge that was added.

Exceptions

ArgumentException

Occurs when the provided edge cannot be added to this collection because of an invalid source node or edge type.

Add(ControlFlowNode<TInstruction>)

Creates and adds a edge to the provided node.

public ControlFlowEdge<TInstruction> Add(ControlFlowNode<TInstruction> neighbour)

Parameters

neighbour ControlFlowNode<TInstruction>

The new neighbouring node.

Returns

ControlFlowEdge<TInstruction>

The created edge.

Clear()

public void Clear()

Contains(ControlFlowEdge<TInstruction>)

public bool Contains(ControlFlowEdge<TInstruction> item)

Parameters

item ControlFlowEdge<TInstruction>

Returns

bool

Contains(ControlFlowNode<TInstruction>)

Determines whether a node is a neighbour of the current node. That is, determines whether there exists at least one edge between the current node and the provided node.

public bool Contains(ControlFlowNode<TInstruction> neighbour)

Parameters

neighbour ControlFlowNode<TInstruction>

The node to check.

Returns

bool

True if the provided node is a neighbour, false otherwise.

CopyTo(ControlFlowEdge<TInstruction>[], int)

public void CopyTo(ControlFlowEdge<TInstruction>[] array, int arrayIndex)

Parameters

array ControlFlowEdge<TInstruction>[]
arrayIndex int

GetEdgesToNeighbour(ControlFlowNode<TInstruction>)

Obtains all edges to the provided neighbour, if any.

public IEnumerable<ControlFlowEdge<TInstruction>> GetEdgesToNeighbour(ControlFlowNode<TInstruction> target)

Parameters

target ControlFlowNode<TInstruction>

The neighbouring node.

Returns

IEnumerable<ControlFlowEdge<TInstruction>>

The edges.

GetEnumerator()

public IEnumerator<ControlFlowEdge<TInstruction>> GetEnumerator()

Returns

IEnumerator<ControlFlowEdge<TInstruction>>

Remove(ControlFlowEdge<TInstruction>)

public bool Remove(ControlFlowEdge<TInstruction> edge)

Parameters

edge ControlFlowEdge<TInstruction>

Returns

bool

Remove(ControlFlowNode<TInstruction>)

Removes all edges originating from the current node to the provided neighbour.

public bool Remove(ControlFlowNode<TInstruction> neighbour)

Parameters

neighbour ControlFlowNode<TInstruction>

The neighbour to cut ties with.

Returns

bool

True if at least one edge was removed, false otherwise.