Tree<T>

References
[DebuggerDisplay("{DebuggerDisplay}")] public abstract class Tree<T> : ITree
Strongly typed version of the ITree interface.
TType constraint.

Properties

AllItems

#
Enumerate over all items in this tree.
public IEnumerable<T> AllItems { get; }

AllPears

#
Enumerate over all item/meta data pears in this tree.
public IEnumerable<Pear<T>> AllPears { get; }

AllTwigs

#
Enumerate over all twigs in this tree.
public IEnumerable<Twig<T>> AllTwigs { get; }

CommonMetaData

#
Gets the non-conflicting meta data inside this tree.
public abstract MetaData CommonMetaData { get; }
CommonMetaData

DebuggerDisplay

#
public string DebuggerDisplay { get; }

Description

#
Gets a string describing the topology of this tree.
public string Description { get; }
Description
Explicit

ITree.AllItems

#
AllItems
Explicit

ITree.AllPears

#
AllPears
Explicit

ITree.AllTwigs

#
AllTwigs
Explicit

ITree.Items

#
Items
Explicit

ITree.NonNullItems

#
IEnumerable<object> ITree.NonNullItems
NonNullItems
Explicit

ITree.NonNullPears

#
IEnumerable<IPear> ITree.NonNullPears
NonNullPears
Explicit

ITree.Pears

#
Pears
Explicit

ITree.Twigs

#
Twigs
Explicit

ITree.TypeAssistant

#
ITypeAssistant ITree.TypeAssistant
TypeAssistant

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.
protected bool IsOrderable { get; }

ItemCount

#
Gets the total number of non-null items in this tree.
public abstract int ItemCount { get; }
ItemCount

Items

#
Access the items in this tree.
public abstract IItemAccessor<T> Items { get; }

LeafCount

#
Gets the number of leaf items in this tree (this includes all items and all nulls).
public abstract int LeafCount { get; }
LeafCount

MetaCount

#
Gets the number of meta data entries.
public abstract int MetaCount { get; }
MetaCount

NonNullItems

#
Enumerate over all non-null items in this tree.
public IEnumerable<T> NonNullItems { get; }

NonNullPears

#
Enumerate over all item/meta data pears in this tree.
public IEnumerable<Pear<T>> NonNullPears { get; }

NullCount

#
Gets the total number of null items in this tree.
public abstract int NullCount { get; }
NullCount

PathCount

#
Gets the number of paths (and thus twigs) in this tree.
public abstract int PathCount { get; }
PathCount

Paths

#
Access the paths of this tree.
public abstract Paths Paths { get; }
Paths

Pears

#
Access the pears in this tree.
public abstract IPearAccessor<T> Pears { get; }

Twigs

#
Access the twigs in this tree.
public abstract ITwigAccessor<T> Twigs { get; }

Type

#
Gets the type of the data stored in this tree.
public Type Type { get; }
Type

TypeAssistant

#
Gets the type assistant (if any) associated with the tree type constraint.
public ITypeAssistant<T> TypeAssistant { get; }

TypeFlavour

#
Gets some information about the generic type parameter of this tree.
public TypeFlavour TypeFlavour { get; }
TypeFlavour

Methods

Add

#
Add a collection of values to this tree.
public Tree<T> Add(
path,
pears
)

Add

#
Add a collection of values to this tree.
public Tree<T> Add(
path,
values
)

Add

#
Add a new value to this tree.
public Tree<T> Add(
path,
params Pear<T>[]
pears
)

Add

#
Add values to this tree.
public Tree<T> Add(
path,
params T[]
values
)

Add

#
Add all the values in a twig to this tree.
public Tree<T> Add(
path,
Twig<T>
twig
)

AddNull

#
Add null values to this tree.
public Tree<T> AddNull(
path,
count = 1
)

Convert<TQ>

#
Convert this tree into one of a different type.
public virtual Tree<TQ> Convert<TQ>()

