Apache Solr open-source search software
LUCENE-5752: switch to simpler Automaton implementation
Michael McCandlessec2eaaafad81
diff --cc lucene/CHANGES.txtindex 2807bc065c7,0398c73b8e9..dcec52cb94b--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@@ -98,6 -98,6 +98,10 @@@ Othe(No Changes)++API Changes++++* LUCENE-5752: Simplified Automaton API to be immutable. (Mike McCandless)++======================= Lucene 4.9.0 =======================Changes in Runtime Behaviordiff --cc lucene/core/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.javaindex 6d8666fd4a9,43849584d9a..ab2358a0988--- a/lucene/core/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java+++ b/lucene/core/src/java/org/apache/lucene/util/automaton/CompiledAutomaton.java@@@ -91,9 -95,14 +95,19 @@@ public class CompiledAutomatonthis(automaton, null, true);}+ /** Create this. If finite is null, we use {@link Operations#isFinite}+ * to determine whether it is finite. If simplify is true, we run+ * possibly expensive operations to determine if the automaton is one+ * the cases in {@link CompiledAutomaton.AUTOMATON_TYPE}. */public CompiledAutomaton(Automaton automaton, Boolean finite, boolean simplify) {++ if (automaton.getNumStates() == 0) {++ automaton = new Automaton();++ automaton.createState();++ }++if (simplify) {+// Test whether the automaton is a "simple" form and// if so, don't create a runAutomaton. Note that on a// large automaton these tests could be costly: