Interface ITreeRedbObject

Assembly: redb.Core.dll

Interface for REDB tree objects with navigational properties
Extends IRedbObject adding tree navigation capabilities in memory
Supports polymorphic trees (objects of different schemes in one tree)

public interface ITreeRedbObject : IRedbObject

Properties

Ancestors

Gets all node ancestors (from parent to root)

IEnumerable<ITreeRedbObject> Ancestors { get; }

Children

Collection of child objects (filled when loading tree)

ICollection<ITreeRedbObject> Children { get; set; }

Descendants

Gets all node descendants recursively

IEnumerable<ITreeRedbObject> Descendants { get; }

IsLeaf

Checks if node is leaf (has no children)

bool IsLeaf { get; }

Level

Gets node level in tree (0 for root)

int Level { get; }

MaxDepth

Gets maximum depth of subtree from current node

int MaxDepth { get; }

Parent

Reference to parent object (filled when loading tree)

ITreeRedbObject? Parent { get; set; }

SubtreeSize

Gets number of nodes in subtree (including current)

int SubtreeSize { get; }

Methods

GetBreadcrumbs(string, bool)

Gets breadcrumbs for navigation

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

GetPathIds()

Gets path from root to current node as sequence of IDs

IEnumerable<long> GetPathIds()

GetSubtree()

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

IEnumerable<ITreeRedbObject> GetSubtree()

IsAncestorOf(ITreeRedbObject)

Checks if current node is ancestor of specified node

bool IsAncestorOf(ITreeRedbObject descendant)

IsDescendantOf(ITreeRedbObject)

Checks if current node is descendant of specified node

bool IsDescendantOf(ITreeRedbObject ancestor)