Convert<TQ>

#
Convert this tree into one of a different type.
public Tree<TQ> Convert<TQ>(
converter,
token
)

Convert<TQ>

#
Convert a tree by applying a functional mapping to all non-null items.
public Tree<TQ> Convert<TQ>(
Func<T, TQ>
converter,
Conversion method.
token
Cancellation token.
)
Tree with converted values, but with the same topology and metadata.

ConvertItems<Q>

#
Modify all items in this tree.
public virtual Tree<Q> ConvertItems<Q>(
Func<T, Q>
replaceItem,
Replacement method for non-null items.
Pear<Q>
nullReplacement = null,
Replacement pear for null values. If not provided, nulls are simply persisted.
token = default(CancellationToken)
Cancellation token.
)

ConvertPears

#
Modify all pears in this tree.
public virtual ITree ConvertPears(
replacePear,
Replacement method for non-null items.
nullReplacement = null,
Replacement method for nulls. If not provided, nulls are simply persisted.
token = default(CancellationToken)
Cancellation token.
)

ConvertPears<Q>

#
Modify all pears in this tree.
public virtual Tree<Q> ConvertPears<Q>(
Func<Pear<T>, Pear<Q>>
replacePear,
Replacement method for non-null items.
Pear<Q>
nullReplacement = null,
Replacement method for nulls. If not provided, nulls are simply persisted.
token = default(CancellationToken)
Cancellation token.
)

Filter

#
Apply one or more rules to all the twigs and all the items in this tree.
public virtual Tree<T> Filter(
rules
Rules to apply.
)
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.
public Tree<T> Filter(
params SiteRule[]
rules
Rules to apply.
)
A new tree with only the twigs and items that were valid under the given rule.

Flatten

#
Flatten the entire tree.
public Tree<T> Flatten()
Modified tree.

Flatten

#
Flatten the entire tree.
public virtual Tree<T> Flatten(
path
)
Modified tree.

Flip

#
Flip the tree by exchanging the twig indices of all items with one of the path elements.
public Tree<T> Flip(
elementIndex,
Path element to flip.
indexing
Indexing to apply to the indices.
)
Flipped tree.

GetCoverage

#
Gets the portion of the tree implied by the coverage.
public object GetCoverage(
coverage
)
GetCoverage

Graft

#
Perform a graft operation on the entire tree.
public virtual Tree<T> Graft()
Modified tree.
Explicit

ITree.ConvertItems<Q>

#
Tree<Q> ITree.ConvertItems<Q>(
replaceItem,
Pear<Q>
nullReplacement,
token
)
ConvertItems
Explicit

ITree.ConvertPears

#
ITree ITree.ConvertPears(
replacePear,
nullReplacement,
token
)
ConvertPears
Explicit

ITree.ConvertPears<Q>

#
Tree<Q> ITree.ConvertPears<Q>(
replacePear,
Pear<Q>
nullReplacement,
token
)
ConvertPears
Explicit

ITree.Filter

#
Filter
Explicit

ITree.Filter

#
ITree ITree.Filter(
params SiteRule[]
rules
)
Filter
Explicit

ITree.Flatten

#
ITree ITree.Flatten()
Flatten
Explicit

ITree.Flatten

#
ITree ITree.Flatten(
path
)
Flatten
Explicit

ITree.Flip

#
ITree ITree.Flip(
elementIndex,
indexing
)
Flip
Explicit

ITree.Graft

#
ITree ITree.Graft()
Graft
Explicit

ITree.ReplacePath

#
ITree ITree.ReplacePath(
find,
replace
)
ReplacePath
Explicit

ITree.Split

#
void ITree.Split(
rules,
out ITree
positive,
out ITree
negative
)
Split
Explicit

ITree.Split

#
void ITree.Split(
rule,
out ITree
positive,
out ITree
negative
)
Split
Explicit

ITree.WithIncrementalPaths

