示例#1
0
        public static Fare.State Build(IEnumerable <char[]> input)
        {
            var builder = new StringUnionOperations();

            foreach (var chs in input)
            {
                builder.Add(chs);
            }

            return(Convert(builder.Complete(), new Dictionary <State, Fare.State>()));
        }
        public static Automaton MakeStringUnion(params char[][] strings)
        {
            if (strings.Length == 0)
            {
                return(MakeEmpty());
            }

            Array.Sort(strings, new LexicographicComparer());
            var a = new Automaton
            {
                Initial         = StringUnionOperations.Build(strings),
                IsDeterministic = true,
            };

            a.Reduce();
            a.RecomputeHashCode();
            return(a);
        }