Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Class StringTree

    A data structure representing a tree of string nodes with arbitrary object leaves.

    Hierarchy (View Summary)

    Index

    Accessors

    • get leaves(): symbol

      The key symbol that stores the leaves of any given node.

      Returns symbol

    Methods

    • Insert an entry into the tree.

      Parameters

      • strings: string[]

        The string parents for the entry.

      • entry: any

        The entry to store.

      Returns any

      The node the entry was added to.

    • Traverse the tree along the given string path and return any entries reachable from the node.

      Parameters

      • strings: string[]

        The string path to the desired node.

      • Optionaloptions: { filterEntries?: StringTreeEntryFilter; limit?: number } = {}
        • OptionalfilterEntries?: StringTreeEntryFilter

          A filter function to apply to each candidate entry.

        • Optionallimit?: number

          The maximum number of items to retrieve.

      Returns any[]

    • Returns the node at the given path through the tree.

      Parameters

      • strings: string[]

        The string path to the desired node.

      • Optionaloptions: { hasLeaves?: boolean } = {}
        • OptionalhasLeaves?: boolean

          Only return the most recently visited node that has leaves, otherwise return the exact node at the prefix, if it exists.

      Returns any

    • Protected

      Perform a breadth-first search starting from the given node and retrieving any entries reachable from that node, until we reach the limit.

      Parameters

      • node: any

        The starting node.

      • entries: any[]

        The accumulated entries.

      • queue: any[]

        The working queue of nodes to search.

      • Optionaloptions: { filterEntries?: StringTreeEntryFilter; limit?: number } = {}
        • OptionalfilterEntries?: StringTreeEntryFilter

          A filter function to apply to each candidate entry.

        • Optionallimit?: number

          The maximum number of entries to retrieve before stopping.

      Returns void