#
ITree ITree.WithIncrementalPaths()
Explicit

ITree.WithMetaData

#
ITree ITree.WithMetaData(
source,
mergeBehaviour
)
WithMetaData
Explicit

ITree.WithMetaData

#
ITree ITree.WithMetaData(
primary,
secondary
)
WithMetaData
Explicit

ITree.WithoutEmptyTwigs

#
ITree ITree.WithoutEmptyTwigs()
WithoutEmptyTwigs
Explicit

ITree.WithoutMetaData

#
ITree ITree.WithoutMetaData()
WithoutMetaData
Explicit

ITree.WithoutNullItems

#
ITree ITree.WithoutNullItems()
WithoutNullItems
Explicit

ITree.WithoutPaths

#
ITree ITree.WithoutPaths()
WithoutPaths
Explicit

ITree.WithoutPaths

#
ITree ITree.WithoutPaths(
params Path[]
paths
)
WithoutPaths
Explicit

ITree.WithoutSites

#
ITree ITree.WithoutSites()
WithoutSites
Explicit

ITree.WithoutSites

#
ITree ITree.WithoutSites(
params Site[]
sites
)
WithoutSites
Explicit

ITree.WithPathPrefix

#
ITree ITree.WithPathPrefix(
element
)
WithPathPrefix
Explicit

ITree.WithPathPrefix

#
ITree ITree.WithPathPrefix(
path
)
WithPathPrefix
Explicit

ITree.WithPaths

#
ITree ITree.WithPaths(
paths
)
WithPaths
Explicit

ITree.WithPathSuffix

#
ITree ITree.WithPathSuffix(
element
)
WithPathSuffix
Explicit

ITree.WithPathSuffix

#
ITree ITree.WithPathSuffix(
path
)
WithPathSuffix
Explicit

ITree.WithRandomisedTwigs

#
ITree ITree.WithRandomisedTwigs()
Explicit

ITree.WithRandomisedTwigs

#
ITree ITree.WithRandomisedTwigs(
random
)
Explicit

ITree.WithRenumberedPaths

#
ITree ITree.WithRenumberedPaths()
Explicit

ITree.WithRenumberedPaths

#
ITree ITree.WithRenumberedPaths(
start
)
Explicit

ITree.WithRenumberedPaths

#
ITree ITree.WithRenumberedPaths(
path,
index
)
Explicit

ITree.WithReversedTwigs

#
ITree ITree.WithReversedTwigs()
WithReversedTwigs
Explicit

ITree.WithSimplifiedPaths

#
ITree ITree.WithSimplifiedPaths()
Explicit

ITree.WithSite

#
ITree ITree.WithSite(
site,
pear
)
WithSite
Explicit

ITree.WithSortedTwigs

#
ITree ITree.WithSortedTwigs()
WithSortedTwigs
Explicit

ITree.WithTopology

#
ITree ITree.WithTopology(
source
)
WithTopology
Explicit

ITree.WithTrimmedPaths

#
ITree ITree.WithTrimmedPaths()
WithTrimmedPaths
Explicit

ITree.WithTrimmedPaths

#
ITree ITree.WithTrimmedPaths(
count
)
WithTrimmedPaths

IsCoincidentWith

#
Test whether a given coverage coincides with this tree.
public bool IsCoincidentWith(
coverage
Coverage to test.
)
True if the coverage is valid.
IsCoincidentWith

IsCoincidentWith

#
Tests whether a given site (path+twig index) is part of this tree.
public bool IsCoincidentWith(
site
Tree site.
)
True if the site exists within the tree.
IsCoincidentWith

ModifyItems

#
Create a new tree by replacing all items in this tree by some other value.
public virtual Tree<T> ModifyItems(
Func<T, bool>
remove = null,
Method which indicates an item ought to be removed from the tree.
Func<T, bool>
replace = null,
Method for determining whether a replacement is required. If null, every item is traversed.
Func<T, T>
replaceItem = null,
Method invoked for replacing non-null items.
Func<T>
replaceNull = null,
Method invoked for null items. If not provided, null items will be retained.
token = default(CancellationToken)
Optional cancellation token.
)
Modified tree.

