Table of Contents

Class NodesManager<T>

A simple list-backed INodeManager<T> that stores nodes in insertion order. Duplicate nodes (by reference) are rejected.

public class NodesManager<T> : INodeManager<T>

Type Parameters

T

The node data type.

Inheritance
NodesManager<T>
Implements
Inherited Members

Methods

AddNode(NodeController<T>)

Adds a node to the collection. Returns true on success.

public bool AddNode(NodeController<T> node)

Parameters

node NodeController<T>

Returns

bool

Clear()

Removes all nodes and disposes each one.

public void Clear()

FromJson(string)

Deserialises and replaces the collection from a JSON string.

public virtual void FromJson(string json)

Parameters

json string

GetAllNodes()

Returns an enumerable of all nodes currently in the collection.

public IEnumerable<NodeController<T>> GetAllNodes()

Returns

IEnumerable<NodeController<T>>

GetNode(Func<T, bool>)

Returns the first node value that satisfies predicate, or default.

public virtual T GetNode(Func<T, bool> predicate)

Parameters

predicate Func<T, bool>

Returns

T

GetNode(T)

public NodeController<T> GetNode(T value)

Parameters

value T

Returns

NodeController<T>

RemoveNode(NodeController<T>)

Removes a node from the collection. Returns true on success.

public bool RemoveNode(NodeController<T> node)

Parameters

node NodeController<T>

Returns

bool

RemoveWhere(Func<T, bool>)

Removes all nodes whose data satisfies predicate.

public void RemoveWhere(Func<T, bool> predicate)

Parameters

predicate Func<T, bool>

ToJson()

Serialises the collection to a JSON string.

public virtual string ToJson()

Returns

string