Arc

class Arc<T>

Represents a single arc.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var arcIdx: Int
Link copied to clipboard

Start position in the FST.BytesReader of the presence bits for a direct addressing node, aka the bit-table

Link copied to clipboard
Link copied to clipboard

First label of a direct addressing node.

Link copied to clipboard
var flags: Byte
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var label: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var output: T?
Link copied to clipboard
Link copied to clipboard

Index of the current label of a direct addressing node. While .arcIdx is the current index in the label range, .presenceIndex is its corresponding index in the list of actually present labels. It is equal to the number of bits set before the bit at .arcIdx in the bit-table. This field is a cache to avoid to count bits set repeatedly when iterating the next arcs.

Link copied to clipboard

Functions

Link copied to clipboard
fun arcIdx(): Int

Where we are in the array; only valid if bytesPerArc != 0.

Link copied to clipboard

Non-zero if this arc is part of a node with fixed length arcs, which means all arcs for the node are encoded with a fixed number of bytes so that we binary search or direct address. We do when there are enough arcs leaving one node. It wastes some bytes but gives faster lookups.

Link copied to clipboard
fun copyFrom(other: FST.Arc<T>): FST.Arc<T>

Returns this

Link copied to clipboard

First label of a direct addressing node. Only valid if nodeFlags == .ARCS_FOR_DIRECT_ADDRESSING or .ARCS_FOR_CONTINUOUS.

Link copied to clipboard
fun flag(flag: Int): Boolean
Link copied to clipboard
fun flags(): Byte
Link copied to clipboard
fun label(): Int
Link copied to clipboard
fun nextArc(): Long

Address (into the byte[]) of the next arc - only for list of variable length arc. Or ord/address to the next node if label == .END_LABEL.

Link copied to clipboard
Link copied to clipboard

Node header flags. Only meaningful to check if the value is either .ARCS_FOR_BINARY_SEARCH or .ARCS_FOR_DIRECT_ADDRESSING or .ARCS_FOR_CONTINUOUS (other value when bytesPerArc == 0).

Link copied to clipboard
fun numArcs(): Int

How many arcs; only valid if bytesPerArc != 0 (fixed length arcs). For a node designed for binary search this is the array size. For a node designed for direct addressing, this is the label range.

Link copied to clipboard
fun output(): T?
Link copied to clipboard

Where the first arc in the array starts; only valid if bytesPerArc != 0

Link copied to clipboard
fun target(): Long

Ord/address to target node.

Link copied to clipboard
open override fun toString(): String