Class BaseTreeNode<T, TN>
A class holding a typed TreeNode implementation
Inherited Members
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
public abstract class BaseTreeNode<T, TN> : BaseHasChildren<TN>, ITreeNode<T, TN>, ITreeNode<T>, ITreeNode, IHasChildren<TN>, IHasChildren where TN : BaseTreeNode<T, TN>
Type Parameters
Name | Description |
---|---|
T | The type of item associated with each node |
TN | The type of the node itself, must inherit BaseTreeNode<T, TN> |
Constructors
BaseTreeNode(Func<TN, int>, T)
Creates a new treenode with the associated item. Also includes a function for determining the order child treenodes are enumerated in
Declaration
protected BaseTreeNode(Func<TN, int> getOrder, T item)
Parameters
Type | Name | Description |
---|---|---|
Func<TN, int> | getOrder | A function that returns an order for a given child treenode |
T | item | The item for this treenode |
BaseTreeNode(Func<TN, int>, T, TN)
Creates a new treenode with the specified parent
. Also includes a function for determining the
order child treenodes are enumerated in
Declaration
protected BaseTreeNode(Func<TN, int> getOrder, T item, TN parent)
Parameters
Type | Name | Description |
---|---|---|
Func<TN, int> | getOrder | A function that returns an order for a given child treenode |
T | item | The item for this treenode |
TN | parent | The parent treenode of this one |
BaseTreeNode(T)
Creates a new treenode with the associated item
Declaration
protected BaseTreeNode(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item for this treenode |
BaseTreeNode(T, TN)
Creates a new treenode with the specified parent
treenode, and associated item
Declaration
protected BaseTreeNode(T item, TN parent)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item for this treenode |
TN | parent | The parent treenode of this one |
Properties
Item
The item associated with this treenode
Declaration
public T Item { get; }
Property Value
Type | Description |
---|---|
T |
Methods
AddChild(T)
Creates a new treenode to wrap the specified item and adds it as a child to this treenode
Declaration
public TN AddChild(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to create a treenode for and add as a child to this treenode |
Returns
Type | Description |
---|---|
TN | The newly created treenode that has this treenode as a parent |
CreateNewItem(T, TN)
Used to create a new instance of this treenode type
Declaration
protected abstract TN CreateNewItem(T item, TN parent)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to be wrapped in a treenode |
TN | parent | Any parent treenode for this item |
Returns
Type | Description |
---|---|
TN | A new treenode with the specified |