Table of Contents

Interface State<TInstance>

Namespace
Automatonymous
Assembly
Automatonymous.dll

A state within a state machine that can be targeted with events

public interface State<TInstance> : State, Visitable, IProbeSite, IComparable<State>

Type Parameters

TInstance

The instance type to which the state applies

Inherited Members

Properties

Events

IEnumerable<Event> Events { get; }

Property Value

IEnumerable<Event>

SuperState

Returns the superState of the state, if there is one

State<TInstance> SuperState { get; }

Property Value

State<TInstance>

Methods

AddSubstate(State<TInstance>)

Adds a substate to the state

void AddSubstate(State<TInstance> subState)

Parameters

subState State<TInstance>

Bind(Event, Activity<TInstance>)

Bind an activity to an event

void Bind(Event @event, Activity<TInstance> activity)

Parameters

event Event
activity Activity<TInstance>

HasState(State<TInstance>)

True if the specified state is included in the state

bool HasState(State<TInstance> state)

Parameters

state State<TInstance>

Returns

bool

Ignore(Event)

Ignore the specified event in this state. Prevents an exception from being thrown if the event is raised during this state.

void Ignore(Event @event)

Parameters

event Event

Ignore<T>(Event<T>, StateMachineEventFilter<TInstance, T>)

Ignore the specified event in this state if the filter condition passed. Prevents exceptions from being thrown if the event is raised during this state.

void Ignore<T>(Event<T> @event, StateMachineEventFilter<TInstance, T> filter)

Parameters

event Event<T>
filter StateMachineEventFilter<TInstance, T>

Type Parameters

T

IsStateOf(State<TInstance>)

True if the specified state is a substate of the current state

bool IsStateOf(State<TInstance> state)

Parameters

state State<TInstance>

Returns

bool

Raise(EventContext<TInstance>)

Task Raise(EventContext<TInstance> context)

Parameters

context EventContext<TInstance>

Returns

Task

Raise<T>(EventContext<TInstance, T>)

Raise an event to the state, passing the instance

Task Raise<T>(EventContext<TInstance, T> context)

Parameters

context EventContext<TInstance, T>

The event context

Returns

Task

Type Parameters

T

The event data type