Saxonberg Server API
    Preparing search index...

    Path-keyed trie with exact lookup and glob walk.

    Paths are split on / into segments; each segment becomes a level. Multiple values may share a path (a Set<T> lives at each terminal node). On removal the trie prunes any node that becomes empty (no children, no values), so a balanced insert / remove pair leaves the trie identical to its never-inserted state.

    Glob walk delegates to PathPatternApi.compile so syntax stays consistent with the rest of the codebase. The walk is segment-aware where possible — ** segments enable a full subtree descent, while * and ? segments stay within one level — so the walker doesn't have to enumerate every leaf.

    Type Parameters

    • T
    Index

    Constructors

    Accessors

    Methods

    • Walk the trie and return every value at a path matching pattern. Pattern syntax matches PathPatternApi: *, **, ?.

      The walk avoids materializing the full path set — ** triggers a subtree descent, plain literal segments do an O(1) child lookup, and only * / ? segments fan out across siblings.

      Order of results is unspecified across siblings (Map iteration order is insertion order in practice, but callers should not rely on it).

      Parameters

      • pattern: string

      Returns T[]

    • Return the values stored at the longest path that is a prefix of path (segment-wise) and carries values — the nearest-ancestor (or exact) match. Walks segment-by-segment from the root, remembering the deepest node along the way that owns a value bucket. Returns [] when no ancestor-or-exact path has values.

      Reuses the same /-split segment discipline as the other walks — it introduces no parallel path syntax and carries no glob semantics (matching is exact-per-segment). O(depth) literal descent.

      Parameters

      • path: string

      Returns T[]

    • The path string of the longest value-carrying prefix of path, or null when none. Companion to longestPrefix for callers that need the matched prefix itself (e.g. provenance rendering).

      Parameters

      • path: string

      Returns string | null

    • Remove value from path. No-op if not present. Prunes empty branches so a never-inserted state is restored when the last value at a path is removed.

      Parameters

      • path: string
      • value: T

      Returns void