TreeStructures 1.3.0
See the version list below for details.
dotnet add package TreeStructures --version 1.3.0
NuGet\Install-Package TreeStructures -Version 1.3.0
<PackageReference Include="TreeStructures" Version="1.3.0" />
paket add TreeStructures --version 1.3.0
#r "nuget: TreeStructures, 1.3.0"
// Install TreeStructures as a Cake Addin #addin nuget:?package=TreeStructures&version=1.3.0 // Install TreeStructures as a Cake Tool #tool nuget:?package=TreeStructures&version=1.3.0
Introduction
This library provides a class for creating a tree structure that can be used by inheriting from it.
Features:
- Rich extension methods for
ITreeNode<TNode>
- Achieving mutual references between parent and child nodes
- Classes forming a tree structure and their extensibility
- Compatibility with other libraries 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 CompositeWrapper<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 Composite pattern, use (Composite | TreeNode) Wrapper<TSrc,TWrpr>
.
If you need a Wrapper that, in addition to its wrapper functionality, can temporarily pause/resume instance disposal and wrapping, as is the case with ViewModel in MVVM, use (Composite | TreeNode) Imitator<TSrc,TImtr>
.
Inherit and use each as needed.
Compatibility with Other Libraries
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.
CompositeWrapper<TSrc,TWrpr>
and its derived types allow customization only of the collection exposed externally.
Additionally, support is provided for extending ITreeNode<TNode>
methods to objects that do not implement ITreeNode<TNode>
.
This is achieved by wrapping objects in a CompositeWrapper<TSrc,TWrpr>
or CompositeImitator<TSrc,TImtr>
, 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.8 | 30 | 11/24/2024 |
1.7.7 | 30 | 11/24/2024 |
1.7.6 | 39 | 11/23/2024 |
1.7.5 | 46 | 11/22/2024 |
1.7.4 | 149 | 1/31/2024 |
1.7.3 | 105 | 1/31/2024 |
1.7.2 | 105 | 1/31/2024 |
1.7.1 | 106 | 1/31/2024 |
1.7.0 | 86 | 1/30/2024 |
1.6.3 | 109 | 1/21/2024 |
1.6.2 | 103 | 1/21/2024 |
1.6.1 | 108 | 1/21/2024 |
1.6.0 | 103 | 1/21/2024 |
1.5.0 | 107 | 1/18/2024 |
1.4.6 | 120 | 1/14/2024 |
1.4.5 | 109 | 1/14/2024 |
1.4.4 | 103 | 1/10/2024 |
1.4.3 | 101 | 1/10/2024 |
1.4.1 | 105 | 1/8/2024 |
1.4.0 | 97 | 1/6/2024 |
1.3.1 | 86 | 1/3/2024 |
1.3.0 | 112 | 1/2/2024 |
1.2.0 | 152 | 12/30/2023 |
1.1.1 | 111 | 12/26/2023 |
1.1.0 | 129 | 12/21/2023 |
1.0.1 | 130 | 12/16/2023 |
1.0.0 | 133 | 12/14/2023 |