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

Finite-state automaton with regular expression operations.

Class invariants:

  • An automaton is either represented explicitly (with State and Transition objects) or with a singleton string (see #getSingleton() and #expandSingleton()) in case the automaton is known to accept exactly one string. (Implicitly, all states and transitions of an automaton are reachable from its initial state.)
  • Automata are always reduced (see #reduce()) and have no transitions to dead states (see #removeDeadTransitions()).
  • If an automaton is nondeterministic, then #isDeterministic() returns false (but the converse is not required).
  • Automata provided as input to operations are generally assumed to be disjoint.

If the states or transitions are manipulated manually, the #restoreInvariant() and #setDeterministic(boolean) methods should be used afterwards to restore representation invariants that are assumed by the built-in automata operations.

Note: this class has internal mutable state and is not thread safe. It is the caller's responsibility to ensure any necessary synchronization if you wish to use the same Automaton from multiple threads. In general it is instead recommended to use a RunAutomaton for multithreaded matching: it is immutable, thread safe, and much faster.

@lucene.experimental
Inheritance: ICloneable
ファイルを表示 Open project: paulirwin/lucene.net Class Usage Examples

Private Properties

Property Type Description
CheckMinimizeAlways void
CloneExpandedIfRequired Automaton
CloneIfRequired Automaton
Totalize void

Public Methods

Method Description
Automaton ( ) : Lucene.Net.Support
Automaton ( State initial ) : Lucene.Net.Support

Constructs a new automaton that accepts the empty language. Using this constructor, automata can be constructed manually from State and Transition objects.

ClearNumberedStates ( ) : void
Clone ( ) : object

Returns a clone of this automaton.

CloneExpanded ( ) : Automaton

Returns a clone of this automaton, expands if singleton.

Complement ( ) : Automaton

See BasicOperations#complement(Automaton).

Concatenate ( Automaton a ) : Automaton

See BasicOperations#concatenate(Automaton, Automaton).

Concatenate ( IList l ) : Automaton

See BasicOperations#concatenate(List).

Determinize ( ) : void

See BasicOperations#determinize(Automaton).

Equals ( object obj ) : bool
ExpandSingleton ( ) : void

Expands singleton representation to normal representation. Does nothing if not in singleton representation.

Intersection ( Automaton a ) : Automaton

See BasicOperations#intersection(Automaton, Automaton).

Minimize ( Automaton a ) : Automaton

See MinimizationOperations#minimize(Automaton). Returns the automaton being given as argument.

Minus ( Automaton a ) : Automaton

See BasicOperations#minus(Automaton, Automaton).

Optional ( ) : Automaton

See BasicOperations#optional(Automaton).

Reduce ( ) : void

Reduces this automaton. An automaton is "reduced" by combining overlapping and adjacent edge intervals with same destination.

RemoveDeadTransitions ( ) : void

Removes transitions to dead states and calls #reduce(). (A state is "dead" if no accept state is reachable from it.)

Repeat ( ) : Automaton

See BasicOperations#repeat(Automaton).

Repeat ( int min ) : Automaton

See BasicOperations#repeat(Automaton, int).

Repeat ( int min, int max ) : Automaton

See BasicOperations#repeat(Automaton, int, int).

RestoreInvariant ( ) : void

Restores representation invariant. this method must be invoked before any built-in automata operation is performed if automaton states or transitions are manipulated manually.

SetAllowMutate ( bool flag ) : bool

Sets or resets allow mutate flag. If this flag is set, then all automata operations may modify automata given as input; otherwise, operations will always leave input automata languages unmodified. By default, the flag is not set.

SetNumberedStates ( State states, int count ) : void
SubsetOf ( Automaton a ) : bool

See BasicOperations#subsetOf(Automaton, Automaton).

ToDot ( ) : string

Returns Graphviz Dot representation of this automaton.

ToString ( ) : string

Returns a string representation of this automaton.

Union ( Automaton a ) : Automaton

See BasicOperations#union(Automaton, Automaton).

Union ( ICollection l ) : Automaton

See BasicOperations#union(Collection).

Private Methods

Method Description
CheckMinimizeAlways ( ) : void
CloneExpandedIfRequired ( ) : Automaton

Returns a clone of this automaton unless allow_mutation is set, expands if singleton.

CloneIfRequired ( ) : Automaton

Returns a clone of this automaton, or this automaton itself if allow_mutation flag is set.

Totalize ( ) : void

Adds transitions to explicit crash state to ensure that transition function is total.

Method Details

Automaton() public method

public Automaton ( ) : Lucene.Net.Support
return Lucene.Net.Support

Automaton() public method

Constructs a new automaton that accepts the empty language. Using this constructor, automata can be constructed manually from State and Transition objects.
public Automaton ( State initial ) : Lucene.Net.Support
initial State
return Lucene.Net.Support

ClearNumberedStates() public method

public ClearNumberedStates ( ) : void
return void

Clone() public method

Returns a clone of this automaton.
public Clone ( ) : object
return object

CloneExpanded() public method

Returns a clone of this automaton, expands if singleton.
public CloneExpanded ( ) : Automaton
return Automaton

Complement() public method

See BasicOperations#complement(Automaton).
public Complement ( ) : Automaton
return Automaton

Concatenate() public method

See BasicOperations#concatenate(Automaton, Automaton).
public Concatenate ( Automaton a ) : Automaton
a Automaton
return Automaton

Concatenate() public static method

See BasicOperations#concatenate(List).
public static Concatenate ( IList l ) : Automaton
l IList
return Automaton

Determinize() public method

See BasicOperations#determinize(Automaton).
public Determinize ( ) : void
return void

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool

ExpandSingleton() public method

Expands singleton representation to normal representation. Does nothing if not in singleton representation.
public ExpandSingleton ( ) : void
return void

Intersection() public method

See BasicOperations#intersection(Automaton, Automaton).
public Intersection ( Automaton a ) : Automaton
a Automaton
return Automaton

Minimize() public static method

See MinimizationOperations#minimize(Automaton). Returns the automaton being given as argument.
public static Minimize ( Automaton a ) : Automaton
a Automaton
return Automaton

Minus() public method

See BasicOperations#minus(Automaton, Automaton).
public Minus ( Automaton a ) : Automaton
a Automaton
return Automaton

Optional() public method

See BasicOperations#optional(Automaton).
public Optional ( ) : Automaton
return Automaton

Reduce() public method

Reduces this automaton. An automaton is "reduced" by combining overlapping and adjacent edge intervals with same destination.
public Reduce ( ) : void
return void

RemoveDeadTransitions() public method

Removes transitions to dead states and calls #reduce(). (A state is "dead" if no accept state is reachable from it.)
public RemoveDeadTransitions ( ) : void
return void

Repeat() public method

See BasicOperations#repeat(Automaton).
public Repeat ( ) : Automaton
return Automaton

Repeat() public method

See BasicOperations#repeat(Automaton, int).
public Repeat ( int min ) : Automaton
min int
return Automaton

Repeat() public method

See BasicOperations#repeat(Automaton, int, int).
public Repeat ( int min, int max ) : Automaton
min int
max int
return Automaton

RestoreInvariant() public method

Restores representation invariant. this method must be invoked before any built-in automata operation is performed if automaton states or transitions are manipulated manually.
public RestoreInvariant ( ) : void
return void

SetAllowMutate() public static method

Sets or resets allow mutate flag. If this flag is set, then all automata operations may modify automata given as input; otherwise, operations will always leave input automata languages unmodified. By default, the flag is not set.
public static SetAllowMutate ( bool flag ) : bool
flag bool if true, the flag is set
return bool

SetNumberedStates() public method

public SetNumberedStates ( State states, int count ) : void
states State
count int
return void

SubsetOf() public method

See BasicOperations#subsetOf(Automaton, Automaton).
public SubsetOf ( Automaton a ) : bool
a Automaton
return bool

ToDot() public method

Returns Graphviz Dot representation of this automaton.
public ToDot ( ) : string
return string

ToString() public method

Returns a string representation of this automaton.
public ToString ( ) : string
return string

Union() public method

See BasicOperations#union(Automaton, Automaton).
public Union ( Automaton a ) : Automaton
a Automaton
return Automaton

Union() public static method

See BasicOperations#union(Collection).
public static Union ( ICollection l ) : Automaton
l ICollection
return Automaton