Struct StateView
A fast readonly view of a state in a deterministic automaton, providing access to transitions from this specific state.
Inherited Members
Namespace: Automata.Core
Assembly: Automata.Core.dll
Syntax
public readonly ref struct StateView
Remarks
This struct uses a ReadOnlySpan as a view on a contiguous memory sequence of Transition(int).
Constructors
| Edit this page View SourceStateView(int, Transition[])
Initializes a new instance of the StateView struct with a specified state and unfiltered transitions.
Declaration
public StateView(int fromState, Transition[] transitions)
Parameters
| Type | Name | Description |
|---|---|---|
| int | fromState | State from which the transitions originate. |
| Transition[] | transitions | Filtered transitions from the specified state. |
StateView(int, ReadOnlySpan<Transition>)
Initializes a new instance of the StateView struct with a specified state and unfiltered transitions.
Declaration
public StateView(int fromState, ReadOnlySpan<Transition> transitions)
Parameters
| Type | Name | Description |
|---|---|---|
| int | fromState | State from which the transitions originate. |
| ReadOnlySpan<Transition> | transitions | Filtered transitions from the specified state. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If |
Fields
| Edit this page View SourceTransitions
Transitions from the current state.
Declaration
public readonly ReadOnlySpan<Transition> Transitions
Field Value
| Type | Description |
|---|---|
| ReadOnlySpan<Transition> |
Properties
| Edit this page View SourceState
State from which the transitions originate.
Declaration
public int State { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceTransition(int)
State reachable from the current state on symbol.
Declaration
public int Transition(int symbol)
Parameters
| Type | Name | Description |
|---|---|---|
| int | symbol | Symbol of the transition. |
Returns
| Type | Description |
|---|---|
| int | State reachable from the current state on |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If |
See Also
| Edit this page View SourceTryTransition(int, out int)
Tries to get the state reachable from the current state on the specified symbol.
Declaration
public bool TryTransition(int symbol, out int toState)
Parameters
| Type | Name | Description |
|---|---|---|
| int | symbol | Symbol for the transition. |
| int | toState | The reachable state, or InvalidState if the method returns false. |
Returns
| Type | Description |
|---|---|
| bool | true
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If |