public static smTransitionResult DoTransition(this Ism sm, IsmParameter parameter) { switch (sm.State.UnionCase) { case smState.UnionCases.a: { switch (parameter.Trigger.UnionCase) { case smTrigger.UnionCases.atob: return(new smTransition(sm, ((asm)sm).atob((smParameters.atob)parameter), parameter)); default: return(new smInvalidTrigger(sm, parameter)); } } case smState.UnionCases.b: { switch (parameter.Trigger.UnionCase) { default: return(new smInvalidTrigger(sm, parameter)); } } default: throw new ArgumentException($"Unknown type implementing Ism: {sm.GetType().Name}"); } }
public static async Task <T> Match <T>(this IsmParameter parameter, Func <smParameters.atob, Task <T> > atob) { switch (parameter.Trigger.UnionCase) { case smTrigger.UnionCases.atob: return(await atob((smParameters.atob) parameter).ConfigureAwait(false)); default: throw new ArgumentException($"Unknown type derived from IsmParameter: {parameter.GetType().Name}"); } }
public static T Match <T>(this IsmParameter parameter, Func <smParameters.atob, T> atob) { switch (parameter.Trigger.UnionCase) { case smTrigger.UnionCases.atob: return(atob((smParameters.atob)parameter)); default: throw new ArgumentException($"Unknown type derived from IsmParameter: {parameter.GetType().Name}"); } }
public smInvalidTrigger(Ism source, IsmParameter trigger) { Source = source; Trigger = trigger; }
public smTransition(Ism source, Ism destination, IsmParameter trigger) { Source = source; Destination = destination; Trigger = trigger; }