Struct Transition
Represents a (symbolic) transition in an automaton, defined by a starting state, a symbol, and an ending state.
Inherited Members
Namespace: Automata.Core
Assembly: Automata.Core.dll
Syntax
public readonly record struct Transition : IComparable<Transition>, IEquatable<Transition>
Remarks
A Transition always has a (non-epsilon) symbol and cannot represent an epsilon transition
Constructors
| Edit this page View SourceTransition()
Initializes a new instance of the Transition struct that is equivalent to Invalid.
Declaration
public Transition()
Transition(int, int, int)
Represents a (symbolic) transition in an automaton, defined by a starting state, a symbol, and an ending state.
Declaration
public Transition(int FromState, int Symbol, int ToState)
Parameters
Type | Name | Description |
---|---|---|
int | FromState | The state from which the transition starts. |
int | Symbol | The symbol that triggers the transition. |
int | ToState | The state to which the transition goes. |
Remarks
A Transition always has a (non-epsilon) symbol and cannot represent an epsilon transition
Properties
| Edit this page View SourceFromState
The state from which the transition starts.
Declaration
public int FromState { get; init; }
Property Value
Type | Description |
---|---|
int |
Invalid
Invalid transition.
Declaration
public static Transition Invalid { get; }
Property Value
Type | Description |
---|---|
Transition |
IsInvalid
Indicates whether the transition is invalid.
Declaration
public bool IsInvalid { get; }
Property Value
Type | Description |
---|---|
bool |
Symbol
The symbol that triggers the transition.
Declaration
public int Symbol { get; init; }
Property Value
Type | Description |
---|---|
int |
ToState
The state to which the transition goes.
Declaration
public int ToState { get; init; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceCompareTo(Transition)
Compares the current transition to another transition.
Declaration
public int CompareTo(Transition other)
Parameters
Type | Name | Description |
---|---|---|
Transition | other | Other transition to compare to. |
Returns
Type | Description |
---|---|
int | An integer that indicates the relative order of the objects being compared. |
MaxTrans(int, int)
Creates a maximum transition for the given state and symbol.
Declaration
public static Transition MaxTrans(int fromState, int symbol = 2147483647)
Parameters
Type | Name | Description |
---|---|---|
int | fromState | From state. |
int | symbol | Symbol for the transition (default is MaxValue). |
Returns
Type | Description |
---|---|
Transition | A Transition representing the maximum transition. |
MinTrans(int, int)
Creates a minimum transition for the given state and symbol.
Declaration
public static Transition MinTrans(int fromState, int symbol = -2147483648)
Parameters
Type | Name | Description |
---|---|---|
int | fromState | From state. |
int | symbol | Symbol for the transition (default is MinValue). |
Returns
Type | Description |
---|---|
Transition | A Transition representing the minimum transition. |
Reverse()
Reverses the transition.
Declaration
public Transition Reverse()
Returns
Type | Description |
---|---|
Transition | A new Transition with the from and to states swapped. |
ToString()
String that represents the current transition.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current transition. |