Pf::UPath32
Inherits Enumerable / Struct / Value / Object
An immutable vector of UInt32s (here called indices) with tree path-
specific optimizations.
path = Pf::UPath32[100, 20]
path.append(3) # => UPath32[100, 20, 3]
path.append(7) # => UPath32[100, 20, 7]
path # => UPath32[100, 20]
Constructors
Instance methods
Inserts step at the back of this path. Returns the modified copy.
Returns true if the underlying representation of this path is dense.
As an optimization, we store small paths inline, packing them in 57 bits plus 4-bit size.
The shape of the "path gamut" for this representation is currently 14-9-8-6-4-4-4-4.
Paths that are outside of this "gamut" are transferred to (or constructed on)
the GC heap (sparse?).
- The first index receives a larger number of bits, because indices near the root are usually large.
- Successive indices receive a smaller number of bits, because nodes closer to the root are expected to be large, but smaller than their predecessor.
Returns true if this path is the sentinel End path.
Sentinel End marker useful in traversals that must distinguish entering
the root from reentering it at the end of traversal.
Returns true if the underlying representation of this path is an index.
Index optimizes singleton UPath32's, which can be encountered when one uses
UPath32 as an index, or when it happens to be used as one (e.g. skipping over
root terms during DFS or BFS).
Returns the part of this path before the last index. If this path is empty, returns an empty path.
Returns the number of indices in this path as an index within zero
or positive Int32 bounds.
Returns true if the underlying representation of this path is sparse.
Sparse paths are stored on the GC heap.