PathTrie
Implementation of a mutable path multimap as a trie. Held values are of type T.
Each node of the trie represents a path fragment. As such, a path can be represented by navigating through the trie's nodes. Each node contains the values associated with the path they represent.
A trie is a good structure to implement a path multimap due to the intended semantics of the get(path) and remove(path) functions: the get function should return all values matching a given path, whilst the remove function removes values contained by a given path (following the matching and containment semantics of paths).
As an example, imagine the following operations on the trie (with simplified notation for the paths):
trie["/"] = 0
trie["/path/x"] = 1
trie["/path/y"] = 2
trie["/path/x/z"] = 3
trie["/∗/path"] = 4
trie["/∗/path"] = 5The resulting structure would look similar to the following, where the right side represents the values associated with each trie node:
/ -> [0]
├─ path -> []
│ ├─ x -> [1]
│ │ └─ z -> [3]
│ └─ y -> [2]
└─ ∗ -> []
└─ path -> [4, 5]Getting values associated with the path "/∗/∗" would return a sequence with values [1, 2, 4, 5].
Constructors
Properties
Functions
Returns whether there exists at least one value equal to value in the multimap. Equivalent to containsValue(value).
Returns whether there exists an entry identified by entryId in the multimap. Equivalent to containsEntry(entryId).
Returns whether there exists at least one entry with a path matching path (following the semantics of path matching). Equivalent to containsPath(path).
Returns whether there exists an entry identified by entryId in the multimap.
Returns whether there exists at least one entry with a path matching path (following the semantics of path matching).
Returns whether there exists at least one entry with a path matching path (following the semantics of path matching).
Returns whether there exists at least one value equal to value in the multimap.
Returns a sequence over all entries with a path matching path (following the semantics of path matching).
Returns a sequence over all entries with a path matching path (following the semantics of path matching).
Returns the entry identified by entryId or null when no such entry exists. Equivalent to getEntry(entryId).
Returns a sequence over all values with a path matching path (following the semantics of path matching).
Returns a sequence over all values with a path matching path (following the semantics of path matching).
Returns the entry identified by entryId or null when no such entry exists.
Inserts all entries of pathMultimap into this multimap and returns a list with the identifiers of each inserted entry.
Removes all entries with a path contained by path (following the semantics of path containment) and returns a list of said entries.
Removes all entries with a path contained by path (following the semantics of path containment) and returns a list of said entries.
Removes the entry identified by entryId and returns it or null when no such entry exists.
Transforms the multimap into a mapping of paths to lists of values associated with them.