TreeStructures 1.4.6
See the version list below for details.
dotnet add package TreeStructures --version 1.4.6
NuGet\Install-Package TreeStructures -Version 1.4.6
<PackageReference Include="TreeStructures" Version="1.4.6" />
paket add TreeStructures --version 1.4.6
#r "nuget: TreeStructures, 1.4.6"
// Install TreeStructures as a Cake Addin #addin nuget:?package=TreeStructures&version=1.4.6 // Install TreeStructures as a Cake Tool #tool nuget:?package=TreeStructures&version=1.4.6
Introduction
This is a C# library designed for effectively handling tree structures.
Emphasizing flexibility and extensibility, the library allows easy manipulation of various tree structures.
Features:
- Rich extension methods for
ITreeNode<TNode>
- Achieving mutual references between parent and child nodes
- Classes forming a tree structure and their Generality
- Bidirectional Conversion between Different Data Structures and Tree Structures.
These are the four main features of the library.
Namespaces Classification
TreeStructures;
Abstract classes define generic tree nodes, peripheral objects, and event arguments.
Inheritance diagram of generic tree nodes
Inheritance diagram of NodePath and NodeIndex (peripheral objects)
TreeStructures.Linq;
Extension methods for ITreeNode<TNode>
, IMutableTreeNode<TNode>
, IEnumerable<T>
TreeStructures.Utility;
Definition of ResultWithValue<T>
used as a return value for Try●● methods
TreeStructures.Collections;
Collections used in internal implementations and processing of extension methods
TreeStructures.EventManagement;
Objects used in event handling, implementing Observable tree nodes
TreeStructures.Xml.Serialization;
Dictionary and others used in serialization and deserialization
TreeStrucutures.Tree;
Purpose-specific trees
Usage
To be documented in the wiki.
Concept
This library does not aim to be standalone.
Various useful libraries are already available, so we aim to handle tree structure-related functions while coexisting with other libraries.
Let's elaborate on the four features mentioned at the beginning.
Rich Extension Methods
Over 60 extension methods for ITreeNode<TNode>
are defined, including various overloads.
Examples include:
Enumeration: Preorder
, Levelorder
, all traversal methods, Leafs
, Ancestors
, DiscendArrivals
, DescendTraces
, etc.
Navigation: Root
, NextSibling
, LastSibling
, etc.
Editing: Including TryAddChild
, Try●●Child, Disassemble
, RemoveAllDescendant
, etc.
Parameter Retrieval: NodeIndex
, NodePath
, Height
, Depth
, etc.
Predicate Methods: IsDescendantOf
, IsAncestorOf
, IsRoot
, etc.
Conversion: ToNodeMap
, ToSerializableNodeMap
, ToTreeDiagram
, AsValuedTreeNode
Assembly Methods: Convert
, AssembleTree
, AssembleAsNAryTree
Mutual References Between Parent and Child Nodes
Mutual references between parent and child nodes are handled by base classes (TreeNodeBase<TNode>
or HierarchyWrapper<TSrc,TWrpr>
).
In the derived types of TreeNodeBase<TNode>
, customization can be achieved through protected virtual methods such as RemoveChildProcess
and InsertChildProcess
, which are defined as ●●ChildProcess
methods.
Classes Forming a Tree Structure and Their Generality
If you want to customize in detail, use TreeNodeBase<TNode>
.
For a GeneralTree, if you want to use it as a data structure or container for data, use GeneralTreeNode<TNode>
or ObservableTreeNode<TNode>
.
If you want to use an N-Ary Tree with a fixed number of branches and empty nodes set to null, use NAryTreeNode<TNode>
.
If you want to use it as a wrapper for objects or tree structure that forms the hierarchy, use (Hierarchy | TreeNode) Wrapper<TSrc,TWrpr>
.
If you need to handle resource disposal and observation, along with its role as a wrapper (e.g., ViewModel in MVVM), inherit and use Bindable(Hierarchy | TreeNode)Wrapper<TSrc,TWrpr>
.
In TreeNodeBase<TNode>
and its derived types, you can customize the collections used internally and those exposed externally by overriding the Setup(Inner | Public)ChildCollection
methods.
HierarchyWrapper<TSrc,TWrpr>
and its derived types allow customization only of the collection exposed externally.
Bidirectional Conversion between Different Data Structures and Tree Structures.
Support is provided for exte ITreeNode<TNode>
methods to objects that do not implement ITreeNode<TNode>
.
This is achieved by wrapping objects in a HierarchyWrapper<TSrc,TWrpr>
or BindableHierarchyWrapper<TSrc,TWrpr>
, or by calling AsValuedTreeNode
to provide the extension methods of ITreeNode<TNode>
.
Furthermore, various methods for mutual conversion, such as Convert
, AssembleTree
, and ToNodeMap
, are available through extension methods.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.7.4 | 146 | 1/31/2024 |
1.7.3 | 101 | 1/31/2024 |
1.7.2 | 103 | 1/31/2024 |
1.7.1 | 104 | 1/31/2024 |
1.7.0 | 84 | 1/30/2024 |
1.6.3 | 107 | 1/21/2024 |
1.6.2 | 101 | 1/21/2024 |
1.6.1 | 106 | 1/21/2024 |
1.6.0 | 101 | 1/21/2024 |
1.5.0 | 105 | 1/18/2024 |
1.4.6 | 118 | 1/14/2024 |
1.4.5 | 107 | 1/14/2024 |
1.4.4 | 101 | 1/10/2024 |
1.4.3 | 99 | 1/10/2024 |
1.4.1 | 103 | 1/8/2024 |
1.4.0 | 95 | 1/6/2024 |
1.3.1 | 84 | 1/3/2024 |
1.3.0 | 110 | 1/2/2024 |
1.2.0 | 150 | 12/30/2023 |
1.1.1 | 109 | 12/26/2023 |
1.1.0 | 127 | 12/21/2023 |
1.0.1 | 128 | 12/16/2023 |
1.0.0 | 129 | 12/14/2023 |