Interface INodeManager<T>
- Namespace
- WitShells.DesignPatterns.Core
Defines the contract for a collection manager that stores and queries NodeController<T> instances.
public interface INodeManager<T>
Type Parameters
TThe data type wrapped by each node.
Methods
AddNode(NodeController<T>)
Adds a node to the collection. Returns true on success.
bool AddNode(NodeController<T> node)
Parameters
nodeNodeController<T>
Returns
Clear()
Removes all nodes and disposes each one.
void Clear()
FromJson(string)
Deserialises and replaces the collection from a JSON string.
void FromJson(string json)
Parameters
jsonstring
GetAllNodes()
Returns an enumerable of all nodes currently in the collection.
IEnumerable<NodeController<T>> GetAllNodes()
Returns
GetAllNodesList()
Returns a new List<T> copy of all nodes.
List<NodeController<T>> GetAllNodesList()
Returns
- List<NodeController<T>>
GetNode(Func<T, bool>)
Returns the first node value that satisfies predicate, or default.
T GetNode(Func<T, bool> predicate)
Parameters
Returns
- T
RemoveNode(NodeController<T>)
Removes a node from the collection. Returns true on success.
bool RemoveNode(NodeController<T> node)
Parameters
nodeNodeController<T>
Returns
RemoveWhere(Func<T, bool>)
Removes all nodes whose data satisfies predicate.
void RemoveWhere(Func<T, bool> predicate)
Parameters
ToJson()
Serialises the collection to a JSON string.
string ToJson()