ModifyPaths

#
Apply a set of modifier delegates to the paths in this tree.
public virtual Tree<T> ModifyPaths(
remove = null,
Optional delegate for removing paths+twigs from this tree based on path value.
replace = null
Optional delegate for replacing paths with other paths. If this delegate returns a null the path will be removed.
)
Modified tree.

ModifyTwigs

#
Apply a set of modifier delegates to the twigs in this tree.
public virtual Tree<T> ModifyTwigs(
Func<Twig<T>, bool>
remove = null,
Optional delegate for removing paths+twigs from this tree based on twig value.
Func<Twig<T>, Twig<T>>
replace = null
Optional delegate for replacing twigs with other twigs. If this delegate returns a null the twig will be removed.
)
Modified tree.

NullAt

#
Gets whether a specific item is null or not.
public bool NullAt(
twigIndex,
Index of twig.
itemIndex
Index of item.
)
True if item at the given site is null.
NullAt

NullAt

#
Gets whether a specific item is null or not.
public bool NullAt(
path,
Path of item twig.
itemIndex
Index within twig.
)
True if item at the given site is null.
NullAt

ReplacePath

#
Replace one path with another.
public Tree<T> ReplacePath(
find,
Path to find.
replace
Path to replace.
)
Modified tree.

Similarity

#
Compares two data trees for similarity.
public TreeSimilarity Similarity(
tree
Data tree to compare to.
)
A TreeSimilarity type. This method never returns the PathsAndListsAndItems value.
Similarity

Similarity

#
Compares two data trees for similarity.
public TreeSimilarity Similarity(
Tree<T>
tree,
Data tree to compare to.
comparer
Item comparer.
)
A TreeSimilarity type.

Split

#
public virtual void Split(
rules,
out Tree<T>
positive,
out Tree<T>
negative
)

Split

#
public void Split(
rule,
out Tree<T>
positive,
out Tree<T>
negative
)

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.
public abstract void ToArrays(
out T[][]
items,
out MetaData[][]
metas,
out bool[][]
nulls
)

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.
public abstract void ToArrays(
out T[][]
items,
out MetaData[][]
metas
)

ToArrays

#
Create a nested array of all items in all twigs.
public abstract void ToArrays(
out T[][]
items
)

ToString

#
Returns a string that represents the current object.
public sealed override string ToString()
A string that represents the current object.
Object.ToString

ToString

#
Format this tree using a specific formatting template.
public string ToString(
style
Formatting style.
)
String describing the tree.
ToString

TryConvert<TQ>

#
Try and convert this tree into a tree of a specific type.
public Tree<TQ> TryConvert<TQ>()
Tree of type TQ or null if no conversion could be found.
TryConvert

TryConvert<TQ>

#
Try and convert this tree into a tree of a specific type.
public virtual Tree<TQ> TryConvert<TQ>(
token,
Cancellation token.
record
If not null, conversion messages will be added to this record.
)
Tree of type TQ or null if no conversion could be found.
TryConvert

TryConvert<TQ>

#
Try and convert this tree into a tree of a specific type.
public Tree<TQ> TryConvert<TQ>(
token
Cancellation token.
)
Tree of type TQ or null if no conversion could be found.
TryConvert

WithIncrementalPaths

#
Simplify the numbering of paths by starting at zero and incrementing by one for each element in the sequence.
public Tree<T> WithIncrementalPaths()

WithMetaData

#
Merge all data from another tree.
public Tree<T> WithMetaData(
source,
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
Custom data merge behaviour.
)

WithMetaData

#
public Tree<T> WithMetaData(
primary,
secondary
)

WithoutEmptyTwigs

