Exemple #1
0
        protected override IAcceptInputTransition <T> ActivateRegexNFATransitionFromRegexConst(RegexConst <T> regex)
        {
            if (regex == null)
            {
                throw new ArgumentNullException(nameof(regex));
            }

            var result = this.DynamicInvokeShunt(BasicRegexStateMachineActivationContextInfo <T> .ActivateRegexNFATransitionFromRegexConstSource, regex);

            if (result.Success)
            {
                return((IAcceptInputTransition <T>)result.ReturnValue);
            }
            else
            {
                if (this.AccreditedSet.Any(t => regex.Condition(t)))
                {
                    return(new RangeSetRegexFATransition <T, BasicRegexNFAState <T> >(new RangeSet <T>(new[] { (IRange <T>)regex }, this.rangeInfo)));
                }
                else
                {
                    return(new BasicRegexFATransition <T, BasicRegexNFAState <T> >(t => false));
                }
            }
        }
        protected virtual IAcceptInputTransition <T> ActivateRegexNFATransitionFromRegexConst(RegexConst <T> regex)
        {
            if (regex == null)
            {
                throw new ArgumentNullException(nameof(regex));
            }

            return(new BasicRegexFATransition <T>(t => this.AccreditedSet.Any(_t => regex.Condition(_t))));
        }
        protected override IAcceptInputTransition <T> ActivateRegexNFATransitionFromRegexConst(RegexConst <T> regex)
        {
            if (regex == null)
            {
                throw new ArgumentNullException(nameof(regex));
            }

            if (this.AccreditedSet.Any(t => regex.Condition(t)))
            {
                return(BasicRegexFATransition <T> .Adapt(new RangeSetRegexFATransition <T, BasicRegexNFAState <T> >(new RangeSet <T>(new[] { (IRange <T>)regex }, this.rangeSet.RangeInfo))));
            }
            else
            {
                return(new BasicRegexFATransition <T>(t => false));
            }
        }