Esempio n. 1
0
        /// <summary>
        /// Internal recursive traversal for conversion.
        /// </summary>
        /// <param name="s"></param>
        /// <param name="visited">Must use a dictionary with <see cref="IdentityEqualityComparer{State}.Default"/> passed into its constructor.</param>
        private static Util.Automaton.State Convert(State s, IDictionary <State, Lucene.Net.Util.Automaton.State> visited)
        {
            if (visited.TryGetValue(s, out Util.Automaton.State converted) && converted != null)
            {
                return(converted);
            }

            converted        = new Util.Automaton.State();
            converted.Accept = s.is_final;

            visited[s] = converted;
            int i = 0;

            int[] labels = s.labels;
            foreach (DaciukMihovAutomatonBuilder.State target in s.states)
            {
                converted.AddTransition(new Transition(labels[i++], Convert(target, visited)));
            }

            return(converted);
        }
Esempio n. 2
0
        /// <summary>
        /// Internal recursive traversal for conversion.
        /// </summary>
        private static Util.Automaton.State Convert(State s, IdentityHashMap <State, Lucene.Net.Util.Automaton.State> visited)
        {
            Util.Automaton.State converted = visited[s];
            if (converted != null)
            {
                return(converted);
            }

            converted        = new Util.Automaton.State();
            converted.Accept = s.is_final;

            visited[s] = converted;
            int i = 0;

            int[] labels = s.labels;
            foreach (DaciukMihovAutomatonBuilder.State target in s.states)
            {
                converted.AddTransition(new Transition(labels[i++], Convert(target, visited)));
            }

            return(converted);
        }
        /// <summary>
        /// Internal recursive traversal for conversion.
        /// </summary>
        private static Util.Automaton.State Convert(State s, IdentityHashMap<State, Lucene.Net.Util.Automaton.State> visited)
        {
            Util.Automaton.State converted = visited[s];
            if (converted != null)
            {
                return converted;
            }

            converted = new Util.Automaton.State();
            converted.Accept = s.Is_final;

            visited[s] = converted;
            int i = 0;
            int[] labels = s.Labels;
            foreach (DaciukMihovAutomatonBuilder.State target in s.States)
            {
                converted.AddTransition(new Transition(labels[i++], Convert(target, visited)));
            }

            return converted;
        }