#
Remove all twigs that contain no items from this tree.
public Tree<T> WithoutEmptyTwigs()
Modified tree.

WithoutMetaData

#
Clear all meta data from all twigs, but leave items intact.
public Tree<T> WithoutMetaData()

WithoutNullItems

#
Remove all null items from all twigs.
public Tree<T> WithoutNullItems()
Modified tree.

WithoutPaths

#
Remove all specified paths and corresponding twigs.
public Tree<T> WithoutPaths(
paths
Paths to remove.
)
Modified tree.

WithoutPaths

#
Remove the specified paths and corresponding twigs from this tree.
public Tree<T> WithoutPaths(
params Path[]
paths
Paths to remove.
)
Modified tree.

WithoutSites

#
Remove the specified sites from this tree.
public Tree<T> WithoutSites(
sites
Sites to remove.
)
Modified tree.

WithoutSites

#
Remove the specified sites from this tree.
public Tree<T> WithoutSites(
params Site[]
sites
Loci to remove.
)
Modified tree.

WithPathPrefix

#
Prepend an integer to all paths in the tree.
public Tree<T> WithPathPrefix(
element
Element to prepend.
)
Modified tree.

WithPathPrefix

#
Prepend an entire path to all existing paths in the tree.
public Tree<T> WithPathPrefix(
path
Path to prepend.
)
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.
public Tree<T> WithPaths(
paths
Source tree to copy paths from.
)
Modified tree.

WithPathSuffix

#
Append an integer to all paths in the tree.
public Tree<T> WithPathSuffix(
element
Element to append.
)
Modified tree.

WithPathSuffix

#
Append an entire path to all existing paths in the tree.
public Tree<T> WithPathSuffix(
path
Path to append.
)
Modified tree.

WithRandomisedTwigs

#
Randomise the items within the twigs of this tree.
public Tree<T> WithRandomisedTwigs()

WithRandomisedTwigs

#
Randomise the items within the twigs of this tree.
public virtual Tree<T> WithRandomisedTwigs(
random
)

WithRenumberedPaths

#
Renumber all paths in this tree in ascending order.
public Tree<T> WithRenumberedPaths()
Modified tree.

WithRenumberedPaths

#
Renumber all paths in this tree in ascending order.
public Tree<T> WithRenumberedPaths(
start
Starting number for first path.
)
Modified tree.

WithRenumberedPaths

#
Renumber all paths in this tree in ascending order.
public Tree<T> WithRenumberedPaths(
path,
Path layout to use for renumbering.
index
Element integer of path to increment.
)
Modified tree.

WithReversedTwigs

#
Reverse the order of all the items in the twigs of this tree.
public virtual Tree<T> WithReversedTwigs()
Reversed tree.

WithSimplifiedPaths

#
Perform a simplify operation on this tree.
public Tree<T> WithSimplifiedPaths(
options
Simplify options
)
Modified tree.

WithSite

#
Replace a single pear in this tree.
public virtual Tree<T> WithSite(
site,
Site of pear.
Pear<T>
pear
New pear.
)
Tree with replaced pear.

WithSite

#
Replace a single item in this tree.
public virtual Tree<T> WithSite(
site,
Site of item.
T
item
New item.
)
Tree with replaced item.

WithSortedTwigs

#
Sort all branches using the default comparer.
public Tree<T> WithSortedTwigs()
Tree with sorted branches.

WithSortedTwigs

#
Sort all branches using the default comparer.
public Tree<T> WithSortedTwigs(
comparer
)
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.
public Tree<T> WithTopology(
source
Source tree to copy topology from.
)
modified tree.

WithTrimmedPaths

#
Trim the tree by removing the last element in each path and merging twigs together.
public Tree<T> WithTrimmedPaths()
Modified tree.

WithTrimmedPaths

#
Trim the tree by removing the last N elements in each path and merging twigs together.
public Tree<T> WithTrimmedPaths(
count
Number of elements to collapse.
)
Modified tree.