From fffdf1adcea9ffcd2b25af153ffa1f9e82e141ee Mon Sep 17 00:00:00 2001 From: egreiner Date: Thu, 14 Dec 2023 08:50:12 +0100 Subject: [PATCH] move Handler and Validators to SequenceData, rework all Validators --- .../Extensions/AllowOnlyOnceInExtension.cs | 2 +- src/IegTools.Sequencer/ISequence.cs | 2 +- src/IegTools.Sequencer/ISequenceBuilder.cs | 5 +++ src/IegTools.Sequencer/Sequence.cs | 9 +++-- src/IegTools.Sequencer/SequenceBuilder.cs | 23 +++++------ .../SequenceConfiguration.cs | 16 ++------ src/IegTools.Sequencer/SequenceData.cs | 21 ++++++++++ .../Validation/AnyStateTransitionValidator.cs | 16 ++++---- .../ContainsStateTransitionValidator.cs | 14 +++---- .../Validation/ForceStateValidator.cs | 6 +-- .../Validation/HandlerValidatorBase.cs | 38 +++++++++---------- .../Validation/IHandlerValidator.cs | 4 +- .../Validation/InitialStateValidator.cs | 16 ++++---- .../SequenceConfigurationValidator.cs | 10 ++--- .../Validation/StateTransitionValidator.cs | 18 ++++----- 15 files changed, 111 insertions(+), 89 deletions(-) create mode 100644 src/IegTools.Sequencer/SequenceData.cs diff --git a/src/IegTools.Sequencer/Extensions/AllowOnlyOnceInExtension.cs b/src/IegTools.Sequencer/Extensions/AllowOnlyOnceInExtension.cs index cd954a2..410a067 100644 --- a/src/IegTools.Sequencer/Extensions/AllowOnlyOnceInExtension.cs +++ b/src/IegTools.Sequencer/Extensions/AllowOnlyOnceInExtension.cs @@ -16,7 +16,7 @@ public static class AllowOnlyOnceInExtension /// The timespan in which the execution of the transition action is is allowed only once public static ISequenceBuilder AllowOnlyOnceIn(this ISequenceBuilder builder, TimeSpan timeSpan) { - var lastHandler = builder.Configuration.Handler.LastOrDefault(); + var lastHandler = builder.Data.Handler.LastOrDefault(); if (lastHandler is not null) lastHandler.AllowOnlyOnceIn(timeSpan); diff --git a/src/IegTools.Sequencer/ISequence.cs b/src/IegTools.Sequencer/ISequence.cs index 1674f31..9d93589 100644 --- a/src/IegTools.Sequencer/ISequence.cs +++ b/src/IegTools.Sequencer/ISequence.cs @@ -58,7 +58,7 @@ public interface ISequence /// /// Set the sequence-configuration /// - ISequence SetConfiguration(SequenceConfiguration configuration); + ISequence SetConfiguration(SequenceConfiguration configuration, SequenceData data); /// diff --git a/src/IegTools.Sequencer/ISequenceBuilder.cs b/src/IegTools.Sequencer/ISequenceBuilder.cs index 2f48d5a..74101ac 100644 --- a/src/IegTools.Sequencer/ISequenceBuilder.cs +++ b/src/IegTools.Sequencer/ISequenceBuilder.cs @@ -17,6 +17,11 @@ public interface ISequenceBuilder /// SequenceConfiguration Configuration { get; init; } + /// + /// The sequence data + /// + SequenceData Data { get; } + /// /// Activates debug logging messages diff --git a/src/IegTools.Sequencer/Sequence.cs b/src/IegTools.Sequencer/Sequence.cs index 7344b40..aa506ad 100644 --- a/src/IegTools.Sequencer/Sequence.cs +++ b/src/IegTools.Sequencer/Sequence.cs @@ -9,6 +9,8 @@ /// public class Sequence : ISequence { + private SequenceData _data; + /// public SequenceConfiguration Configuration { get; private set; } @@ -34,13 +36,13 @@ public class Sequence : ISequence /// public bool IsRegisteredState(string state) => - Configuration.Handler.Any(x => x.IsRegisteredState(state)); + _data.Handler.Any(x => x.IsRegisteredState(state)); /// public virtual ISequence Run() { - foreach (var handler in Configuration.Handler) + foreach (var handler in _data.Handler) { var executed = handler.ExecuteIfValid(this); if (executed && !handler.ResumeSequence) @@ -55,9 +57,10 @@ public virtual ISequence Run() /// - public ISequence SetConfiguration(SequenceConfiguration configuration) + public ISequence SetConfiguration(SequenceConfiguration configuration, SequenceData data) { Configuration = configuration; + _data = data; CurrentState = configuration.InitialState; return this; } diff --git a/src/IegTools.Sequencer/SequenceBuilder.cs b/src/IegTools.Sequencer/SequenceBuilder.cs index 76b6b1f..b0dd0b8 100644 --- a/src/IegTools.Sequencer/SequenceBuilder.cs +++ b/src/IegTools.Sequencer/SequenceBuilder.cs @@ -13,18 +13,20 @@ /// public class SequenceBuilder : ISequenceBuilder { - private readonly IValidator _validator; + private readonly IValidator _validator; - private SequenceBuilder(IValidator validator) => + private SequenceBuilder(IValidator validator) => _validator = validator; /// public SequenceConfiguration Configuration { get; init; } = new(); + /// + public SequenceData Data { get; } = new(); /// - public ISequenceBuilder ActivateDebugLogging(ILogger logger, EventId eventId, Func loggerScope = null) + public ISequenceBuilder ActivateDebugLogging(ILogger logger, EventId eventId, Func? loggerScope = null) { Configuration.Logger = logger; Configuration.EventId = eventId; @@ -43,17 +45,17 @@ public ISequenceBuilder ActivateDebugLogging(ILogger logger, EventId eventId, Fu AddDefaultValidators(); if (!Configuration.DisableValidation) - _validator?.ValidateAndThrow(Configuration); + _validator?.ValidateAndThrow(this); return CreateSequence(); } private ISequence CreateSequence() where TSequence : ISequence, new() { - var sequence = new TSequence().SetConfiguration(Configuration); + var sequence = new TSequence().SetConfiguration(Configuration, Data); // TODO create log-adapter and add it to the handler - foreach (var handler in Configuration.Handler) + foreach (var handler in Data.Handler) { handler.Sequence = sequence; } @@ -86,7 +88,7 @@ public static ISequenceBuilder Create() => /// Creates a new Sequence-Builder for configuration in .NET 6 style. /// This is good for short crispy configs. /// - public static ISequenceBuilder Create(IValidator validator) => + public static ISequenceBuilder Create(IValidator validator) => new SequenceBuilder(validator); @@ -108,8 +110,7 @@ public static ISequenceBuilder Configure(Action configurationA /// /// Custom validator /// The action. - public static ISequenceBuilder Configure(IValidator validator, - Action configurationActions) + public static ISequenceBuilder Configure(IValidator validator, Action configurationActions) { var sequenceBuilder = Create(validator); configurationActions.Invoke(sequenceBuilder); @@ -120,7 +121,7 @@ public static ISequenceBuilder Configure(IValidator valid /// public ISequenceBuilder AddHandler(T handler) where T : IHandler { - Configuration.Handler.Add(handler); + Data.Handler.Add(handler); return this; } @@ -128,7 +129,7 @@ public ISequenceBuilder AddHandler(T handler) where T : IHandler /// public ISequenceBuilder AddValidator() where T : IHandlerValidator, new() { - Configuration.Validators.Add(new T()); + Data.Validators.Add(new T()); return this; } diff --git a/src/IegTools.Sequencer/SequenceConfiguration.cs b/src/IegTools.Sequencer/SequenceConfiguration.cs index 403a6a1..e070738 100644 --- a/src/IegTools.Sequencer/SequenceConfiguration.cs +++ b/src/IegTools.Sequencer/SequenceConfiguration.cs @@ -10,6 +10,7 @@ /// public class SequenceConfiguration { + // TODO the logger-adapter will be created in builder and injected in the handler // /// // /// The logger that can be used for logging // /// @@ -17,34 +18,25 @@ public class SequenceConfiguration /// + /// TODO move to logger-adapter /// The logger that can be used for logging /// public ILogger Logger { get; set; } /// + /// TODO move to logger-adapter /// The logger-scope /// public Func LoggerScope { get; set; } /// + /// TODO move to logger-adapter /// The EventId for logging /// public EventId EventId { get; set; } - /// - /// The sequence-handler that describe how the sequence is supposed to work - /// - public List Handler { get; } = new(); - - /// - /// All validators - /// - public IList Validators { get; set; } = new List(); - - - /// /// The complete validation will be disabled /// diff --git a/src/IegTools.Sequencer/SequenceData.cs b/src/IegTools.Sequencer/SequenceData.cs new file mode 100644 index 0000000..9ef393b --- /dev/null +++ b/src/IegTools.Sequencer/SequenceData.cs @@ -0,0 +1,21 @@ +namespace IegTools.Sequencer; + +using System.Collections.Generic; +using Handler; +using Validation; + +/// +/// The sequence data +/// +public class SequenceData +{ + /// + /// The sequence-handler that describe how the sequence is supposed to work + /// + public List Handler { get; } = new(); + + /// + /// All validators + /// + public IList Validators { get; set; } = new List(); +} \ No newline at end of file diff --git a/src/IegTools.Sequencer/Validation/AnyStateTransitionValidator.cs b/src/IegTools.Sequencer/Validation/AnyStateTransitionValidator.cs index e96aff3..97117c7 100644 --- a/src/IegTools.Sequencer/Validation/AnyStateTransitionValidator.cs +++ b/src/IegTools.Sequencer/Validation/AnyStateTransitionValidator.cs @@ -16,7 +16,7 @@ public sealed class AnyStateTransitionValidator : HandlerValidatorBase, IHandler /// - public bool Validate(ValidationContext context, ValidationResult result) + public bool Validate(ValidationContext context, ValidationResult result) { var isValid = true; @@ -49,10 +49,10 @@ public bool Validate(ValidationContext context, Validatio /// otherwise you have created an dead-end. /// Use '!' as first character to tag an state as dead-end with purpose. /// - private bool HandlerIsValidatedFrom(SequenceConfiguration config) + private bool HandlerIsValidatedFrom(SequenceBuilder builder) { - var transitions = config.Handler.OfType().ToList(); - var allTransitions = config.Handler.OfType().ToList(); + var transitions = builder.Data.Handler.OfType().ToList(); + var allTransitions = builder.Data.Handler.OfType().ToList(); if (transitions.Count == 0) return true; _handlerFrom = new List(); @@ -61,10 +61,10 @@ private bool HandlerIsValidatedFrom(SequenceConfiguration config) // each StateTransition should have an counterpart so that no dead-end is reached foreach (var transition in transitions) { - foreach (var state in transition.FromStates.Where(x => ShouldBeValidated(x, config))) + foreach (var state in transition.FromStates.Where(x => ShouldBeValidated(x, builder))) { if (allTransitions.All(x => state != x.ToState) && - state != config.InitialState) + state != builder.Configuration.InitialState) _handlerFrom.Add(transition); } } @@ -77,9 +77,9 @@ private bool HandlerIsValidatedFrom(SequenceConfiguration config) /// otherwise you have created an dead-end. /// Use '!' as first character to tag an state as dead-end with purpose. /// - private bool HandlerIsValidatedTo(SequenceConfiguration config) + private bool HandlerIsValidatedTo(SequenceBuilder builder) { - var result = HandlerIsValidatedTo(config); + var result = HandlerIsValidatedTo(builder); _handlerTo = result.list.ToList(); return result.isValid; diff --git a/src/IegTools.Sequencer/Validation/ContainsStateTransitionValidator.cs b/src/IegTools.Sequencer/Validation/ContainsStateTransitionValidator.cs index 2093a8c..fe622ad 100644 --- a/src/IegTools.Sequencer/Validation/ContainsStateTransitionValidator.cs +++ b/src/IegTools.Sequencer/Validation/ContainsStateTransitionValidator.cs @@ -16,7 +16,7 @@ public sealed class ContainsStateTransitionValidator : HandlerValidatorBase, IHa /// - public bool Validate(ValidationContext context, ValidationResult result) + public bool Validate(ValidationContext context, ValidationResult result) { var isValid = true; @@ -53,10 +53,10 @@ public bool Validate(ValidationContext context, Validatio /// otherwise you have created an dead-end. /// Use '!' as first character to tag an state as dead-end with purpose. /// - private bool HandlerValidatedFrom(SequenceConfiguration config) + private bool HandlerValidatedFrom(SequenceBuilder builder) { - var transitions = config.Handler.OfType().ToList(); - var allTransitions = config.Handler.OfType().ToList(); + var transitions = builder.Data.Handler.OfType().ToList(); + var allTransitions = builder.Data.Handler.OfType().ToList(); if (transitions.Count == 0) return true; _handlerFrom = new List(); @@ -67,7 +67,7 @@ private bool HandlerValidatedFrom(SequenceConfiguration config) { if (transitions.All(x => !x.ToState.Contains(transition.FromStateContains)) && ////allTransitions.All(x => transition.FromState != x.ToState) && - !config.InitialState.Contains(transition.FromStateContains)) + !builder.Configuration.InitialState.Contains(transition.FromStateContains)) _handlerFrom.Add(transition); } @@ -79,9 +79,9 @@ private bool HandlerValidatedFrom(SequenceConfiguration config) /// otherwise you have created an dead-end. /// Use '!' as first character to tag an state as dead-end with purpose. /// - private bool HandlerValidatedTo(SequenceConfiguration config) + private bool HandlerValidatedTo(SequenceBuilder builder) { - var result = HandlerIsValidatedTo(config); + var result = HandlerIsValidatedTo(builder); _handlerTo = result.list.ToList(); return result.isValid; diff --git a/src/IegTools.Sequencer/Validation/ForceStateValidator.cs b/src/IegTools.Sequencer/Validation/ForceStateValidator.cs index 534b7a2..edf7bb0 100644 --- a/src/IegTools.Sequencer/Validation/ForceStateValidator.cs +++ b/src/IegTools.Sequencer/Validation/ForceStateValidator.cs @@ -14,7 +14,7 @@ public sealed class ForceStateValidator : HandlerValidatorBase, IHandlerValidato private List _handler; /// - public bool Validate(ValidationContext context, ValidationResult result) + public bool Validate(ValidationContext context, ValidationResult result) { if (HandlerIsValidated(context.InstanceToValidate)) return true; @@ -29,9 +29,9 @@ public bool Validate(ValidationContext context, Validatio /// Each 'Force.State' must have an corresponding 'Transition.FromState(s) ' /// otherwise you have created an dead-end. /// - private bool HandlerIsValidated(SequenceConfiguration config) + private bool HandlerIsValidated(SequenceBuilder builder) { - var result = HandlerIsValidatedTo(config); + var result = HandlerIsValidatedTo(builder); _handler = result.list.ToList(); return result.isValid; diff --git a/src/IegTools.Sequencer/Validation/HandlerValidatorBase.cs b/src/IegTools.Sequencer/Validation/HandlerValidatorBase.cs index 5031b6a..7bb5860 100644 --- a/src/IegTools.Sequencer/Validation/HandlerValidatorBase.cs +++ b/src/IegTools.Sequencer/Validation/HandlerValidatorBase.cs @@ -16,14 +16,13 @@ public class HandlerValidatorBase /// Returns true if the state should be validated. /// /// The specified state - /// The sequence-configuration - /// - protected static bool ShouldBeValidated(string state, SequenceConfiguration config) + /// The sequence builder + protected static bool ShouldBeValidated(string state, SequenceBuilder builder) { - return (!state?.StartsWith(config.IgnoreTag.ToString()) ?? true) && !disabledStates().Contains(state); + return (!state?.StartsWith(builder.Configuration.IgnoreTag.ToString()) ?? true) && !disabledStates().Contains(state); IEnumerable disabledStates() => - config.DisableValidationForStates?.ToList() ?? Enumerable.Empty(); + builder.Configuration.DisableValidationForStates?.ToList() ?? Enumerable.Empty(); } @@ -32,63 +31,64 @@ IEnumerable disabledStates() => /// otherwise you have created an dead-end. /// Use '!' as first character to tag an state as dead-end with purpose. /// - protected (bool isValid, IEnumerable list) HandlerIsValidatedTo(SequenceConfiguration config) where T: IHasToState + protected (bool isValid, IEnumerable list) HandlerIsValidatedTo(SequenceBuilder builder) where T: IHasToState { - var containsTransitions = config.Handler.OfType().ToList(); + var containsTransitions = builder.Data.Handler.OfType().ToList(); if (containsTransitions is null || containsTransitions.Count == 0) return (true, Enumerable.Empty()); - var transitions = config.Handler.OfType().ToList(); + var transitions = builder.Data.Handler.OfType().ToList(); this._handlerTo = new List(); - AddMissingTransitions(config, containsTransitions, transitions); + AddMissingTransitions(builder, containsTransitions, transitions); if (this._handlerTo.Count == 0) return (true, Enumerable.Empty()); - RemoveWithContainsTransitions(config, containsTransitions); + RemoveWithContainsTransitions(builder, containsTransitions); if (this._handlerTo.Count == 0) return (true, Enumerable.Empty()); - RemoveWithAnyTransitions(config, containsTransitions); + RemoveWithAnyTransitions(builder, containsTransitions); return (this._handlerTo.Count == 0, this._handlerTo.ConvertAll(x => (T)x)); } - private void AddMissingTransitions(SequenceConfiguration config, List containsTransitions, List transitions) + private void AddMissingTransitions(SequenceBuilder builder, List containsTransitions, + List transitions) where T : IHasToState { // for easy reading do not simplify this // each StateTransition should have an counterpart so that no dead-end is reached - foreach (var transition in containsTransitions.Where(x => ShouldBeValidated(x.ToState, config))) + foreach (var transition in containsTransitions.Where(x => ShouldBeValidated(x.ToState, builder))) { if (transitions.All(x => transition.ToState != x.FromState)) this._handlerTo.Add(transition); } } - private void RemoveWithAnyTransitions(SequenceConfiguration config, List containsTransitions) + private void RemoveWithAnyTransitions(SequenceBuilder builder, List containsTransitions) where T : IHasToState { - foreach (var transition in containsTransitions.Where(x => ShouldBeValidated(x.ToState, config))) + foreach (var transition in containsTransitions.Where(x => ShouldBeValidated(x.ToState, builder))) { - if (config.Handler.OfType().Any(x => x.FromStates.Contains(transition.ToState))) + if (builder.Data.Handler.OfType().Any(x => x.FromStates.Contains(transition.ToState))) this._handlerTo.Remove(transition); } } - private void RemoveWithContainsTransitions(SequenceConfiguration config, List containsTransitions) + private void RemoveWithContainsTransitions(SequenceBuilder builder, List containsTransitions) where T : IHasToState { - foreach (var transition in containsTransitions.Where(x => ShouldBeValidated(x.ToState, config))) + foreach (var transition in containsTransitions.Where(x => ShouldBeValidated(x.ToState, builder))) { - if (config.Handler.OfType() + if (builder.Data.Handler.OfType() .Any(x => transition.ToState.Contains(x.FromStateContains))) this._handlerTo.Remove(transition); } diff --git a/src/IegTools.Sequencer/Validation/IHandlerValidator.cs b/src/IegTools.Sequencer/Validation/IHandlerValidator.cs index d8fd826..f3d328a 100644 --- a/src/IegTools.Sequencer/Validation/IHandlerValidator.cs +++ b/src/IegTools.Sequencer/Validation/IHandlerValidator.cs @@ -11,8 +11,8 @@ public interface IHandlerValidator /// /// /// - /// + /// /// /// true if valid - bool Validate(ValidationContext context, ValidationResult result); + bool Validate(ValidationContext builder, ValidationResult result); } \ No newline at end of file diff --git a/src/IegTools.Sequencer/Validation/InitialStateValidator.cs b/src/IegTools.Sequencer/Validation/InitialStateValidator.cs index 03f6aa7..433c172 100644 --- a/src/IegTools.Sequencer/Validation/InitialStateValidator.cs +++ b/src/IegTools.Sequencer/Validation/InitialStateValidator.cs @@ -11,12 +11,12 @@ public sealed class InitialStateValidator : HandlerValidatorBase, IHandlerValidator { /// - public bool Validate(ValidationContext context, ValidationResult result) + public bool Validate(ValidationContext context, ValidationResult result) { - var config = context.InstanceToValidate; - if (!ShouldBeValidated(config.InitialState, config)) return true; + var builder = context.InstanceToValidate; + if (!ShouldBeValidated(builder.Configuration.InitialState, builder)) return true; - if (HandlerIsValidated(config)) return true; + if (HandlerIsValidated(builder)) return true; result.Errors.Add(new ValidationFailure("InitialState", "The Initial-State must have an StateTransition counterpart")); @@ -24,8 +24,8 @@ public bool Validate(ValidationContext context, Validatio return false; } - private bool HandlerIsValidated(SequenceConfiguration config) => - config.Handler.OfType().Any(x => config.InitialState == x.FromState) || - config.Handler.OfType().Any(x => config.InitialState.Contains(x.FromStateContains)) || - config.Handler.OfType().Any(x => x.FromStates.Contains(config.InitialState)); + private bool HandlerIsValidated(SequenceBuilder builder) => + builder.Data.Handler.OfType().Any(x => builder.Configuration.InitialState == x.FromState) || + builder.Data.Handler.OfType().Any(x => builder.Configuration.InitialState.Contains(x.FromStateContains)) || + builder.Data.Handler.OfType().Any(x => x.FromStates.Contains(builder.Configuration.InitialState)); } \ No newline at end of file diff --git a/src/IegTools.Sequencer/Validation/SequenceConfigurationValidator.cs b/src/IegTools.Sequencer/Validation/SequenceConfigurationValidator.cs index 4c373c3..2342eed 100644 --- a/src/IegTools.Sequencer/Validation/SequenceConfigurationValidator.cs +++ b/src/IegTools.Sequencer/Validation/SequenceConfigurationValidator.cs @@ -7,15 +7,15 @@ /// /// The sequence configuration validator. /// -public sealed class SequenceConfigurationValidator : AbstractValidator +public sealed class SequenceConfigurationValidator : AbstractValidator { /// /// Initializes a new instance of the class. /// public SequenceConfigurationValidator() { - RuleFor(config => config.Handler.Count).GreaterThan(1).WithMessage("The sequence must have more than one handler"); - RuleFor(config => config.InitialState).NotEmpty(); + RuleFor(builder => builder.Data.Handler.Count).GreaterThan(1).WithMessage("The sequence must have more than one handler"); + RuleFor(builder => builder.Configuration.InitialState).NotEmpty(); } @@ -25,10 +25,10 @@ public SequenceConfigurationValidator() /// The Validation context /// The validation-result /// - protected override bool PreValidate(ValidationContext context, ValidationResult result) + protected override bool PreValidate(ValidationContext context, ValidationResult result) { var isValid = true; - context.InstanceToValidate.Validators.ToList() + context.InstanceToValidate.Data.Validators.ToList() .ForEach(x => isValid &= x.Validate(context, result)); return isValid; diff --git a/src/IegTools.Sequencer/Validation/StateTransitionValidator.cs b/src/IegTools.Sequencer/Validation/StateTransitionValidator.cs index 8548c83..a80e3a2 100644 --- a/src/IegTools.Sequencer/Validation/StateTransitionValidator.cs +++ b/src/IegTools.Sequencer/Validation/StateTransitionValidator.cs @@ -16,7 +16,7 @@ public sealed class StateTransitionValidator : HandlerValidatorBase, IHandlerVal /// - public bool Validate(ValidationContext context, ValidationResult result) + public bool Validate(ValidationContext context, ValidationResult result) { var isValid = true; @@ -49,25 +49,25 @@ public bool Validate(ValidationContext context, Validatio /// otherwise you have created an dead-end. /// Use '!' as first character to tag an state as dead-end with purpose. /// - private bool HandlerValidatedFrom(SequenceConfiguration config) + private bool HandlerValidatedFrom(SequenceBuilder builder) { - var transitions = config.Handler.OfType().ToList(); - var allTransitions = config.Handler.OfType().ToList(); + var transitions = builder.Data.Handler.OfType().ToList(); + var allTransitions = builder.Data.Handler.OfType().ToList(); if (transitions.Count == 0) return true; _handlerFrom = new List(); // for easy reading do not simplify this // each StateTransition should have an counterpart so that no dead-end is reached - foreach (var transition in transitions.Where(x => ShouldBeValidated(x.FromState, config))) + foreach (var transition in transitions.Where(x => ShouldBeValidated(x.FromState, builder))) { if (allTransitions.All(x => transition.FromState != x.ToState) && - transition.FromState != config.InitialState) + transition.FromState != builder.Configuration.InitialState) _handlerFrom.Add(transition); ////if (transitions.All(x => transition.FromState != x.ToState) && //// allTransitions.All(x => transition.FromState != x.ToState) && - //// transition.FromState != config.InitialState) + //// transition.FromState != builder.InitialState) //// _handlerFrom.Add(transition); } @@ -80,9 +80,9 @@ private bool HandlerValidatedFrom(SequenceConfiguration config) /// otherwise you have created an dead-end. /// Use '!' as first character to tag an state as dead-end with purpose. /// - private bool HandlerValidatedTo(SequenceConfiguration config) + private bool HandlerValidatedTo(SequenceBuilder builder) { - var result = HandlerIsValidatedTo(config); + var result = HandlerIsValidatedTo(builder); _handlerTo = result.list.ToList(); return result.isValid;