The NodeStateCopier and NodeStateCopier.Builder classes allow
recursively copying a NodeState to a NodeBuilder.
The copy algorithm is optimized for copying nodes between two
different NodeStore instances, i.e. where comparing NodeStates
is imprecise and/or expensive.
The algorithm does a post-order traversal. I.e. it copies
changed leaf-nodes first.
The work for a traversal without any differences between
source and target is equivalent to the single
execution of a naive equals implementation.
Usage: For most use-cases the Builder API should be
preferred. It allows setting includePaths,
excludePaths and mergePaths.
Include paths: if include paths are set, only these paths
and their sub-trees are copied. Any nodes that are not within the
scope of an include path are implicitly excluded.
Exclude paths: if exclude paths are set, any nodes matching
or below the excluded path are not copied. If an excluded node does
exist in the target, it is removed (see also merge paths).
Exclude fragments: if exclude fragments are set, nodes with names
matching any of the fragments (and their subtrees) are not copied. If an
excluded node does exist in the target, it is removed.
Merge paths: if merge paths are set, any nodes matching or
below the merged path will not be deleted from target, even if they
are missing in (or excluded from) the source.