Type parameters:
| T | Type constraint. |
Properties
IsOrderable
#Gets whether this tree has orderable items. That is, whether it contains at least one twig with two or more items, not all of whom are nulls.
LeafCount
#Gets the number of leaf items in this tree (this includes all items and all nulls).
Implements: LeafCount
TypeFlavour
#Gets some information about the generic type parameter of this tree.
Implements: TypeFlavour
Methods
Add
#Add a new value to this tree.
Add
#Add all the values in a twig to this tree.
AddNull
#Add null values to this tree.
Convert<TQ>
#public virtual Tree<TQ> Convert<TQ>(ConversionDelegate<T, TQ> converter, CancellationToken token, ConversionRecord record)
Convert this tree into one of a different type.
Parameters:
| converter (ConversionDelegate<T, TQ>) | |
| token (CancellationToken) | |
| record (ConversionRecord) |
Convert<TQ>
#Convert this tree into one of a different type.
Parameters:
| converter (ConversionDelegate<T, TQ>) | |
| token (CancellationToken) |
Convert<TQ>
#Convert a tree by applying a functional mapping to all non-null items.
Parameters:
| converter (Func<T, TQ>) | Conversion method. |
| token (CancellationToken) | Cancellation token. |
Returns: Tree with converted values, but with the same topology and metadata.
ConvertItems<Q>
#public virtual Tree<Q> ConvertItems<Q>(Func<T, Q> replaceItem, Pear<Q> nullReplacement = null, CancellationToken token = default(CancellationToken))
Modify all items in this tree.
Parameters:
| replaceItem (Func<T, Q>) | Replacement method for non-null items. |
| nullReplacement (Pear<Q> = null) | Replacement pear for null values. If not provided, nulls are simply persisted. |
| token (CancellationToken = null) | Cancellation token. |
ConvertPears
#public virtual ITree ConvertPears(Func<Pear<T>, IPear> replacePear, IPear nullReplacement = null, CancellationToken token = default(CancellationToken))
Modify all pears in this tree.
Parameters:
| replacePear (Func<Pear<T>, IPear>) | Replacement method for non-null items. |
| nullReplacement (IPear = null) | Replacement method for nulls. If not provided, nulls are simply persisted. |
| token (CancellationToken = null) | Cancellation token. |
ConvertPears<Q>
#public virtual Tree<Q> ConvertPears<Q>(Func<Pear<T>, Pear<Q>> replacePear, Pear<Q> nullReplacement = null, CancellationToken token = default(CancellationToken))
Modify all pears in this tree.
Parameters:
| replacePear (Func<Pear<T>, Pear<Q>>) | Replacement method for non-null items. |
| nullReplacement (Pear<Q> = null) | Replacement method for nulls. If not provided, nulls are simply persisted. |
| token (CancellationToken = null) | Cancellation token. |
Filter
#Apply one or more rules to all the twigs and all the items in this tree.
Parameters:
| rules (IEnumerable<SiteRule>) | Rules to apply. |
Returns: A new tree with only the twigs and items that were valid under the given rule.
Filter
#Apply one or more rules to all the twigs and all the items in this tree.
Parameters:
| rules (params SiteRule[]) | Rules to apply. |
Returns: A new tree with only the twigs and items that were valid under the given rule.
Flip
#Flip the tree by exchanging the twig indices of all items with one of the path elements.
Parameters:
| elementIndex (int) | Path element to flip. |
| indexing (IndexModifier) | Indexing to apply to the indices. |
Returns: Flipped tree.
GetCoverage
#Gets the portion of the tree implied by the coverage.
Parameters:
| coverage (Coverage) |
Implements: GetCoverage
Parameters:
| replaceItem (Func<object, Q>) | |
| nullReplacement (Pear<Q>) | |
| token (CancellationToken) |
Implements: ConvertItems
Parameters:
| replacePear (Func<IPear, IPear>) | |
| nullReplacement (IPear) | |
| token (CancellationToken) |
Implements: ConvertPears
Parameters:
| replacePear (Func<IPear, Pear<Q>>) | |
| nullReplacement (Pear<Q>) | |
| token (CancellationToken) |
Implements: ConvertPears
Parameters:
| rules (IEnumerable<SiteRule>) |
Implements: Filter
Parameters:
| rules (params SiteRule[]) |
Implements: Filter
Parameters:
| elementIndex (int) | |
| indexing (IndexModifier) |
Implements: Flip
Implements: ReplacePath
Parameters:
| rules (IEnumerable<SiteRule>) | |
| positive (out ITree) | |
| negative (out ITree) |
Implements: Split
Implements: WithIncrementalPaths
Parameters:
| source (ITree) | |
| mergeBehaviour (MergeBehaviour) |
Implements: WithMetaData
Implements: WithMetaData
Parameters:
| paths (IEnumerable<Path>) |
Implements: WithoutPaths
Parameters:
| paths (params Path[]) |
Implements: WithoutPaths
Parameters:
| sites (IEnumerable<Site>) |
Implements: WithoutSites
Parameters:
| sites (params Site[]) |
Implements: WithoutSites
Parameters:
| element (int) |
Implements: WithPathPrefix
Parameters:
| path (Path) |
Implements: WithPathPrefix
Parameters:
| element (int) |
Implements: WithPathSuffix
Parameters:
| path (Path) |
Implements: WithPathSuffix
Parameters:
| random (Random) |
Implements: WithRandomisedTwigs
Parameters:
| start (int) |
Implements: WithRenumberedPaths
Implements: WithRenumberedPaths
Parameters:
| options (PathAlignment) |
Implements: WithSimplifiedPaths
Parameters:
| source (ITree) |
Implements: WithTopology
Parameters:
| count (int) |
Implements: WithTrimmedPaths
IsCoincidentWith
#Test whether a given coverage coincides with this tree.
Parameters:
| coverage (Coverage) | Coverage to test. |
Returns: True if the coverage is valid.
Implements: IsCoincidentWith
IsCoincidentWith
#Tests whether a given site (path+twig index) is part of this tree.
Parameters:
| site (Site) | Tree site. |
Returns: True if the site exists within the tree.
Implements: IsCoincidentWith
ModifyItems
#public virtual Tree<T> ModifyItems(Func<T, bool> remove = null, Func<T, bool> replace = null, Func<T, T> replaceItem = null, Func<T> replaceNull = null, CancellationToken token = default(CancellationToken))
Create a new tree by replacing all items in this tree by some other value.
Parameters:
| remove (Func<T, bool> = null) | Method which indicates an item ought to be removed from the tree. |
| replace (Func<T, bool> = null) | Method for determining whether a replacement is required. If null, every item is traversed. |
| replaceItem (Func<T, T> = null) | Method invoked for replacing non-null items. |
| replaceNull (Func<T> = null) | Method invoked for null items. If not provided, null items will be retained. |
| token (CancellationToken = null) | Optional cancellation token. |
Returns: Modified tree.
ModifyPaths
#Apply a set of modifier delegates to the paths in this tree.
NullAt
#Gets whether a specific item is null or not.
NullAt
#Gets whether a specific item is null or not.
ReplacePath
#Replace one path with another.
Similarity
#Compares two data trees for similarity.
Parameters:
| tree (ITree) | Data tree to compare to. |
Returns: A TreeSimilarity type. This method never returns the PathsAndListsAndItems value.
Implements: Similarity
Similarity
#Compares two data trees for similarity.
Parameters:
| tree (Tree<T>) | Data tree to compare to. |
| comparer (Comparison<T>) | Item comparer. |
Returns: A TreeSimilarity type.
Split
#ToArrays
#Create a nested array of all items and meta data in all twigs. If there is no meta data whatsoever, this array may be returned as null. If the type constraint is a nullable type, the nullData array will be null.
Parameters:
| items (out T[][]) | |
| metas (out MetaData[][]) | |
| nulls (out bool[][]) |
ToArrays
#Create a nested array of all items and meta data in all twigs. If there is no meta data whatsoever, this array may be returned as null.
Parameters:
| items (out T[][]) | |
| metas (out MetaData[][]) |
ToArrays
#public abstract void ToArrays(out T[][] items)
Create a nested array of all items in all twigs.
Parameters:
| items (out T[][]) |
ToString
#Returns a string that represents the current object.
Returns: A string that represents the current object.
Overrides: Object.ToString
ToString
#Format this tree using a specific formatting template.
Parameters:
| style (TwigFormatStyle) | Formatting style. |
Returns: String describing the tree.
Implements: ToString
TryConvert<TQ>
#Try and convert this tree into a tree of a specific type.
Returns: Tree of type TQ or null if no conversion could be found.
Implements: TryConvert
TryConvert<TQ>
#Try and convert this tree into a tree of a specific type.
Parameters:
| token (CancellationToken) | Cancellation token. |
| record (ConversionRecord) | If not null, conversion messages will be added to this record. |
Returns: Tree of type TQ or null if no conversion could be found.
Implements: TryConvert
TryConvert<TQ>
#Try and convert this tree into a tree of a specific type.
Parameters:
| token (CancellationToken) | Cancellation token. |
Returns: Tree of type TQ or null if no conversion could be found.
Implements: TryConvert
WithIncrementalPaths
#Simplify the numbering of paths by starting at zero and incrementing by one for each element in the sequence.
WithMetaData
#Merge all data from another tree.
Parameters:
| source (ITree) | Source of meta data. The topology of the source must be identical to the topology of this tree for a meta data merge to work. |
| mergeBehaviour (MergeBehaviour) | Custom data merge behaviour. |
WithMetaData
#WithoutPaths
#Remove all specified paths and corresponding twigs.
Parameters:
| paths (IEnumerable<Path>) | Paths to remove. |
Returns: Modified tree.
WithoutPaths
#Remove the specified paths and corresponding twigs from this tree.
Parameters:
| paths (params Path[]) | Paths to remove. |
Returns: Modified tree.
WithoutSites
#Remove the specified sites from this tree.
Parameters:
| sites (IEnumerable<Site>) | Sites to remove. |
Returns: Modified tree.
WithoutSites
#Remove the specified sites from this tree.
Parameters:
| sites (params Site[]) | Loci to remove. |
Returns: Modified tree.
WithPathPrefix
#Prepend an integer to all paths in the tree.
Parameters:
| element (int) | Element to prepend. |
Returns: Modified tree.
WithPathPrefix
#Prepend an entire path to all existing paths in the tree.
Parameters:
| path (Path) | Path to prepend. |
Returns: Modified tree.
WithPaths
#Copy the paths from another tree while keeping the data from this tree. For a successful path copy, the source and the target trees must have the same number of paths.
Parameters:
| paths (Paths) | Source tree to copy paths from. |
Returns: Modified tree.
WithPathSuffix
#Append an integer to all paths in the tree.
Parameters:
| element (int) | Element to append. |
Returns: Modified tree.
WithPathSuffix
#Append an entire path to all existing paths in the tree.
Parameters:
| path (Path) | Path to append. |
Returns: Modified tree.
WithRenumberedPaths
#Renumber all paths in this tree in ascending order.
Parameters:
| start (int) | Starting number for first path. |
Returns: Modified tree.
WithRenumberedPaths
#Renumber all paths in this tree in ascending order.
WithReversedTwigs
#Reverse the order of all the items in the twigs of this tree.
Returns: Reversed tree.
WithSimplifiedPaths
#Perform a simplify operation on this tree.
Parameters:
| options (PathAlignment) | Simplify options |
Returns: Modified tree.
WithSite
#Replace a single pear in this tree.
WithSite
#Replace a single item in this tree.
Parameters:
| site (Site) | Site of item. |
| item (T) | New item. |
Returns: Tree with replaced item.
WithSortedTwigs
#Sort all branches using the default comparer.
Parameters:
| comparer (IComparer<T>) |
Returns: Tree with sorted branches.
WithTopology
#Copy the topology of another tree while keeping the data from this tree. For a successful topology copy, the source and the target trees must have the same number of items.
Parameters:
| source (ITree) | Source tree to copy topology from. |
Returns: modified tree.
WithTrimmedPaths
#Trim the tree by removing the last element in each path and merging twigs together.
Returns: Modified tree.