TreeExtensionMethods

public static class TreeExtensionMethods

Methods

EnumerateLeaves<T>

#Example
Enumerate over all pears in a tree and their associated sites.
public static IEnumerable<Leaf<T>> EnumerateLeaves<T>(
this Tree<T>
tree
)

EnumerateLeaves

#Example
Enumerate over all pears in a tree and their associated sites.
public static IEnumerable<Leaf> EnumerateLeaves(
this ITree
tree
)

ExpandEmbeddedCollections

#Example
Process a tree and automatically convert all linear enumerations and trees stored as items into new twigs and sub-trees. This method is recursive and keeps replacing embedded collections until no more changes happen.
public static ITree ExpandEmbeddedCollections(
this ITree
tree,
Tree to expand.
options,
Expansion options.
params ExpansionLogic[]
customExpanders
Collection of types to be considered as linear collections. Note that each type in this set must also implement IEnumerable or it will not be considered.
)
Expanded tree, or null if no embedded collections were found.

ExpandEmbeddedCollections

#Example
Process a tree and automatically convert all linear enumerations and trees stored as items into new twigs and sub-trees. This method is recursive and keeps replacing embedded collections until no more changes happen.
public static ITree ExpandEmbeddedCollections(
this ITree
tree,
Tree to expand.
params ExpansionLogic[]
customExpanders
Collection of types to be considered as linear collections. Note that each type in this set must also implement IEnumerable or it will not be considered.
)
Expanded tree, or null if no embedded collections were found.

ExpandEmbeddedCollections

#Example
Process a twig and automatically convert all linear enumerations and trees stored as items into new twigs and sub-trees. This method is not recursive so must be called iteratively until no more changes are made. Consider using the overload of this method which takes an ITree and which is recursive.
public static ITwig[] ExpandEmbeddedCollections(
this ITwig
twig,
Twig to expand.
options,
Expansion options. Note that ExpansionOptions.Recurse and ExpansionOptions.Recurse are not relevant to this method.
params ExpansionLogic[]
customExpanders
Collection of types to be considered as linear collections. Note that each type in this set must also implement IEnumerable or it will not be considered.
)
Array of twigs with automatic incremental paths, or null if no embedded collections were found.

ExpandEmbeddedCollections

#Example
Process a twig and automatically convert all linear enumerations and trees stored as items into new twigs and sub-trees. This method is not recursive so must be called iteratively until no more changes are made. Consider using the overload of this method which takes an ITree and which is recursive.
public static ITwig[] ExpandEmbeddedCollections(
this ITwig
twig,
Twig to expand.
params ExpansionLogic[]
customExpanders
Collection of types to be considered as linear collections. Note that each type in this set must also implement IEnumerable or it will not be considered.
)
Array of twigs with automatic incremental paths, or null if no embedded collections were found.

RepairPears

#Example
Find all places where IPear instances are assigned as twig items and promote them to the proper structure.
public static ITree RepairPears(
this ITree
tree
Tree to repair.
)
Repaired tree or null if no repairs were needed.

RepairPears

#Example
Find all places where IPear instances are assigned as twig items and promote them to the proper structure.
public static ITwig RepairPears(
this ITwig
twig
Twig to repair.
)
Repaired twig or null if no repairs were needed.

ToNullAwareArray

#Example
Gets an array of doubles with all null values set to NaN.
public static double[] ToNullAwareArray(
this Twig<double>
twig
)