public static FSMRepresentationBuilder GetDefaultTestConfig( bool usesExceptions = true, string version = "") { var builder = new FSMRepresentationBuilder(); builder.AddPragma("namespace TurnStyleExample"); builder.SetName("TurnStyle"); builder.SetContextName("TurnStyleContext"); builder.SetVersion(version); if (usesExceptions) { builder.SetException("Exception"); } builder.AddBuiltConcreteState(new ConcreteStateImpl("Locked")); builder.AddBuiltConcreteState(new ConcreteStateImpl("Unlocked")); builder.SetInitialState("Locked"); builder.AddTransition("Coin", "Unlocked", null); builder.AddTransition("Pass", "Locked", null); builder.AddAction("Unlock"); builder.AddAction("Lock"); builder.AddAction("Alarm"); builder.AddAction("Thankyou"); return(builder); }
private FSMRepresentationBuilder InitBuilderState() { var builder = new FSMRepresentationBuilder(); builder.AddBuiltConcreteState(new ConcreteStateImpl("Locked")); builder.AddBuiltConcreteState(new ConcreteStateImpl("Unlocked")); builder.Build(); return(builder); }
public override State Build(FSMRepresentationBuilder fb) { ConcreteSubStateImpl retval = null; var sr = fb.GetStateRep(this.SuperStateName); if (sr != null) { sr.Build(fb); SuperState superState = fb.GetBuiltSuperState(this.SuperStateName); if (superState != null) { retval = new ConcreteSubStateImpl(this.StateName, superState); fb.AddBuiltConcreteState(retval); } else { var e = $"Could not build sub state ({this.StateName}) because super state ({this.SuperStateName}) had an error."; fb.SetError(); fb.Error(sr.SyntaxLocation, e); } } else { var e = $"Super state ({this.SuperStateName}) was not declared."; fb.SetError(); fb.Error(null, e); } return(retval); }
public override State Build(FSMRepresentationBuilder fb) { var retval = new ConcreteStateImpl(this.StateName); fb.AddBuiltConcreteState(retval); return(retval); }