Esempio n. 1
0
            /// <inheritdoc />
            public override IDictionary <char, State> NextStates()
            {
                if (this.nextstates == null)
                {
                    Charset context = this.Context;

                    // we are at the end of the word
                    // look into parent context for continuation
                    IDictionary <char, State> parentStates = this.ContextWordEnd ? context.Parent?.GetInitialState(context)?.NextStates() : null;

                    // if the context can be repeated
                    // look into next character
                    IDictionary <char, State> nextStates = null;

                    int repeatCount = this.RepeatCount + 1;
                    if (repeatCount <= context.MaxRepeatCount)
                    {
                        nextStates = CharsetState.NextStates(this.Char, context, repeatCount);
                    }

                    // combine next and parent states
                    this.nextstates = CompositeState.Merge(nextStates, parentStates);
                }

                return(this.nextstates);
            }
Esempio n. 2
0
            public override bool Equals(object obj)
            {
                if (obj == this)
                {
                    return(true);
                }

                CharsetState other = obj as CharsetState;

                if (other == null)
                {
                    return(false);
                }

                return(this.Context == other.Context && base.Equals(other));
            }