HierarchyProvider<TNode> Interface

    Package: @esfx/iter-hierarchy

    Describes an object that defines the relationships between parents and children of an element.

    Declaration
    export interface HierarchyProvider<TNode> 

    Methods

    children(element)

    Gets the children elements for the supplied element.

    Declaration
    children(element: TNode): Iterable<TNode> | undefined;
    Parameters
    element
    TNode

    Returns
    Iterable<TNode> | undefined

    firstChild(element)

    (Optional) Gets the first child of an element.

    NOTE: A HierarchyProvider should implement this to improve the performance of the following query operator on hierarchies.

    Declaration
    firstChild?(element: TNode): TNode | undefined;
    Parameters
    element
    TNode

    Returns
    TNode | undefined

    lastChild(element)

    (Optional) Gets the last child of an element.

    NOTE: A HierarchyProvider should implement this to improve the performance of the preceding query operator on hierarchies.

    Declaration
    lastChild?(element: TNode): TNode | undefined;
    Parameters
    element
    TNode

    Returns
    TNode | undefined

    nextSibling(element)

    (Optional) Gets the next sibling of an element.

    NOTE: A HierarchyProvider should implement this to improve the performance of the following and followingSiblings query operators on hierarchies.

    Declaration
    nextSibling?(element: TNode): TNode;
    Parameters
    element
    TNode

    Returns
    TNode

    owns(element)

    (Optional) Indicates whether the supplied element is contained within a hierarchy.

    Declaration
    owns?(element: TNode): boolean;
    Parameters
    element
    TNode

    Returns
    boolean

    parent(element)

    Gets the parent element for the supplied element.

    Declaration
    parent(element: TNode): TNode | undefined;
    Parameters
    element
    TNode

    Returns
    TNode | undefined

    previousSibling(element)

    (Optional) Gets the previous sibling of an element.

    NOTE: A HierarchyProvider should implement this to improve the performance of the preceding and precedingSiblings query operators on hierarchies.

    Declaration
    previousSibling?(element: TNode): TNode;
    Parameters
    element
    TNode

    Returns
    TNode

    provider(element)

    (Optional) If this provider is composed from multiple providers, finds the underlying provider for an element.

    Declaration
    provider?(element: TNode): HierarchyProvider<TNode> | undefined;
    Parameters
    element
    TNode

    Returns
    HierarchyProvider<TNode> | undefined

    providers()

    (Optional) If this provider is composed from multiple providers, returns an iterable of each underlying provider.

    Declaration
    providers?(): IterableIterator<HierarchyProvider<TNode>>;
    Returns
    IterableIterator<HierarchyProvider<TNode>>

    root(element)

    (Optional) Gets the root node for an element.

    NOTE: A HierarchyProvider should implement this to improve the performance of the root query operator on hierarchies.

    Declaration
    root?(element: TNode): TNode;
    Parameters
    element
    TNode

    Returns
    TNode

    Generated by DocFX