Fields
Methods
ApplyExpression
#public static ITree ApplyExpression(ITree tree, Expression expression, Resolver resolver, out string[] errors)
Apply an expression to an entire tree.
Parameters:
| tree (ITree) | Tree to modify. |
| expression (Expression) | Expression to apply. |
| resolver (Resolver) | A resolver for undefined expression variables. |
| errors (out string[]) | Array of errors encountered during application. |
Returns: Modified tree.
ConcatenateITwigs
#Concatenate an arbitrary number of twigs into a single twig in a single pass, avoiding the quadratic allocation cost of repeated pairwise merging.
Parameters:
| twigs (IReadOnlyList<ITwig>) | Twigs to concatenate in order. Null or empty twigs are skipped. |
IPear
#Create a pear for a value with optional meta data.
ITreeFromArrays
#Create a tree from a nested array of values, with optional meta data and null flags.
Parameters:
| items (Array) | Jagged array of item values. |
| metas (MetaData[][] = null) | If specified, a 1:1 bijection of items containing meta data. |
| nulls (bool[][] = null) | If specified, a 1:1 bijection of items containing null flags. If the type constraint specifies a nullable type, the nulls array is always ignored."/> |
ITreeFromArrays
#Create a tree from a nested array of values, with optional meta data and null flags.
Parameters:
| paths (Paths) | A top-level bijection of the 'items' array specifying the path for each twig. It is possible to only specify a single path as well, in which case it will automatically be incremented for each required twig. |
| items (Array) | Jagged array of item values. |
| metas (MetaData[][] = null) | If specified, a 1:1 bijection of items containing meta data. |
| nulls (bool[][] = null) | If specified, a 1:1 bijection of items containing null flags. If the type constraint specifies a nullable type, the nulls array is always ignored."/> |
ITreeFromILeaves
#Recreate a tree from a collection of leaves.
Parameters:
| leaves (IEnumerable<ILeaf>) | Leaves for tree. |
ITreeFromIPears
#Create a tree with a single twig using a default path.
Parameters:
| pears (IEnumerable<IPear>) |
ITreeFromIPears
#Create a tree with a single twig using a custom path.
Parameters:
| path (Path) | |
| pears (IEnumerable<IPear>) |
ITreeFromITwigs
#Create a tree from a collection of twigs.
Parameters:
| twigs (IEnumerable<ITwig>) | Twig collection. |
ITreeFromITwigs
#Create a tree from a matching collection of paths and twigs.
Parameters:
| paths (Paths) | Path collection. |
| twigs (IEnumerable<ITwig>) | Twig collection. |
ITreeFromList
#public static ITree ITreeFromList(IEnumerable items, IEnumerable<MetaData> metas = null, IEnumerable<bool> nulls = null)
Create a tree with a single twig using a default path.
Parameters:
| items (IEnumerable) | |
| metas (IEnumerable<MetaData> = null) | |
| nulls (IEnumerable<bool> = null) |
ITwigFromList
#public static ITwig ITwigFromList(IEnumerable items, IEnumerable<MetaData> metas = null, IEnumerable<bool> nulls = null)
Create a twig based on a collection of values.
Parameters:
| items (IEnumerable) | |
| metas (IEnumerable<MetaData> = null) | |
| nulls (IEnumerable<bool> = null) |
ITwigFromOneValue
#Create a twig based on a single value. If the value provided implements IPear, it will be handled accordingly.
Parameters:
| item (object) |
ITwigNulls
#Create a twig of the given type containing the given amount of nulls.
MergeITrees
#Merge two or more trees of potentially different types.
Parameters:
| trees (params ITree[]) | Trees to merge. |
MergeTrees<T>
#Merge two or more trees of the same type.
Parameters:
| trees (params Tree<T>[]) | Trees to merge. |
PairWiseOp
#public static ITree PairWiseOp(ITree a, ITree b, Func<dynamic, dynamic, dynamic> process, CancellationToken token = default(CancellationToken))
Perform a regular (i.e. 'longest list') operation on all value pairs in two trees. This method returns the most constrained type of Tree<T>, regardless of the specific type on which this method was invoked.
Parameters:
| a (ITree) | First tree. |
| b (ITree) | Second tree. |
| process (Func<dynamic, dynamic, dynamic>) | Process method to apply to all pairs. |
| token (CancellationToken = null) | Cancellation token. |
Returns: Tree with combined and processed values.
PairWiseOp<TA, TB, TOut>
#public static Tree<TOut> PairWiseOp<TA, TB, TOut>(Tree<TA> a, Tree<TB> b, Func<TA, TB, TOut> process, CancellationToken token = default(CancellationToken))
Perform a regular (i.e. 'longest list') operation on all value pairs in two trees.
Parameters:
| a (Tree<TA>) | First tree. |
| b (Tree<TB>) | Second tree. |
| process (Func<TA, TB, TOut>) | Process method to apply to all pairs. |
| token (CancellationToken = null) | Cancellatio token for the process. |
Returns: Tree with combined and processed values.
Pear<T>
#Create a pear for a value with optional meta data.
Parameters:
| value (T) | |
| meta (MetaData = null) |
PearComparison
#Test two pears for equality.
PearEquality
#Test two pears for equality.
PearWiseOp
#public static ITree PearWiseOp(ITree tree, Func<IPear, IPear> process, CancellationToken token = default(CancellationToken))
Create a new tree by performing an operation on all the pairs on another tree.
Parameters:
| tree (ITree) | Tree to operate on. |
| process (Func<IPear, IPear>) | Operation. |
| token (CancellationToken = null) | Cancellation token. |
Returns: Tree with modified pears.
PearWiseOp<T>
#public static Tree<T> PearWiseOp<T>(Tree<T> tree, Func<Pear<T>, Pear<T>> process, CancellationToken token = default(CancellationToken))
Create a new tree by performing an operation on all the pairs on another tree.
Parameters:
| tree (Tree<T>) | Tree to operate on. |
| process (Func<Pear<T>, Pear<T>>) | Operation. |
| token (CancellationToken = null) | Cancellation token. |
Returns: Tree with modified pears.
ReadITwig
#Deserialise a twig.
Parameters:
| reader (IReader) | Reader object to deserialise from. |
Returns: Deserialised twig.
ReadPear<T>
#Deserialise a pear.
Parameters:
| reader (IReader) | Reader to deserialise from. |
Returns: Returns a pear on success, or null on failure.
ReadTwig<T>
#Deserialise a twig.
Parameters:
| reader (IReader) | Reader object to deserialise from. |
Returns: Deserialised twig.
RemoveMeta
#Remove all occurences of a collection of meta names from a tree.
Parameters:
| tree (ITree) | Tree to operate on. |
| names (params MetaName[]) | Meta names to remove. |
RemoveMeta<T>
#Remove all occurences of a specific meta value from a tree.
Parameters:
| tree (Tree<T>) | Tree to operate on. |
| names (params MetaName[]) | Meta names to remove. |
TreeFromArrays<T>
#Create a tree from a nested array of values, with optional meta data and null flags.
Parameters:
| paths (Paths) | A top-level bijection of the 'items' array specifying the path for each twig. It is possible to only specify a single path as well, in which case it will automatically be incremented for each required twig. |
| items (T[][]) | Jagged array of item values. |
| metas (MetaData[][] = null) | If specified, a 1:1 bijection of items containing meta data. |
| nulls (bool[][] = null) | If specified, a 1:1 bijection of items containing null flags. If the type constraint specifies a nullable type, the nulls array is always ignored."/> |
TreeFromArrays<T>
#Create a tree from a nested array of values, with optional meta data and null flags.
Parameters:
| items (T[][]) | Jagged array of item values. |
| metas (MetaData[][] = null) | If specified, a 1:1 bijection of items containing meta data. |
| nulls (bool[][] = null) | If specified, a 1:1 bijection of items containing null flags. If the type constraint specifies a nullable type, the nulls array is always ignored."/> |
TreeFromLeaves<T>
#Recreate a tree from a collection of leaves.
Parameters:
| leaves (IEnumerable<Leaf<T>>) | Leaves for tree. |
TreeFromList<T>
#public static Tree<T> TreeFromList<T>(IEnumerable<T> items, IEnumerable<MetaData> metas = null, IEnumerable<bool> nulls = null)
Create a tree with a single twig using a default path.
Parameters:
| items (IEnumerable<T>) | |
| metas (IEnumerable<MetaData> = null) | |
| nulls (IEnumerable<bool> = null) |
TreeFromList<T>
#public static Tree<T> TreeFromList<T>(Path path, IEnumerable<T> items, IEnumerable<MetaData> metas = null, IEnumerable<bool> nulls = null)
Create a tree with a single twig using a custom path.
Parameters:
| path (Path) | |
| items (IEnumerable<T>) | |
| metas (IEnumerable<MetaData> = null) | |
| nulls (IEnumerable<bool> = null) |
TreeFromPears<T>
#Createa tree with a single twig using a default path.
Parameters:
| pears (IEnumerable<Pear<T>>) |
TreeFromPears<T>
#Createa tree with a single twig using a custom path.
Parameters:
| path (Path) | |
| pears (IEnumerable<Pear<T>>) |
TreeFromTwigs<T>
#Create a tree from a collection of paths and twigs.
Parameters:
| paths (Paths) | |
| twigs (IEnumerable<Twig<T>>) |
TreeFromUnchecked<T>
#Create a tree from unchecked paths and twigs. Paths need not be sorted or unique. Twigs associated with identical paths will be merged.
Parameters:
| paths (IEnumerable<Path>) | |
| twigs (IEnumerable<Twig<T>>) |
TryCast<T>
#Attempt to cast an array of vague providence to a specific type. This will only work if the source array *is* of the correct type, or if all its elements are compatible with the target type.
Parameters:
| source (Array) | |
| target (out T[]) |
TryCast<T>
#Attempt to cast a twig of vague providence to a specific type. This will only work if the source twig *is* of the correct type, or if all its elements are compatible with the target type.
TryCreateDeepCopy
#Attempt to create a copy of a tree by duplicating all the values. Values which are value types or otherwise known to be immutable will not be copied. Copying to mutable reference types will occur via type assistants. There is no guarantee that duplication was successful in all cases.
Parameters:
| tree (ITree) |
Returns: A new tree with duplicated values.
TwigFromList<T>
#public static Twig<T> TwigFromList<T>(IEnumerable<T> items, IEnumerable<MetaData> metas = null, IEnumerable<bool> nulls = null)
Create a twig based on a collection of values.
Parameters:
| items (IEnumerable<T>) | |
| metas (IEnumerable<MetaData> = null) | |
| nulls (IEnumerable<bool> = null) |
TwigFromValues<T>
#Create a twig based on a collection of values. No meta data or nulls can be set.
Parameters:
| items (params T[]) |
TwigNulls<T>
#Create a twig which contains only null values.
Parameters:
| count (int) | Amount of nulls. |
Returns: Twig with only nulls.
WriteITree
#Serialise an ITree.
WriteITwig
#Serialise a twig.
WritePear
#Serialise a pear.
WriteTree<T>
#Serialise a Tree.
WriteTwig<T>
#Serialise a twig.