use rule table instead a single jump funcfor state machine

This commit is contained in:
Youmu Liu
2026-01-26 18:05:23 +08:00
parent ce34e8f7e0
commit a36e6cbab4
3 changed files with 73 additions and 18 deletions
+11 -6
View File
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ISimpleStateMachine"
// Project: StgSharp
@@ -28,24 +28,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.State
{
public interface ISimpleStateMachine<TStateNode, TStateLabel, TStateContext>
where TStateNode: ISimpleStateMachineNode<TStateLabel, TStateContext>
where TStateLabel: unmanaged, Enum
where TStateContext: StateContext
where TStateNode : ISimpleStateMachineNode<TStateLabel, TStateContext>
where TStateLabel : unmanaged, IEquatable<TStateLabel>
where TStateContext : StateContext
{
ref readonly TStateNode this[TStateLabel label] { get; }
ref readonly TStateNode this[
TStateLabel label
] { get; }
ref readonly TStateNode GetCurrentStateNode();
void Reset();
bool TryMoveNext(TStateContext ctx);
bool TryMoveNext(
TStateContext ctx
);
}
}