Esempio n. 1
0
    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}");
        }
    }
Esempio n. 2
0
    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}");
        }
    }
Esempio n. 3
0
    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}");
        }
    }
Esempio n. 4
0
 public smInvalidTrigger(Ism source, IsmParameter trigger)
 {
     Source = source; Trigger = trigger;
 }
Esempio n. 5
0
 public smTransition(Ism source, Ism destination, IsmParameter trigger)
 {
     Source = source; Destination = destination; Trigger = trigger;
 }