C# Class Fare.BasicOperations

Mostrar archivo Open project: moodmosaic/Fare Class Usage Examples

Public Methods

Method Description
AddEpsilons ( Fare.Automaton a, ICollection pairs ) : void

Adds epsilon transitions to the given automaton. This method adds extra character interval transitions that are equivalent to the given set of epsilon transitions.

Complement ( Fare.Automaton a ) : Fare.Automaton

Returns a (deterministic) automaton that accepts the complement of the language of the given automaton.

Complexity: linear in number of states (if already deterministic).

Concatenate ( Fare.Automaton a1, Fare.Automaton a2 ) : Fare.Automaton
Concatenate ( IList l ) : Fare.Automaton
Determinize ( Fare.Automaton a ) : void

Determinizes the specified automaton.

Complexity: exponential in number of states.

Determinize ( Fare.Automaton a, List initialset ) : void

Determinizes the given automaton using the given set of initial states.

Intersection ( Fare.Automaton a1, Fare.Automaton a2 ) : Fare.Automaton

Returns an automaton that accepts the intersection of the languages of the given automata. Never modifies the input automata languages.

IsEmpty ( Fare.Automaton a ) : bool

Determines whether the given automaton accepts no strings.

IsEmptyString ( Fare.Automaton a ) : bool

Determines whether the given automaton accepts the empty string and nothing else.

Optional ( Fare.Automaton a ) : Fare.Automaton

Returns an automaton that accepts the union of the empty string and the language of the given automaton.

Complexity: linear in number of states.

Repeat ( Fare.Automaton a ) : Fare.Automaton

Accepts the Kleene star (zero or more concatenated repetitions) of the language of the given automaton. Never modifies the input automaton language.

Complexity: linear in number of states.

Repeat ( Fare.Automaton a, int min ) : Fare.Automaton

Accepts min or more concatenated repetitions of the language of the given automaton.

Complexity: linear in number of states and in min.

Repeat ( Fare.Automaton a, int min, int max ) : Fare.Automaton

Accepts between min and max (including both) concatenated repetitions of the language of the given automaton.

Complexity: linear in number of states and in min and max.

Run ( Fare.Automaton a, string s ) : bool

Returns true if the given string is accepted by the automaton.

Complexity: linear in the length of the string. For full performance, use the RunAutomaton class.

Union ( IList automatons ) : Fare.Automaton

Returns an automaton that accepts the union of the languages of the given automata.

Complexity: linear in number of states.

Method Details

AddEpsilons() public static method

Adds epsilon transitions to the given automaton. This method adds extra character interval transitions that are equivalent to the given set of epsilon transitions.
public static AddEpsilons ( Fare.Automaton a, ICollection pairs ) : void
a Fare.Automaton The automaton.
pairs ICollection A collection of objects representing pairs of /// source/destination states where epsilon transitions should be added.
return void

Complement() public static method

Returns a (deterministic) automaton that accepts the complement of the language of the given automaton.
Complexity: linear in number of states (if already deterministic).
public static Complement ( Fare.Automaton a ) : Fare.Automaton
a Fare.Automaton The automaton.
return Fare.Automaton

Concatenate() public static method

public static Concatenate ( Fare.Automaton a1, Fare.Automaton a2 ) : Fare.Automaton
a1 Fare.Automaton
a2 Fare.Automaton
return Fare.Automaton

Concatenate() public static method

public static Concatenate ( IList l ) : Fare.Automaton
l IList
return Fare.Automaton

Determinize() public static method

Determinizes the specified automaton.
Complexity: exponential in number of states.
public static Determinize ( Fare.Automaton a ) : void
a Fare.Automaton The automaton.
return void

Determinize() public static method

Determinizes the given automaton using the given set of initial states.
public static Determinize ( Fare.Automaton a, List initialset ) : void
a Fare.Automaton The automaton.
initialset List The initial states.
return void

Intersection() public static method

Returns an automaton that accepts the intersection of the languages of the given automata. Never modifies the input automata languages.
public static Intersection ( Fare.Automaton a1, Fare.Automaton a2 ) : Fare.Automaton
a1 Fare.Automaton The a1.
a2 Fare.Automaton The a2.
return Fare.Automaton

IsEmpty() public static method

Determines whether the given automaton accepts no strings.
public static IsEmpty ( Fare.Automaton a ) : bool
a Fare.Automaton The automaton.
return bool

IsEmptyString() public static method

Determines whether the given automaton accepts the empty string and nothing else.
public static IsEmptyString ( Fare.Automaton a ) : bool
a Fare.Automaton The automaton.
return bool

Optional() public static method

Returns an automaton that accepts the union of the empty string and the language of the given automaton.
Complexity: linear in number of states.
public static Optional ( Fare.Automaton a ) : Fare.Automaton
a Fare.Automaton The automaton.
return Fare.Automaton

Repeat() public static method

Accepts the Kleene star (zero or more concatenated repetitions) of the language of the given automaton. Never modifies the input automaton language.
Complexity: linear in number of states.
public static Repeat ( Fare.Automaton a ) : Fare.Automaton
a Fare.Automaton The automaton.
return Fare.Automaton

Repeat() public static method

Accepts min or more concatenated repetitions of the language of the given automaton.
Complexity: linear in number of states and in min.
public static Repeat ( Fare.Automaton a, int min ) : Fare.Automaton
a Fare.Automaton The automaton.
min int The minimum concatenated repetitions of the language of the given /// automaton.
return Fare.Automaton

Repeat() public static method

Accepts between min and max (including both) concatenated repetitions of the language of the given automaton.
Complexity: linear in number of states and in min and max.
public static Repeat ( Fare.Automaton a, int min, int max ) : Fare.Automaton
a Fare.Automaton The automaton.
min int The minimum concatenated repetitions of the language of the given /// automaton.
max int The maximum concatenated repetitions of the language of the given /// automaton.
return Fare.Automaton

Run() public static method

Returns true if the given string is accepted by the automaton.
Complexity: linear in the length of the string. For full performance, use the RunAutomaton class.
public static Run ( Fare.Automaton a, string s ) : bool
a Fare.Automaton The automaton.
s string The string.
return bool

Union() public static method

Returns an automaton that accepts the union of the languages of the given automata.
Complexity: linear in number of states.
public static Union ( IList automatons ) : Fare.Automaton
automatons IList The l.
return Fare.Automaton