Class TreeRedbObject

Assembly: redb.Core.dll

Base class for REDB tree objects with hierarchy navigation
Supports polymorphic trees - objects of different schemes in one tree
Extends RedbObject by adding navigational properties and traversal methods

public class TreeRedbObject : RedbObject, ITreeRedbObject, IRedbObject

Inheritance

ObjectRedbObjectTreeRedbObject

Implements

Derived

Inherited Members

Properties

Ancestors

Gets all node ancestors (from parent to root)

public IEnumerable<ITreeRedbObject> Ancestors { get; }

Children

Collection of child objects (filled when loading tree)

public ICollection<ITreeRedbObject> Children { get; set; }

Descendants

Gets all node descendants recursively

public IEnumerable<ITreeRedbObject> Descendants { get; }

IsLeaf

Checks if node is leaf (has no children)

public bool IsLeaf { get; }

Level

Gets node level in tree (0 for root)

public int Level { get; }

MaxDepth

Gets maximum depth of subtree from current node

public int MaxDepth { get; }

Parent

Reference to parent object (filled when loading tree)

public ITreeRedbObject? Parent { get; set; }

SubtreeSize

Gets number of nodes in subtree (including current)

public int SubtreeSize { get; }

Methods

ComputeHash()

Get MD5 hash from object values without modifying hash field

public override Guid ComputeHash()

GetBreadcrumbs(string, bool)

Gets breadcrumbs for navigation

public string GetBreadcrumbs(string separator = " > ", bool includeIds = false)

GetPathIds()

Gets path from root to current node as IDs

public IEnumerable<long> GetPathIds()

GetSubtree()

Gets all subtree nodes (including current) in depth-first order

public IEnumerable<ITreeRedbObject> GetSubtree()

IsAncestorOf(ITreeRedbObject)

Checks if current node is ancestor of specified node

public bool IsAncestorOf(ITreeRedbObject descendant)

IsDescendantOf(ITreeRedbObject)

Checks if current node is descendant of specified node

public bool IsDescendantOf(ITreeRedbObject ancestor)

RecomputeHash()

Recompute MD5 hash from object values and store in hash field

public override void RecomputeHash()