Class 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 Singleton 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() method and IsDeterministic setter 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.experimentalInheritance
Assembly: DistributedLucene.Net.dll
Syntax
public class Automaton : object
Constructors
Name | Description |
---|---|
Automaton() | |
Automaton(State) | Constructs a new automaton that accepts the empty language. Using this constructor, automata can be constructed manually from State and Transition objects. |
Fields
Name | Description |
---|---|
MINIMIZE_HOPCROFT | Minimize using Hopcroft's O(n log n) algorithm. this is regarded as one of the most generally efficient algorithms that exist. |
Properties
Name | Description |
---|---|
Info | Associates extra information with this automaton. |
IsDeterministic | Returns deterministic flag for this automaton. |
IsEmptyString | |
Singleton | Returns the singleton string for this automaton. An automaton that accepts exactly one string may be represented in singleton mode. In that case, this method may be used to obtain the string. |
Methods
Name | Description |
---|---|
ClearNumberedStates() | |
Clone() | Returns a clone of this automaton. |
Complement() | |
Concatenate(IList<Automaton>) | |
Concatenate(Automaton) | |
Determinize() | |
Equals(Object) | |
ExpandSingleton() | Expands singleton representation to normal representation. Does nothing if not in singleton representation. |
GetAcceptStates() | Returns the set of reachable accept states. |
GetHashCode() | |
GetInitialState() | Gets initial state. |
GetNumberedStates() | |
GetNumberOfStates() | Returns the number of states in this automaton. |
GetNumberOfTransitions() | Returns the number of transitions in this automaton. This number is counted as the total number of edges, where one edge may be a character interval. |
GetSortedTransitions() | Returns a sorted array of transitions for each state (and sets state numbers). |
GetStartPoints() | Returns sorted array of all interval start points. |
Intersection(Automaton) | |
Minimize(Automaton) | See Minimize(Automaton). Returns the automaton being given as argument. |
Minus(Automaton) | |
Optional() | See Optional(Automaton). |
Reduce() | Reduces this automaton. An automaton is "reduced" by combining overlapping and adjacent edge intervals with same destination. |
RemoveDeadTransitions() | Removes transitions to dead states and calls Reduce(). (A state is "dead" if no accept state is reachable from it.) |
Repeat() | See Repeat(Automaton). |
Repeat(Int32) | |
Repeat(Int32, Int32) | |
RestoreInvariant() | 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(Boolean) | 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. |
SetMinimization(Int32) | Selects minimization algorithm (default: |
SetMinimizeAlways(Boolean) | Sets or resets minimize always flag. If this flag is set, then Minimize(Automaton) will automatically be invoked after all operations that otherwise may produce non-minimal automata. By default, the flag is not set. |
SetNumberedStates(State[]) | |
SetNumberedStates(State[], Int32) | |
SubsetOf(Automaton) | |
ToDot() | Returns Graphviz Dot representation of this automaton. |
ToString() | Returns a string representation of this automaton. |
Union(ICollection<Automaton>) | |
Union(Automaton) |