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(int, int, int)
Initializes a new instance of the Transition struct.
Declaration
public Transition(int fromState, int symbol, int toState)
Parameters
Type | Name | Description |
---|---|---|
int | fromState | The state origin of the transition. |
int | symbol | The symbol for the transition. |
int | toState | The destination state of the transition. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if any of arguments has a negative value. |
Properties
| Edit this page View SourceFromState
The state origin of the transition.
Declaration
public int FromState { get; }
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
Symbol for the transition.
Declaration
public int Symbol { get; }
Property Value
Type | Description |
---|---|
int |
ToState
The destination state of the transition.
Declaration
public int ToState { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceCompareTo(Transition)
Compares the current transition to another transition by default order: {FromState, Symbol, ToState}.
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. |
ComparerByToState()
A comparer that compares transitions by their to states.
Declaration
public static Comparer<Transition> ComparerByToState()
Returns
Type | Description |
---|---|
Comparer<Transition> | A comparer that compares transitions in reversed order: {ToState, Symbol, FromState}. |
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. |