Click or drag to resize

TreeNodeExtensionsProjectTreeToTreeS, D(S, D, FuncS, IEnumeratorS, FuncD, IEnumeratorD, ActionS, D, FuncD, D, ActionD, D, Int32, ListValueTupleD, D, Int32) Method

Projects a source tree onto a destination tree. Nodes are updated, added, or deleted in the destination tree to match the source tree.

Namespace: Altaxo.Collections
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static void ProjectTreeToTree<S, D>(
	S sourceRootNode,
	D destinationRootNode,
	Func<S, IEnumerator<S>?> getSourceChildEnumerator,
	Func<D, IEnumerator<D>?> getDestinationChildEnumerator,
	Action<S, D> updateDestinationNodeFromSourceNode,
	Func<D, D> createDestinationNode,
	Action<D, D, int> deleteDestinationNode,
	ref List<(D , D , int )>? destinationNodesToDelete
)

Parameters

sourceRootNode  S
The source root node.
destinationRootNode  D
The destination root node.
getSourceChildEnumerator  FuncS, IEnumeratorS
A function that takes a source node and returns an enumerator to enumerate the children of that node.
getDestinationChildEnumerator  FuncD, IEnumeratorD
A function that takes a destination node and returns an enumerator to enumerate the children of that node.
updateDestinationNodeFromSourceNode  ActionS, D
An action that takes a source node and a destination node and updates the destination node according to the contents of the source node.
createDestinationNode  FuncD, D
A function that takes a parent destination node as argument and creates a new destination node as a child of that parent. The return value is the newly created node.
deleteDestinationNode  ActionD, D, Int32
An action that deletes a destination node. First argument is the parent node, the second argument is the destination node to delete, 3rd argument is the index of the child node (as obtained from the order of the child node enumeration).
destinationNodesToDelete  ListValueTupleD, D, Int32
A helper collection to collect destination nodes that have to be deleted. Initially, may be null.

Type Parameters

S
Type of the source node.
D
Type of the destination node.
See Also