Class FSTTraversal


  • public final class FSTTraversal
    extends Object
    This class implements some common matching and scanning operations on a generic FST.
    • Constructor Detail

      • FSTTraversal

        public FSTTraversal​(FST fst)
        Traversals of the given FST.
        Parameters:
        fst - The target automaton for traversals.
    • Method Detail

      • match

        public MatchResult match​(MatchResult reuse,
                                 byte[] sequence,
                                 int start,
                                 int length,
                                 int node)
        Same as match(byte[], int, int, int), but allows passing a reusable MatchResult object so that no intermediate garbage is produced.
        Parameters:
        reuse - The MatchResult to reuse.
        sequence - Input sequence to look for in the automaton.
        start - Start index in the sequence array.
        length - Length of the byte sequence, must be at least 1.
        node - The node to start traversal from, typically the root node.
        Returns:
        The same object as reuse, but with updated match MatchResult._kind and other relevant fields.
      • match

        public MatchResult match​(byte[] sequence,
                                 int start,
                                 int length,
                                 int node)
        Finds a matching path in the dictionary for a given sequence of labels from sequence and starting at node node.
        Parameters:
        sequence - Input sequence to look for in the automaton.
        start - Start index in the sequence array.
        length - Length of the byte sequence, must be at least 1.
        node - The node to start traversal from, typically the root node.
        Returns:
        MatchResult with updated match MatchResult._kind.
      • match

        public MatchResult match​(byte[] sequence,
                                 int node)
        Parameters:
        sequence - Input sequence to look for in the automaton.
        node - The node to start traversal from, typically the root node.
        Returns:
        MatchResult with updated match MatchResult._kind.