morfologik.fsa.bytes
Class FSABuilder

java.lang.Object
  extended by morfologik.fsa.bytes.FSABuilder

public class FSABuilder
extends Object

Automaton builder that uses bytes to label transitions.


Field Summary
static Comparator<byte[]> LEXICAL_ORDERING
          Comparator comparing full byte arrays.
 
Constructor Summary
FSABuilder()
           
 
Method Summary
 void add(byte[] current, int length)
          Add another byte sequence to this automaton.
static State build(byte[][] input)
          Build a minimal, deterministic automaton from a sorted list of byte sequences.
static State build(Iterable<byte[]> input)
          Build a minimal, deterministic automaton from an iterable list of byte sequences.
static int compare(byte[] s1, int lens1, byte[] s2, int lens2)
          Lexicographic order of input sequences.
 State complete()
          Finalize the automaton and return the root state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEXICAL_ORDERING

public static final Comparator<byte[]> LEXICAL_ORDERING
Comparator comparing full byte arrays.

Constructor Detail

FSABuilder

public FSABuilder()
Method Detail

compare

public static int compare(byte[] s1,
                          int lens1,
                          byte[] s2,
                          int lens2)
Lexicographic order of input sequences.


add

public void add(byte[] current,
                int length)
Add another byte sequence to this automaton. The sequence must be lexicographically larger or equal compared to any previous sequences added to this automaton (the input must be sorted).


complete

public State complete()
Finalize the automaton and return the root state. No more strings can be added to the builder after this call.

Returns:
Root automaton state.

build

public static State build(byte[][] input)
Build a minimal, deterministic automaton from a sorted list of byte sequences.


build

public static State build(Iterable<byte[]> input)
Build a minimal, deterministic automaton from an iterable list of byte sequences.



Copyright © 2010. All Rights Reserved.