Tree
A non-generic data tree.
Properties
LeafCount
#Gets the number of leaf items in this tree (this includes all items and all nulls).
Implements: LeafCount
TypeAssistant
#Gets the type assistant (if any) associated with the type constraint. More derived types that are stored in this tree may have more specific type assistants.
Implements: TypeAssistant
TypeFlavour
#Gets some information about the generic type parameter of this tree.
Implements: TypeFlavour
Methods
ConvertItems<Q>
#public Tree<Q> ConvertItems<Q>(Func<object, Q> replaceItem, Pear<Q> nullReplacement = null, CancellationToken token = default(CancellationToken))
Modify all items in this tree.
Parameters:
| replaceItem (Func<object, 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. |
Implements: ConvertItems
ConvertPears
#public ITree ConvertPears(Func<IPear, IPear> replacePear, IPear nullReplacement = null, CancellationToken token = default(CancellationToken))
Modify all pears in this tree.
Parameters:
| replacePear (Func<IPear, IPear>) | Replacement method for non-null pears. |
| nullReplacement (IPear = null) | Replacement method for nulls. If not provided, nulls are simply persisted. |
| token (CancellationToken = null) | Cancellation token. |
Implements: ConvertPears
ConvertPears<Q>
#public Tree<Q> ConvertPears<Q>(Func<IPear, Pear<Q>> replacePear, Pear<Q> nullReplacement = null, CancellationToken token = default(CancellationToken))
Modify all pears in this tree.
Parameters:
| replacePear (Func<IPear, 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. |
Implements: ConvertPears
Filter
#Apply a collection of 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 rules.
Implements: Filter
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.
Implements: Filter
Flatten
#Flatten the entire tree.
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.
Implements: Flip
GetCoverage
#Gets the part of a tree that is implied by a specific coverage.
Parameters:
| coverage (Coverage) | Coverage. |
Returns: Part of the tree identified by the coverage, or null if the coverage doesn't intersect with the tree.
Implements: GetCoverage
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
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. If the replace path already exists within the tree, the items will be appended to the existing twig.
Returns: Modified tree.
Implements: ReplacePath
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
Split
#Parameters:
| rules (IEnumerable<SiteRule>) | |
| positive (out ITree) | |
| negative (out ITree) |
Implements: Split
Split
#Split this tree into a positive and a negative state by applying a specific rule.
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.
Implements: WithIncrementalPaths
WithMetaData
#Merge all data from another tree.
Parameters:
| source (ITree) | Source of meta data. Source.Count must equal the local ImageCount and any twig in source which contains meta data must have the same length as the corresponding twig in this tree. |
| mergeBehaviour (MergeBehaviour) | Custom data merge behaviour. |
Implements: WithMetaData
WithMetaData
#Assign meta data to all items in this tree.
Parameters:
| primary (MetaData) | Primary data (assign no matter what). May be null. |
| secondary (MetaData) | Secondary data (assign only if doesn't conflict). May be null. |
Returns: Potentially modified tree.
Implements: WithMetaData
WithoutEmptyTwigs
#Remove all twigs that contain no items from this tree.
Returns: Modified tree.
Implements: WithoutEmptyTwigs
WithoutMetaData
#Clear all meta data from all twigs, but leave items intact.
Implements: WithoutMetaData
WithoutNullItems
#Remove all null items from all twigs.
Returns: Modified tree.
Implements: WithoutNullItems
WithoutPaths
#Remove the specified paths and corresponding twigs from this tree.
WithoutSites
#Remove the specified sites from this tree.
WithPathPrefix
#Prepend an integer to all paths in the tree.
WithPathPrefix
#Prepend an entire path to all existing paths in the tree.
WithPaths
#Create a new tree with different paths but the same twigs.
WithPathSuffix
#Append an integer to all paths in the tree.
WithPathSuffix
#Append an entire path to all existing paths in the tree.
WithRandomisedTwigs
#Randomise the items within the twigs of this tree.
Implements: WithRandomisedTwigs
WithRandomisedTwigs
#Randomise the items within the twigs of this tree.
Parameters:
| random (Random) |
Implements: WithRandomisedTwigs
WithRenumberedPaths
#Renumber all paths in this tree in ascending order.
Returns: Modified tree.
Implements: WithRenumberedPaths
WithRenumberedPaths
#Renumber all paths in this tree in ascending order.
Parameters:
| start (int) | Starting number for first path. |
Returns: Modified tree.
Implements: WithRenumberedPaths
WithRenumberedPaths
#Renumber all paths in this tree in ascending order.
Parameters:
| path (Path) | Path layout to use for renumbering. |
| index (int) | Element integer of path to increment. |
Returns: Modified tree.
Implements: WithRenumberedPaths
WithReversedTwigs
#Reverse the order of all the items in the twigs of this tree.
Returns: Reversed tree.
Implements: WithReversedTwigs
WithSimplifiedPaths
#Perform a simplify operation on this tree.
Parameters:
| options (PathAlignment) | Simplify options |
Returns: Modified tree.
Implements: WithSimplifiedPaths
WithSite
#WithSortedTwigs
#Sort all twigs using the default comparer.
Returns: Tree with sorted twigs.
Implements: WithSortedTwigs
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.
Implements: WithTopology
WithTrimmedPaths
#Trim the tree by removing the last element in each path and merging twigs together.
Returns: Modified tree.
Implements: WithTrimmedPaths
WithTrimmedPaths
#Trim the tree by removing the last N elements in each path and merging twigs together.
Parameters:
| count (int) | Number of elements to collapse. |
Returns: Modified tree.
Implements: WithTrimmedPaths