EMSm 1.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package EMSm --version 1.1.0
NuGet\Install-Package EMSm -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EMSm" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EMSm --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EMSm, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EMSm as a Cake Addin #addin nuget:?package=EMSm&version=1.1.0 // Install EMSm as a Cake Tool #tool nuget:?package=EMSm&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
A simple, TDD-testable hierarchical state machine for .Net
Features
- Entry-/Exit- Implementation.
- Synchronous-/Asynchronous- Mode.
- Perfect to realize the behavior of embedded systems.
- UML-statechart-applicability.
- Use of transitions-tables to define the hierarchical structure.
- Great overview of all states because every state is represented with a separate class.
- Each state is TDD-testable.
- Full flexible due to state-logic-implementation in Do()-method.
- Command-injection can be accomplished from any thread.
- Variable-injection provides clarity and great testability.
- States can be designed for reusability.
- Supports Done-Flag-Pattern.
- Current-state-restoring using state-paths.
- Simple to learn 😃.
Quick Start
class InnerState1 : State
{
private int counter;
protected override void Entry()
{
/*Do some stuff here, which should run once
a transition to this state occurs*/
this.counter = 0;
base.Entry();
}
protected override Enum Do()
{
/*This method is excuted on every RunCycle
as long as this state is the active one.
Returns a transition for switching to another state*/
if (this.counter++ >= 5)
return Transitions.Transition1;
return base.Do();
}
protected override void Exit()
{
/*Here you can do some cleanup,
which run before a transition to
another state happens*/
base.Exit();
}
}
class InnerState2 : State
{
private int counter;
protected override void Entry()
{
/*Do some stuff here, which should run once
a transition to this state occurs*/
this.counter = 0;
base.Entry();
}
protected override Enum Do()
{
/*This method is excuted on every RunCycle
as long as this state is the active one.
Returns a transition for switching to another state*/
if (this.counter++ >= 99)
return Transitions.Transition2;
return base.Do();
}
protected override void Exit()
{
/*Here you can do some cleanup,
which run before a transition to
another state happens*/
base.Exit();
}
}
class OuterState : State
{
public override TransitionsTable TransitionsTable
{
get => new TransitionsTable {
//Initialtransition which should endup to InnerState 1
new TransitionEntry{
Transition=Transitions.Initial,
StateType=typeof(InnerState1),
StateName="InnerState 1"},
//Transition 1, which should endup to InnerState 2
new TransitionEntry{
Transition=Transitions.Transition1,
StateType=typeof(InnerState2),
StateName="Innerstate 2"},
//Transition 2, which should endup to InnerState 1
new TransitionEntry{
Transition=Transitions.Transition2,
StateType=typeof(InnerState1),
StateName="Innerstate 1"},
};
}
protected override void Entry()
{
/*Do some stuff here, which should run once
a transition to this state occurs*/
base.Entry();
}
protected override Enum Do()
{
/*This method is excuted on every RunCycle
if this state is the active one*/
return base.Do();
}
protected override void Exit()
{
/*Here you can do some cleanup,
which run before a transition to
another state happens*/
base.Exit();
}
}
RunCycle:
OuterState outerState = new OuterState();
outerState.RunCycle();
Please visit https://www.eforge.net/EMSm for further documentation and tutorials
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.4.0 | 608 | 6/29/2020 | |
1.3.0 | 451 | 5/24/2020 | |
1.2.0 | 509 | 5/23/2020 | |
1.1.0 | 499 | 12/10/2019 | |
1.0.1-beta | 416 | 9/19/2019 | |
1.0.0-beta | 522 | 9/16/2019 |