public final class FSATraversal extends Object
Constructor and Description |
---|
FSATraversal(FSA fsa)
Traversals of the given FSA.
|
Modifier and Type | Method and Description |
---|---|
MatchResult |
match(byte[] sequence) |
MatchResult |
match(byte[] sequence,
int node) |
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 . |
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. |
int |
perfectHash(byte[] sequence) |
int |
perfectHash(byte[] sequence,
int start,
int length,
int node)
Calculate perfect hash for a given input sequence of bytes.
|
public FSATraversal(FSA fsa)
fsa
- The target automaton for traversals.public int perfectHash(byte[] sequence, int start, int length, int node)
FSA
is built with FSAFlags.NUMBERS
and corresponds to the sequential
order of input sequences used at automaton construction time.sequence
- The byte sequence to calculate perfect hash for.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.MatchResult
.public int perfectHash(byte[] sequence)
sequence
- The byte sequence to calculate perfect hash for.MatchResult
.perfectHash(byte[], int, int, int)
public MatchResult match(MatchResult reuse, byte[] sequence, int start, int length, int node)
match(byte[], int, int, int)
, but allows passing
a reusable MatchResult
object so that no intermediate garbage is
produced.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.reuse
, but with updated match MatchResult.kind
and other relevant fields.public MatchResult match(byte[] sequence, int start, int length, int node)
sequence
and starting at node node
.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.MatchResult
with updated match MatchResult.kind
.match(byte [], int)
public MatchResult match(byte[] sequence, int node)
sequence
- Input sequence to look for in the automaton.node
- The node to start traversal from, typically the root node.MatchResult
with updated match MatchResult.kind
.match(byte [], int)
public MatchResult match(byte[] sequence)
sequence
- Input sequence to look for in the automaton.MatchResult
with updated match MatchResult.kind
.match(byte [], int)
Copyright © 2016. All rights reserved.