Ejemplo n.º 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>()));
        }
Ejemplo n.º 2
0
        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);
        }