C# Class Lucene.Net.Util.Automaton.AutomatonTestUtil

Utilities for testing automata.

Capable of generating random regular expressions, and automata, and also provides a number of very basic unoptimized implementations (*slow) for testing.

Datei anzeigen Open project: apache/lucenenet Class Usage Examples

Public Methods

Method Description
AssertNoDetachedStates ( Automaton a ) : void

Checks that an automaton has no detached states that are unreachable from the initial state.

DeterminizeSimple ( Automaton a ) : void

Simple, original brics implementation of determinize()

DeterminizeSimple ( Automaton a, ISet initialset ) : void

Simple, original brics implementation of determinize() Determinizes the given automaton using the given set of initial states.

IsFiniteSlow ( Automaton a ) : bool

Returns true if the language of this automaton is finite.

WARNING: this method is slow, it will blow up if the automaton is large. this is only used to test the correctness of our faster implementation.

MinimizeSimple ( Automaton a ) : void

Simple, original brics implementation of Brzozowski minimize()

RandomAutomaton ( Random random ) : Automaton

return a random NFA/DFA for testing

RandomRegexp ( Random r ) : string

Returns random string, including full unicode range.

Private Methods

Method Description
GetRandomCodePoint ( Random r, Transition t ) : int

picks a random int code point, avoiding surrogates; throws IllegalArgumentException if this transition only accepts surrogates

IsFiniteSlow ( State s, HashSet path ) : bool

Checks whether there is a loop containing s. (this is sufficient since there are never transitions to dead states.)

RandomRegexpString ( Random r ) : string

Method Details

AssertNoDetachedStates() public static method

Checks that an automaton has no detached states that are unreachable from the initial state.
public static AssertNoDetachedStates ( Automaton a ) : void
a Automaton
return void

DeterminizeSimple() public static method

Simple, original brics implementation of determinize()
public static DeterminizeSimple ( Automaton a ) : void
a Automaton
return void

DeterminizeSimple() public static method

Simple, original brics implementation of determinize() Determinizes the given automaton using the given set of initial states.
public static DeterminizeSimple ( Automaton a, ISet initialset ) : void
a Automaton
initialset ISet
return void

IsFiniteSlow() public static method

Returns true if the language of this automaton is finite.

WARNING: this method is slow, it will blow up if the automaton is large. this is only used to test the correctness of our faster implementation.

public static IsFiniteSlow ( Automaton a ) : bool
a Automaton
return bool

MinimizeSimple() public static method

Simple, original brics implementation of Brzozowski minimize()
public static MinimizeSimple ( Automaton a ) : void
a Automaton
return void

RandomAutomaton() public static method

return a random NFA/DFA for testing
public static RandomAutomaton ( Random random ) : Automaton
random System.Random
return Automaton

RandomRegexp() public static method

Returns random string, including full unicode range.
public static RandomRegexp ( Random r ) : string
r System.Random
return string