collect-your-stuff
    Preparing search index...

    Class TreeLinker

    TreeLinker represents a node in a LinkedTreeList having a parent (or root) and child nodes.

    Implements

    Index
    • Create the new TreeLinker instance, provide the data and optionally set references for next, prev, parent, or children.

      Parameters

      • settings: {
            children?: any[];
            data?: any;
            listClass?: any;
            next?: IsTreeNode;
            parent?: IsTreeNode;
            prev?: IsTreeNode;
        } = {}

        The settings for the new tree node.

        • Optionalchildren?: any[]

          The references to child linkers if any

        • Optionaldata?: any

          The data to be stored in this tree node

        • OptionallistClass?: any
        • Optionalnext?: IsTreeNode

          The reference to the next linker if any

        • Optionalparent?: IsTreeNode

          The reference to a parent linker if any

        • Optionalprev?: IsTreeNode

          The reference to the previous linker if any

      Returns TreeLinker

    children: IsArrayable<IsTreeNode> = null

    The list of the children of this node, or null when it has none.

    classType: typeof TreeLinker = TreeLinker

    The class used to create this instance, so that it can be recognized as valid without an instanceof check.

    data: any = null

    The data stored in this tree node.

    next: IsTreeNode = null

    The sibling after this node, or null when this is the last child.

    parent: IsTreeNode = null

    The node this node is a child of, or null for a root node.

    prev: IsTreeNode = null

    The sibling before this node, or null when this is the first child.

    • Create the children for this tree from an array. Each child becomes a tree linker with this node as its parent: an existing linker is kept as it is, an object with a data property gives the settings of the linker, and anything else is the data of the linker.

      Parameters

      • children: any[] = null

        Provide an array of data / linker references to be children of this tree node.

      • listClass: any = LinkedTreeList

        Give the type of list to use for storing the children

      Returns any

    • Convert an array into DoubleLinker instances, return the head and tail DoubleLinkers.

      Parameters

      • values: any[] = []

        Provide an array of data that will be converted to a chain of tree-linkers.

      • classType: any = TreeLinker

        Provide the type of IsTreeNode to use.

      Returns { head: any; tail: any }

    • Make a new DoubleLinker from the data given if it is not already a valid Linker.

      Parameters

      • linker: any

        Return a valid TreeLinker instance from given data, or even an already valid one.

      • classType: any = TreeLinker

        Provide the type of IsTreeNode to use.

      Returns any