Exemple #1
0
 /// <summary>
 /// Calculate perfect hash for a given input sequence of bytes. The perfect hash requires
 /// that <see cref="FSA"/> is built with <see cref="FSAFlags.Numbers"/> and corresponds to the sequential
 /// order of input sequences used at automaton construction time.
 /// </summary>
 /// <param name="sequence">The byte sequence to calculate perfect hash for.</param>
 /// <returns>
 /// Returns a unique integer assigned to the input sequence in the automaton (reflecting
 /// the number of that sequence in the input used to build the automaton). Returns a negative
 /// integer if the input sequence was not part of the input from which the automaton was created.
 /// The type of mismatch is a constant defined in <see cref="MatchResult"/>.
 /// </returns>
 /// <seealso cref="PerfectHash(byte[], int, int, int)"/>
 public int PerfectHash(byte[] sequence)
 {
     return(PerfectHash(sequence, 0, sequence.Length, fsa.GetRootNode()));
 }
Exemple #2
0
 /// <summary>
 /// Create an instance of the enumerator iterating over all automaton sequences.
 /// </summary>
 /// <param name="fsa">The automaton to iterate over.</param>
 public ByteSequenceEnumerator(FSA fsa)
     : this(fsa, fsa.GetRootNode())
 {
 }