You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/06/12 18:57:34 UTC

svn commit: r1602228 [2/2] - in /lucene/dev/branches/lucene5752: lucene/ lucene/codecs/src/java/org/apache/lucene/codecs/memory/ lucene/core/src/java/org/apache/lucene/analysis/ lucene/core/src/java/org/apache/lucene/codecs/blocktree/ lucene/core/src/j...

Modified: lucene/dev/branches/lucene5752/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/java/org/apache/lucene/util/automaton/SpecialOperations.java Thu Jun 12 16:57:33 2014
@@ -70,29 +70,6 @@ final public class SpecialOperations {
   /**
    * Returns true if the language of this automaton is finite.
    */
-  public static boolean isFinite(Automaton a) {
-    if (a.isSingleton()) return true;
-    return isFinite(a.initial, new BitSet(a.getNumberOfStates()), new BitSet(a.getNumberOfStates()));
-  }
-  
-  /**
-   * Checks whether there is a loop containing s. (This is sufficient since
-   * there are never transitions to dead states.)
-   */
-  // TODO: not great that this is recursive... in theory a
-  // large automata could exceed java's stack
-  private static boolean isFinite(State s, BitSet path, BitSet visited) {
-    path.set(s.number);
-    for (Transition t : s.getTransitions())
-      if (path.get(t.to.number) || (!visited.get(t.to.number) && !isFinite(t.to, path, visited))) return false;
-    path.clear(s.number);
-    visited.set(s.number);
-    return true;
-  }
-
-  /**
-   * Returns true if the language of this automaton is finite.
-   */
   public static boolean isFinite(LightAutomaton a) {
     return isFinite(new LightAutomaton.Transition(), a, 0, new BitSet(a.getNumStates()), new BitSet(a.getNumStates()));
   }
@@ -124,34 +101,6 @@ final public class SpecialOperations {
    * @return common prefix
    */
   // nocommit a must be det?  we should document if so?
-  public static String getCommonPrefix(Automaton a) {
-    if (a.isSingleton()) return a.singleton;
-    StringBuilder b = new StringBuilder();
-    HashSet<State> visited = new HashSet<>();
-    State s = a.initial;
-    boolean done;
-    do {
-      done = true;
-      visited.add(s);
-      if (!s.accept && s.numTransitions() == 1) {
-        Transition t = s.getTransitions().iterator().next();
-        if (t.min == t.max && !visited.contains(t.to)) {
-          b.appendCodePoint(t.min);
-          s = t.to;
-          done = false;
-        }
-      }
-    } while (!done);
-    return b.toString();
-  }
-
-  /**
-   * Returns the longest string that is a prefix of all accepted strings and
-   * visits each state at most once.
-   * 
-   * @return common prefix
-   */
-  // nocommit a must be det?  we should document if so?
   public static String getCommonPrefix(LightAutomaton a) {
     //a.writeDot("cp");
     StringBuilder b = new StringBuilder();
@@ -175,31 +124,6 @@ final public class SpecialOperations {
     return b.toString();
   }
   
-  // TODO: this currently requites a determinized machine,
-  // but it need not -- we can speed it up by walking the
-  // NFA instead.  it'd still be fail fast.
-  public static BytesRef getCommonPrefixBytesRef(Automaton a) {
-    if (a.isSingleton()) return new BytesRef(a.singleton);
-    BytesRef ref = new BytesRef(10);
-    HashSet<State> visited = new HashSet<>();
-    State s = a.initial;
-    boolean done;
-    do {
-      done = true;
-      visited.add(s);
-      if (!s.accept && s.numTransitions() == 1) {
-        Transition t = s.getTransitions().iterator().next();
-        if (t.min == t.max && !visited.contains(t.to)) {
-          ref.grow(++ref.length);
-          ref.bytes[ref.length - 1] = (byte)t.min;
-          s = t.to;
-          done = false;
-        }
-      }
-    } while (!done);
-    return ref;
-  }
-  
   public static BytesRef getCommonPrefixBytesRef(LightAutomaton a) {
     BytesRef ref = new BytesRef(10);
     HashSet<Integer> visited = new HashSet<>();
@@ -223,36 +147,6 @@ final public class SpecialOperations {
     return ref;
   }
 
-  /**
-   * Returns the longest string that is a suffix of all accepted strings and
-   * visits each state at most once.
-   * 
-   * @return common suffix
-   */
-  public static String getCommonSuffix(Automaton a) {
-    if (a.isSingleton()) // if singleton, the suffix is the string itself.
-      return a.singleton;
-    
-    // reverse the language of the automaton, then reverse its common prefix.
-    Automaton r = a.clone();
-    reverse(r);
-    r.determinize();
-    return new StringBuilder(SpecialOperations.getCommonPrefix(r)).reverse().toString();
-  }
-  
-  public static BytesRef getCommonSuffixBytesRef(Automaton a) {
-    if (a.isSingleton()) // if singleton, the suffix is the string itself.
-      return new BytesRef(a.singleton);
-    
-    // reverse the language of the automaton, then reverse its common prefix.
-    Automaton r = a.clone();
-    reverse(r);
-    r.determinize();
-    BytesRef ref = SpecialOperations.getCommonPrefixBytesRef(r);
-    reverseBytes(ref);
-    return ref;
-  }
-
   public static BytesRef getCommonSuffixBytesRef(LightAutomaton a) {
     // reverse the language of the automaton, then reverse its common prefix.
     LightAutomaton r = BasicOperations.determinize(reverse(a));
@@ -271,40 +165,6 @@ final public class SpecialOperations {
     }
   }
   
-  /**
-   * Reverses the language of the given (non-singleton) automaton while returning
-   * the set of new initial states.
-   */
-  public static Set<State> reverse(Automaton a) {
-    a.expandSingleton();
-    // reverse all edges
-    HashMap<State, HashSet<Transition>> m = new HashMap<>();
-    State[] states = a.getNumberedStates();
-    Set<State> accept = new HashSet<>();
-    for (State s : states)
-      if (s.isAccept())
-        accept.add(s);
-    for (State r : states) {
-      m.put(r, new HashSet<Transition>());
-      r.accept = false;
-    }
-    for (State r : states)
-      for (Transition t : r.getTransitions())
-        m.get(t.to).add(new Transition(t.min, t.max, r));
-    for (State r : states) {
-      Set<Transition> tr = m.get(r);
-      r.setTransitions(tr.toArray(new Transition[tr.size()]));
-    }
-    // make new initial+final states
-    a.initial.accept = true;
-    a.initial = new State();
-    for (State r : accept)
-      a.initial.addEpsilon(r); // ensures that all initial states are reachable
-    a.deterministic = false;
-    a.clearNumberedStates();
-    return accept;
-  }
-
   // nocommit merge Special/Basic operations
 
   public static LightAutomaton reverse(LightAutomaton a) {
@@ -356,162 +216,6 @@ final public class SpecialOperations {
     return result;
   }
 
-  private static class PathNode {
-
-    /** Which state the path node ends on, whose
-     *  transitions we are enumerating. */
-    public State state;
-
-    /** Which state the current transition leads to. */
-    public State to;
-
-    /** Which transition we are on. */
-    public int transition;
-
-    /** Which label we are on, in the min-max range of the
-     *  current Transition */
-    public int label;
-
-    public void resetState(State state) {
-      assert state.numTransitions() != 0;
-      this.state = state;
-      transition = 0;
-      Transition t = state.transitionsArray[transition];
-      label = t.min;
-      to = t.to;
-    }
-
-    /** Returns next label of current transition, or
-     *  advances to next transition and returns its first
-     *  label, if current one is exhausted.  If there are
-     *  no more transitions, returns -1. */
-    public int nextLabel() {
-      if (label > state.transitionsArray[transition].max) {
-        // We've exhaused the current transition's labels;
-        // move to next transitions:
-        transition++;
-        if (transition >= state.numTransitions()) {
-          // We're done iterating transitions leaving this state
-          return -1;
-        }
-        Transition t = state.transitionsArray[transition];
-        label = t.min;
-        to = t.to;
-      }
-      return label++;
-    }
-  }
-
-  private static PathNode getNode(PathNode[] nodes, int index) {
-    assert index < nodes.length;
-    if (nodes[index] == null) {
-      nodes[index] = new PathNode();
-    }
-    return nodes[index];
-  }
-
-  // TODO: this is a dangerous method ... Automaton could be
-  // huge ... and it's better in general for caller to
-  // enumerate & process in a single walk:
-
-  /** Returns the set of accepted strings, up to at most
-   *  <code>limit</code> strings. If more than <code>limit</code> 
-   *  strings are accepted, the first limit strings found are returned. If <code>limit</code> == -1, then 
-   *  the limit is infinite.  If the {@link Automaton} has
-   *  cycles then this method might throw {@code
-   *  IllegalArgumentException} but that is not guaranteed
-   *  when the limit is set. */
-  public static Set<IntsRef> getFiniteStrings(Automaton a, int limit) {
-    Set<IntsRef> results = new HashSet<>();
-
-    if (limit == -1 || limit > 0) {
-      // OK
-    } else {
-      throw new IllegalArgumentException("limit must be -1 (which means no limit), or > 0; got: " + limit);
-    }
-
-    if (a.isSingleton()) {
-      // Easy case: automaton accepts only 1 string
-      results.add(Util.toUTF32(a.singleton, new IntsRef()));
-    } else {
-
-      if (a.initial.accept) {
-        // Special case the empty string, as usual:
-        results.add(new IntsRef());
-      }
-
-      if (a.initial.numTransitions() > 0 && (limit == -1 || results.size() < limit)) {
-
-        // TODO: we could use state numbers here and just
-        // alloc array, but asking for states array can be
-        // costly (it's lazily computed):
-
-        // Tracks which states are in the current path, for
-        // cycle detection:
-        Set<State> pathStates = Collections.newSetFromMap(new IdentityHashMap<State,Boolean>());
-
-        // Stack to hold our current state in the
-        // recursion/iteration:
-        PathNode[] nodes = new PathNode[4];
-
-        pathStates.add(a.initial);
-        PathNode root = getNode(nodes, 0);
-        root.resetState(a.initial);
-
-        IntsRef string = new IntsRef(1);
-        string.length = 1;
-
-        while (string.length > 0) {
-
-          PathNode node = nodes[string.length-1];
-
-          // Get next label leaving the current node:
-          int label = node.nextLabel();
-
-          if (label != -1) {
-            string.ints[string.length-1] = label;
-
-            if (node.to.accept) {
-              // This transition leads to an accept state,
-              // so we save the current string:
-              results.add(IntsRef.deepCopyOf(string));
-              if (results.size() == limit) {
-                break;
-              }
-            }
-
-            if (node.to.numTransitions() != 0) {
-              // Now recurse: the destination of this transition has
-              // outgoing transitions:
-              if (pathStates.contains(node.to)) {
-                throw new IllegalArgumentException("automaton has cycles");
-              }
-              pathStates.add(node.to);
-
-              // Push node onto stack:
-              if (nodes.length == string.length) {
-                PathNode[] newNodes = new PathNode[ArrayUtil.oversize(nodes.length+1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
-                System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
-                nodes = newNodes;
-              }
-              getNode(nodes, string.length).resetState(node.to);
-              string.length++;
-              string.grow(string.length);
-            }
-          } else {
-            // No more transitions leaving this state,
-            // pop/return back to previous state:
-            assert pathStates.contains(node.state);
-            pathStates.remove(node.state);
-            string.length--;
-          }
-        }
-      }
-    }
-
-    return results;
-  }
-
   private static class LightPathNode {
 
     /** Which state the path node ends on, whose

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestGraphTokenizers.java Thu Jun 12 16:57:33 2014
@@ -29,7 +29,6 @@ import org.apache.lucene.analysis.tokena
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionLengthAttribute;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.BasicOperations;
 import org.apache.lucene.util.automaton.LightAutomaton;

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java Thu Jun 12 16:57:33 2014
@@ -34,7 +34,6 @@ import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.TestUtil;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.AutomatonTestUtil;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.BasicOperations;
@@ -165,9 +164,9 @@ public class TestMockAnalyzer extends Ba
   public void testKeep() throws Exception {
     CharacterRunAutomaton keepWords = 
       new CharacterRunAutomaton(
-          BasicOperations.complement(
-              Automaton.union(
-                  Arrays.asList(BasicAutomata.makeString("foo"), BasicAutomata.makeString("bar")))));
+          BasicOperations.complementLight(
+              BasicOperations.unionLight(
+                  Arrays.asList(BasicAutomata.makeStringLight("foo"), BasicAutomata.makeStringLight("bar")))));
     Analyzer a = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, keepWords);
     assertAnalyzesTo(a, "quick foo brown bar bar fox foo",
         new String[] { "foo", "bar", "bar", "foo" },

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java Thu Jun 12 16:57:33 2014
@@ -83,9 +83,9 @@ import org.apache.lucene.util.SetOnce;
 import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.ThreadInterruptedException;
 import org.apache.lucene.util.Version;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.CharacterRunAutomaton;
+import org.apache.lucene.util.automaton.LightAutomaton;
 import org.apache.lucene.util.packed.PackedInts;
 import org.junit.Test;
 
@@ -1997,7 +1997,7 @@ public class TestIndexWriter extends Luc
   public void testStopwordsPosIncHole2() throws Exception {
     // use two stopfilters for testing here
     Directory dir = newDirectory();
-    final Automaton secondSet = BasicAutomata.makeString("foobar");
+    final LightAutomaton secondSet = BasicAutomata.makeStringLight("foobar");
     Analyzer a = new Analyzer() {
       @Override
       protected TokenStreamComponents createComponents(String fieldName) {

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java Thu Jun 12 16:57:33 2014
@@ -33,7 +33,6 @@ import org.apache.lucene.util.LineFileDo
 import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.CompiledAutomaton;
 import org.apache.lucene.util.automaton.LightAutomaton;
@@ -240,12 +239,12 @@ public class TestTermsEnum extends Lucen
       final Set<String> acceptTerms = new HashSet<>();
       final TreeSet<BytesRef> sortedAcceptTerms = new TreeSet<>();
       final double keepPct = random().nextDouble();
-      Automaton a;
+      LightAutomaton a;
       if (iter == 0) {
         if (VERBOSE) {
           System.out.println("\nTEST: empty automaton");
         }
-        a = BasicAutomata.makeEmpty();
+        a = BasicAutomata.makeEmptyLight();
       } else {
         if (VERBOSE) {
           System.out.println("\nTEST: keepPct=" + keepPct);
@@ -260,16 +259,9 @@ public class TestTermsEnum extends Lucen
           acceptTerms.add(s2);
           sortedAcceptTerms.add(new BytesRef(s2));
         }
-        a = BasicAutomata.makeStringUnion(sortedAcceptTerms);
+        a = BasicAutomata.makeStringUnionLight(sortedAcceptTerms);
       }
       
-      if (random().nextBoolean()) {
-        if (VERBOSE) {
-          System.out.println("TEST: reduce the automaton");
-        }
-        a.reduce();
-      }
-
       final CompiledAutomaton c = new CompiledAutomaton(a, true, false);
 
       final BytesRef[] acceptTermsArray = new BytesRef[acceptTerms.size()];

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java Thu Jun 12 16:57:33 2014
@@ -95,13 +95,11 @@ public class TestTermsEnum2 extends Luce
         }
       }
 
-      Automaton alternate = BasicAutomata.makeStringUnion(matchedTerms);
+      LightAutomaton alternate = BasicAutomata.makeStringUnionLight(matchedTerms);
       //System.out.println("match " + matchedTerms.size() + " " + alternate.getNumberOfStates() + " states, sigma=" + alternate.getStartPoints().length);
       //AutomatonTestUtil.minimizeSimple(alternate);
       //System.out.println("minmize done");
-      System.out.println("\nTEST: make AQ1");
       AutomatonQuery a1 = new AutomatonQuery(new Term("field", ""), automaton);
-      System.out.println("\nTEST: make AQ2");
       AutomatonQuery a2 = new AutomatonQuery(new Term("field", ""), alternate);
 
       ScoreDoc[] origHits = searcher.search(a1, 25).scoreDocs;

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java Thu Jun 12 16:57:33 2014
@@ -33,10 +33,10 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.Rethrow;
 import org.apache.lucene.util.TestUtil;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.AutomatonTestUtil;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.BasicOperations;
+import org.apache.lucene.util.automaton.LightAutomaton;
 
 public class TestAutomatonQuery extends LuceneTestCase {
   private Directory directory;
@@ -86,7 +86,7 @@ public class TestAutomatonQuery extends 
     return searcher.search(query, 5).totalHits;
   }
   
-  private void assertAutomatonHits(int expected, Automaton automaton)
+  private void assertAutomatonHits(int expected, LightAutomaton automaton)
       throws IOException {
     AutomatonQuery query = new AutomatonQuery(newTerm("bogus"), automaton);
     
@@ -107,21 +107,25 @@ public class TestAutomatonQuery extends 
    * Test some very simple automata.
    */
   public void testBasicAutomata() throws IOException {
-    assertAutomatonHits(0, BasicAutomata.makeEmpty());
-    assertAutomatonHits(0, BasicAutomata.makeEmptyString());
-    assertAutomatonHits(2, BasicAutomata.makeAnyChar());
-    assertAutomatonHits(3, BasicAutomata.makeAnyString());
-    assertAutomatonHits(2, BasicAutomata.makeString("doc"));
-    assertAutomatonHits(1, BasicAutomata.makeChar('a'));
-    assertAutomatonHits(2, BasicAutomata.makeCharRange('a', 'b'));
-    assertAutomatonHits(2, BasicAutomata.makeInterval(1233, 2346, 0));
-    assertAutomatonHits(1, BasicAutomata.makeInterval(0, 2000, 0));
-    assertAutomatonHits(2, BasicOperations.union(BasicAutomata.makeChar('a'),
-        BasicAutomata.makeChar('b')));
-    assertAutomatonHits(0, BasicOperations.intersection(BasicAutomata
-        .makeChar('a'), BasicAutomata.makeChar('b')));
-    assertAutomatonHits(1, BasicOperations.minus(BasicAutomata.makeCharRange('a', 'b'), 
-        BasicAutomata.makeChar('a')));
+
+    // nocommit
+    assertAutomatonHits(2, BasicAutomata.makeIntervalLight(1233, 2346, 0));
+
+    assertAutomatonHits(0, BasicAutomata.makeEmptyLight());
+    assertAutomatonHits(0, BasicAutomata.makeEmptyStringLight());
+    assertAutomatonHits(2, BasicAutomata.makeAnyCharLight());
+    assertAutomatonHits(3, BasicAutomata.makeAnyStringLight());
+    assertAutomatonHits(2, BasicAutomata.makeStringLight("doc"));
+    assertAutomatonHits(1, BasicAutomata.makeCharLight('a'));
+    assertAutomatonHits(2, BasicAutomata.makeCharRangeLight('a', 'b'));
+    assertAutomatonHits(2, BasicAutomata.makeIntervalLight(1233, 2346, 0));
+    assertAutomatonHits(1, BasicAutomata.makeIntervalLight(0, 2000, 0));
+    assertAutomatonHits(2, BasicOperations.unionLight(BasicAutomata.makeCharLight('a'),
+        BasicAutomata.makeCharLight('b')));
+    assertAutomatonHits(0, BasicOperations.intersectionLight(BasicAutomata
+        .makeCharLight('a'), BasicAutomata.makeCharLight('b')));
+    assertAutomatonHits(1, BasicOperations.minusLight(BasicAutomata.makeCharRangeLight('a', 'b'), 
+        BasicAutomata.makeCharLight('a')));
   }
   
   /**
@@ -131,26 +135,27 @@ public class TestAutomatonQuery extends 
   public void testNFA() throws IOException {
     // accept this or three, the union is an NFA (two transitions for 't' from
     // initial state)
-    Automaton nfa = BasicOperations.union(BasicAutomata.makeString("this"),
-        BasicAutomata.makeString("three"));
+    LightAutomaton nfa = BasicOperations.unionLight(BasicAutomata.makeStringLight("this"),
+        BasicAutomata.makeStringLight("three"));
     assertAutomatonHits(2, nfa);
   }
   
   public void testEquals() {
     AutomatonQuery a1 = new AutomatonQuery(newTerm("foobar"), BasicAutomata
-        .makeString("foobar"));
+        .makeStringLight("foobar"));
     // reference to a1
     AutomatonQuery a2 = a1;
     // same as a1 (accepts the same language, same term)
-    AutomatonQuery a3 = new AutomatonQuery(newTerm("foobar"), BasicOperations
-        .concatenate(BasicAutomata.makeString("foo"), BasicAutomata
-            .makeString("bar")));
+    AutomatonQuery a3 = new AutomatonQuery(newTerm("foobar"),
+                            BasicOperations.concatenateLight(
+                                 BasicAutomata.makeStringLight("foo"),
+                                 BasicAutomata.makeStringLight("bar")));
     // different than a1 (same term, but different language)
-    AutomatonQuery a4 = new AutomatonQuery(newTerm("foobar"), BasicAutomata
-        .makeString("different"));
+    AutomatonQuery a4 = new AutomatonQuery(newTerm("foobar"),
+                                           BasicAutomata.makeStringLight("different"));
     // different than a1 (different term, same language)
-    AutomatonQuery a5 = new AutomatonQuery(newTerm("blah"), BasicAutomata
-        .makeString("foobar"));
+    AutomatonQuery a5 = new AutomatonQuery(newTerm("blah"),
+                                           BasicAutomata.makeStringLight("foobar"));
     
     assertEquals(a1.hashCode(), a2.hashCode());
     assertEquals(a1, a2);
@@ -176,8 +181,7 @@ public class TestAutomatonQuery extends 
    * MultiTermQuery semantics.
    */
   public void testRewriteSingleTerm() throws IOException {
-    AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), BasicAutomata
-        .makeString("piece"));
+    AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), BasicAutomata.makeStringLight("piece"));
     Terms terms = MultiFields.getTerms(searcher.getIndexReader(), FN);
     assertTrue(aq.getTermsEnum(terms) instanceof SingleTermsEnum);
     assertEquals(1, automatonQueryNrHits(aq));
@@ -188,10 +192,8 @@ public class TestAutomatonQuery extends 
    * MultiTermQuery semantics.
    */
   public void testRewritePrefix() throws IOException {
-    Automaton pfx = BasicAutomata.makeString("do");
-    pfx.expandSingleton(); // expand singleton representation for testing
-    Automaton prefixAutomaton = BasicOperations.concatenate(pfx, BasicAutomata
-        .makeAnyString());
+    LightAutomaton pfx = BasicAutomata.makeStringLight("do");
+    LightAutomaton prefixAutomaton = BasicOperations.concatenateLight(pfx, BasicAutomata.makeAnyStringLight());
     AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), prefixAutomaton);
     Terms terms = MultiFields.getTerms(searcher.getIndexReader(), FN);
     assertTrue(aq.getTermsEnum(terms) instanceof PrefixTermsEnum);
@@ -202,8 +204,7 @@ public class TestAutomatonQuery extends 
    * Test handling of the empty language
    */
   public void testEmptyOptimization() throws IOException {
-    AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), BasicAutomata
-        .makeEmpty());
+    AutomatonQuery aq = new AutomatonQuery(newTerm("bogus"), BasicAutomata.makeEmptyLight());
     // not yet available: assertTrue(aq.getEnum(searcher.getIndexReader())
     // instanceof EmptyTermEnum);
     Terms terms = MultiFields.getTerms(searcher.getIndexReader(), FN);

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java Thu Jun 12 16:57:33 2014
@@ -26,7 +26,6 @@ import org.apache.lucene.index.RandomInd
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.LightAutomaton;
 import org.apache.lucene.util.automaton.RegExp;
 

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java Thu Jun 12 16:57:33 2014
@@ -27,7 +27,6 @@ import org.apache.lucene.index.RandomInd
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.BasicOperations;
 import org.apache.lucene.util.automaton.LightAutomaton;

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java Thu Jun 12 16:57:33 2014
@@ -40,7 +40,6 @@ import org.apache.lucene.util.CharsRef;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
 import org.apache.lucene.util.UnicodeUtil;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.AutomatonTestUtil;
 import org.apache.lucene.util.automaton.CharacterRunAutomaton;
 import org.apache.lucene.util.automaton.LightAutomaton;

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestCompiledAutomaton.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestCompiledAutomaton.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestCompiledAutomaton.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestCompiledAutomaton.java Thu Jun 12 16:57:33 2014
@@ -36,7 +36,7 @@ public class TestCompiledAutomaton exten
       terms.add(new BytesRef(s));
     }
     Collections.sort(terms);
-    final Automaton a = DaciukMihovAutomatonBuilder.build(terms);
+    final LightAutomaton a = DaciukMihovAutomatonBuilderLight.build(terms);
     return new CompiledAutomaton(a, true, false);
   }
 
@@ -109,8 +109,7 @@ public class TestCompiledAutomaton exten
 
   public void testBasic() throws Exception {
     CompiledAutomaton c = build("fob", "foo", "goo");
-    // nocommit
-    //testFloor(c, "goo", "goo");
+    testFloor(c, "goo", "goo");
     testFloor(c, "ga", "foo");
     testFloor(c, "g", "foo");
     testFloor(c, "foc", "fob");

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java Thu Jun 12 16:57:33 2014
@@ -30,7 +30,7 @@ import org.apache.lucene.util.TestUtil;
  * somewhat randomly, by determinizing a huge random lexicon.
  */
 public class TestDeterminizeLexicon extends LuceneTestCase {
-  private List<Automaton> automata = new ArrayList<>();
+  private List<LightAutomaton> automata = new ArrayList<>();
   private List<String> terms = new ArrayList<>();
   
   public void testLexicon() throws Exception {
@@ -41,7 +41,7 @@ public class TestDeterminizeLexicon exte
       for (int j = 0; j < 5000; j++) {
         String randomString = TestUtil.randomUnicodeString(random());
         terms.add(randomString);
-        automata.add(BasicAutomata.makeString(randomString));
+        automata.add(BasicAutomata.makeStringLight(randomString));
       }
       assertLexicon();
     }
@@ -49,8 +49,8 @@ public class TestDeterminizeLexicon exte
   
   public void assertLexicon() throws Exception {
     Collections.shuffle(automata, random());
-    final Automaton lex = BasicOperations.union(automata);
-    lex.determinize();
+    LightAutomaton lex = BasicOperations.unionLight(automata);
+    lex = BasicOperations.determinize(lex);
     assertTrue(SpecialOperations.isFinite(lex));
     for (String s : terms) {
       assertTrue(BasicOperations.run(lex, s));

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestLightAutomaton.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestLightAutomaton.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestLightAutomaton.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestLightAutomaton.java Thu Jun 12 16:57:33 2014
@@ -22,6 +22,8 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.WildcardQuery;
 import org.apache.lucene.util.IntsRef;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.automaton.AutomatonTestUtil.RandomAcceptedStringsLight;
@@ -337,4 +339,44 @@ public class TestLightAutomaton extends 
       
     }
   }
+
+  // nocommit testMinus
+  public void testMinus() throws Exception {
+    LightAutomaton a1 = BasicAutomata.makeStringLight("foobar");
+    LightAutomaton a2 = BasicAutomata.makeStringLight("boobar");
+    LightAutomaton a3 = BasicAutomata.makeStringLight("beebar");
+    LightAutomaton a = BasicOperations.unionLight(Arrays.asList(a1, a2, a3));
+    if (random().nextBoolean()) {
+      a = BasicOperations.determinize(a);
+    } else if (random().nextBoolean()) {
+      a = MinimizationOperationsLight.minimize(a);
+    }
+
+    LightAutomaton a4 = BasicOperations.determinize(BasicOperations.minusLight(a, a2));
+    
+    assertTrue(BasicOperations.run(a4, "foobar"));
+    assertFalse(BasicOperations.run(a4, "boobar"));
+    assertTrue(BasicOperations.run(a4, "beebar"));
+
+    // nocommit test getFinitStrings count == 2
+
+    a4 = BasicOperations.determinize(BasicOperations.minusLight(a4, a1));
+    assertFalse(BasicOperations.run(a4, "foobar"));
+    assertFalse(BasicOperations.run(a4, "boobar"));
+    assertTrue(BasicOperations.run(a4, "beebar"));
+
+    a4 = BasicOperations.determinize(BasicOperations.minusLight(a4, a3));
+    assertFalse(BasicOperations.run(a4, "foobar"));
+    assertFalse(BasicOperations.run(a4, "boobar"));
+    assertFalse(BasicOperations.run(a4, "beebar"));
+  }
+
+  // nocommit
+  //public void testWildcard() throws Exception {
+  //WildcardQuery.toAutomaton(new Term("foo", "bar*")).writeDot("wq");
+  //}
+
+  // nocommit more tests ... it's an algebra
+
+  // nocommit random test for testInterval if we don't have one already
 }

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestSpecialOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestSpecialOperations.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestSpecialOperations.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestSpecialOperations.java Thu Jun 12 16:57:33 2014
@@ -199,7 +199,7 @@ public class TestSpecialOperations exten
   }
 
   public void testSingletonNoLimit() {
-    Set<IntsRef> result = SpecialOperations.getFiniteStrings(BasicAutomata.makeString("foobar"), -1);
+    Set<IntsRef> result = SpecialOperations.getFiniteStrings(BasicAutomata.makeStringLight("foobar"), -1);
     assertEquals(1, result.size());
     IntsRef scratch = new IntsRef();
     Util.toUTF32("foobar".toCharArray(), 0, 6, scratch);
@@ -207,7 +207,7 @@ public class TestSpecialOperations exten
   }
 
   public void testSingletonLimit1() {
-    Set<IntsRef> result = SpecialOperations.getFiniteStrings(BasicAutomata.makeString("foobar"), 1);
+    Set<IntsRef> result = SpecialOperations.getFiniteStrings(BasicAutomata.makeStringLight("foobar"), 1);
     assertEquals(1, result.size());
     IntsRef scratch = new IntsRef();
     Util.toUTF32("foobar".toCharArray(), 0, 6, scratch);

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java Thu Jun 12 16:57:33 2014
@@ -151,12 +151,7 @@ public class TestUTF32ToUTF8 extends Luc
         continue;
       }
       
-      final Automaton a = new Automaton();
-      final State end = new State();
-      end.setAccept(true);
-      a.getInitialState().addTransition(new Transition(startCode, endCode, end));
-      a.setDeterministic(true);
-
+      LightAutomaton a = BasicAutomata.makeCharRangeLight(startCode, endCode);
       testOne(r, new ByteRunAutomaton(a), startCode, endCode, ITERS_PER_DFA);
     }
   }

Modified: lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/branches/lucene5752/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java Thu Jun 12 16:57:33 2014
@@ -68,7 +68,6 @@ import org.apache.lucene.util.LuceneTest
 import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.CompiledAutomaton;
 import org.apache.lucene.util.automaton.LightAutomaton;
 import org.apache.lucene.util.automaton.RegExp;

Modified: lucene/dev/branches/lucene5752/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/MultiTermHighlighting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/MultiTermHighlighting.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/MultiTermHighlighting.java (original)
+++ lucene/dev/branches/lucene5752/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/MultiTermHighlighting.java Thu Jun 12 16:57:33 2014
@@ -106,8 +106,8 @@ class MultiTermHighlighting {
       final PrefixQuery pq = (PrefixQuery) query;
       Term prefix = pq.getPrefix();
       if (prefix.field().equals(field)) {
-        list.add(new CharacterRunAutomaton(BasicOperations.concatenate(BasicAutomata.makeString(prefix.text()), 
-                                                                       BasicAutomata.makeAnyString())) {
+        list.add(new CharacterRunAutomaton(BasicOperations.concatenateLight(BasicAutomata.makeStringLight(prefix.text()), 
+                                                                            BasicAutomata.makeAnyStringLight())) {
           @Override
           public String toString() {
             return pq.toString();

Modified: lucene/dev/branches/lucene5752/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (original)
+++ lucene/dev/branches/lucene5752/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java Thu Jun 12 16:57:33 2014
@@ -1340,7 +1340,7 @@ public class HighlighterTest extends Bas
       @Override
       public void run() throws Exception {
         String goodWord = "goodtoken";
-        CharacterRunAutomaton stopWords = new CharacterRunAutomaton(BasicAutomata.makeString("stoppedtoken"));
+        CharacterRunAutomaton stopWords = new CharacterRunAutomaton(BasicAutomata.makeStringLight("stoppedtoken"));
         // we disable MockTokenizer checks because we will forcefully limit the 
         // tokenstream and call end() before incrementToken() returns false.
         final MockAnalyzer analyzer = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, stopWords);

Modified: lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java (original)
+++ lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java Thu Jun 12 16:57:33 2014
@@ -557,7 +557,7 @@ public class TestPrecedenceQueryParser e
   }
 
   public void testBoost() throws Exception {
-    CharacterRunAutomaton stopSet = new CharacterRunAutomaton(BasicAutomata.makeString("on"));
+    CharacterRunAutomaton stopSet = new CharacterRunAutomaton(BasicAutomata.makeStringLight("on"));
     Analyzer oneStopAnalyzer = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, stopSet);
 
     PrecedenceQueryParser qp = new PrecedenceQueryParser();

Modified: lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java (original)
+++ lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java Thu Jun 12 16:57:33 2014
@@ -957,7 +957,7 @@ public class TestQPHelper extends Lucene
   }
 
   public void testBoost() throws Exception {
-    CharacterRunAutomaton stopSet = new CharacterRunAutomaton(BasicAutomata.makeString("on"));
+    CharacterRunAutomaton stopSet = new CharacterRunAutomaton(BasicAutomata.makeStringLight("on"));
     Analyzer oneStopAnalyzer = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, stopSet);
     StandardQueryParser qp = new StandardQueryParser();
     qp.setAnalyzer(oneStopAnalyzer);

Modified: lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java (original)
+++ lucene/dev/branches/lucene5752/lucene/queryparser/src/test/org/apache/lucene/queryparser/util/QueryParserTestBase.java Thu Jun 12 16:57:33 2014
@@ -868,7 +868,7 @@ public abstract class QueryParserTestBas
 
   public void testBoost()
     throws Exception {
-    CharacterRunAutomaton stopWords = new CharacterRunAutomaton(BasicAutomata.makeString("on"));
+    CharacterRunAutomaton stopWords = new CharacterRunAutomaton(BasicAutomata.makeStringLight("on"));
     Analyzer oneStopAnalyzer = new MockAnalyzer(random(), MockTokenizer.SIMPLE, true, stopWords);
     CommonQueryParserConfiguration qp = getParserConfig(oneStopAnalyzer);
     Query q = getQuery("on^1.0",qp);

Modified: lucene/dev/branches/lucene5752/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsReader.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsReader.java (original)
+++ lucene/dev/branches/lucene5752/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsReader.java Thu Jun 12 16:57:33 2014
@@ -50,7 +50,6 @@ import org.apache.lucene.util.RamUsageEs
 import org.apache.lucene.util.StringHelper;
 import org.apache.lucene.util.automaton.CompiledAutomaton;
 import org.apache.lucene.util.automaton.RunAutomaton;
-import org.apache.lucene.util.automaton.Transition;
 import org.apache.lucene.util.fst.ByteSequenceOutputs;
 import org.apache.lucene.util.fst.FST;
 import org.apache.lucene.util.fst.Outputs;

Modified: lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java (original)
+++ lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggester.java Thu Jun 12 16:57:33 2014
@@ -43,12 +43,9 @@ import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.IntsRef;
 import org.apache.lucene.util.OfflineSorter;
 import org.apache.lucene.util.UnicodeUtil;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicOperations;
 import org.apache.lucene.util.automaton.LightAutomaton;
 import org.apache.lucene.util.automaton.SpecialOperations;
-import org.apache.lucene.util.automaton.State;
-import org.apache.lucene.util.automaton.Transition;
 import org.apache.lucene.util.fst.Builder;
 import org.apache.lucene.util.fst.ByteSequenceOutputs;
 import org.apache.lucene.util.fst.FST.BytesReader;
@@ -302,7 +299,6 @@ public class AnalyzingSuggester extends 
     int[] topoSortStates = topoSortStates(a);
     for(int i=0;i<topoSortStates.length;i++) {
       int state = topoSortStates[topoSortStates.length-1-i];
-      List<Transition> newTransitions = new ArrayList<>();
       int count = a.initTransition(state, t);
       for(int j=0;j<count;j++) {
         a.getNextTransition(t);

Modified: lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java (original)
+++ lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FSTUtil.java Thu Jun 12 16:57:33 2014
@@ -22,11 +22,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.lucene.util.IntsRef;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicOperations;
 import org.apache.lucene.util.automaton.LightAutomaton;
-import org.apache.lucene.util.automaton.State;
-import org.apache.lucene.util.automaton.Transition;
 import org.apache.lucene.util.fst.FST;
 import org.apache.lucene.util.fst.Util;
 

Modified: lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java (original)
+++ lucene/dev/branches/lucene5752/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java Thu Jun 12 16:57:33 2014
@@ -28,13 +28,11 @@ import org.apache.lucene.analysis.TokenS
 import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; // javadocs
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.IntsRef;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.BasicOperations;
 import org.apache.lucene.util.automaton.LevenshteinAutomata;
 import org.apache.lucene.util.automaton.LightAutomaton;
 import org.apache.lucene.util.automaton.SpecialOperations;
-import org.apache.lucene.util.automaton.UTF32ToUTF8;
 import org.apache.lucene.util.automaton.UTF32ToUTF8Light;
 import org.apache.lucene.util.fst.FST;
 import org.apache.lucene.util.fst.PairOutputs.Pair;

Modified: lucene/dev/branches/lucene5752/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java (original)
+++ lucene/dev/branches/lucene5752/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/FuzzySuggesterTest.java Thu Jun 12 16:57:33 2014
@@ -47,10 +47,8 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.IntsRef;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.TestUtil;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicOperations;
 import org.apache.lucene.util.automaton.LightAutomaton;
-import org.apache.lucene.util.automaton.State;
 import org.apache.lucene.util.fst.Util;
 
 public class FuzzySuggesterTest extends LuceneTestCase {

Modified: lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/analysis/MockTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/analysis/MockTokenFilter.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/analysis/MockTokenFilter.java (original)
+++ lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/analysis/MockTokenFilter.java Thu Jun 12 16:57:33 2014
@@ -17,8 +17,8 @@ package org.apache.lucene.analysis;
  * limitations under the License.
  */
 
-import static org.apache.lucene.util.automaton.BasicAutomata.makeEmpty;
-import static org.apache.lucene.util.automaton.BasicAutomata.makeString;
+import static org.apache.lucene.util.automaton.BasicAutomata.makeEmptyLight;
+import static org.apache.lucene.util.automaton.BasicAutomata.makeStringLight;
 
 import java.io.IOException;
 import java.util.Arrays;
@@ -39,20 +39,20 @@ import org.apache.lucene.util.automaton.
 public final class MockTokenFilter extends TokenFilter {
   /** Empty set of stopwords */
   public static final CharacterRunAutomaton EMPTY_STOPSET =
-    new CharacterRunAutomaton(makeEmpty());
+    new CharacterRunAutomaton(makeEmptyLight());
   
   /** Set of common english stopwords */
   public static final CharacterRunAutomaton ENGLISH_STOPSET = 
-    new CharacterRunAutomaton(BasicOperations.union(Arrays.asList(
-      makeString("a"), makeString("an"), makeString("and"), makeString("are"),
-      makeString("as"), makeString("at"), makeString("be"), makeString("but"), 
-      makeString("by"), makeString("for"), makeString("if"), makeString("in"), 
-      makeString("into"), makeString("is"), makeString("it"), makeString("no"),
-      makeString("not"), makeString("of"), makeString("on"), makeString("or"), 
-      makeString("such"), makeString("that"), makeString("the"), makeString("their"), 
-      makeString("then"), makeString("there"), makeString("these"), makeString("they"), 
-      makeString("this"), makeString("to"), makeString("was"), makeString("will"), 
-      makeString("with"))));
+    new CharacterRunAutomaton(BasicOperations.unionLight(Arrays.asList(
+      makeStringLight("a"), makeStringLight("an"), makeStringLight("and"), makeStringLight("are"),
+      makeStringLight("as"), makeStringLight("at"), makeStringLight("be"), makeStringLight("but"), 
+      makeStringLight("by"), makeStringLight("for"), makeStringLight("if"), makeStringLight("in"), 
+      makeStringLight("into"), makeStringLight("is"), makeStringLight("it"), makeStringLight("no"),
+      makeStringLight("not"), makeStringLight("of"), makeStringLight("on"), makeStringLight("or"), 
+      makeStringLight("such"), makeStringLight("that"), makeStringLight("the"), makeStringLight("their"), 
+      makeStringLight("then"), makeStringLight("there"), makeStringLight("these"), makeStringLight("they"), 
+      makeStringLight("this"), makeStringLight("to"), makeStringLight("was"), makeStringLight("will"), 
+      makeStringLight("with"))));
   
   private final CharacterRunAutomaton filter;
 

Modified: lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java (original)
+++ lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java Thu Jun 12 16:57:33 2014
@@ -57,7 +57,7 @@ public abstract class SearchEquivalenceT
     Random random = random();
     directory = newDirectory();
     stopword = "" + randomChar();
-    CharacterRunAutomaton stopset = new CharacterRunAutomaton(BasicAutomata.makeString(stopword));
+    CharacterRunAutomaton stopset = new CharacterRunAutomaton(BasicAutomata.makeStringLight(stopword));
     analyzer = new MockAnalyzer(random, MockTokenizer.WHITESPACE, false, stopset);
     RandomIndexWriter iw = new RandomIndexWriter(random, directory, analyzer);
     Document doc = new Document();

Modified: lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java (original)
+++ lucene/dev/branches/lucene5752/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java Thu Jun 12 16:57:33 2014
@@ -131,143 +131,6 @@ public class AutomatonTestUtil {
 
   /**
    * Lets you retrieve random strings accepted
-   * by an Automaton.
-   * <p>
-   * Once created, call {@link #getRandomAcceptedString(Random)}
-   * to get a new string (in UTF-32 codepoints).
-   */
-  public static class RandomAcceptedStrings {
-
-    private final Map<Transition,Boolean> leadsToAccept;
-    private final Automaton a;
-
-    private static class ArrivingTransition {
-      final State from;
-      final Transition t;
-      public ArrivingTransition(State from, Transition t) {
-        this.from = from;
-        this.t = t;
-      }
-    }
-
-    public RandomAcceptedStrings(Automaton a) {
-      this.a = a;
-      if (a.isSingleton()) {
-        leadsToAccept = null;
-        return;
-      }
-
-      // must use IdentityHashmap because two Transitions w/
-      // different start nodes can be considered the same
-      leadsToAccept = new IdentityHashMap<>();
-      final Map<State,List<ArrivingTransition>> allArriving = new HashMap<>();
-
-      final LinkedList<State> q = new LinkedList<>();
-      final Set<State> seen = new HashSet<>();
-
-      // reverse map the transitions, so we can quickly look
-      // up all arriving transitions to a given state
-      for(State s: a.getNumberedStates()) {
-        for(int i=0;i<s.numTransitions;i++) {
-          final Transition t = s.transitionsArray[i];
-          List<ArrivingTransition> tl = allArriving.get(t.to);
-          if (tl == null) {
-            tl = new ArrayList<>();
-            allArriving.put(t.to, tl);
-          }
-          tl.add(new ArrivingTransition(s, t));
-        }
-        if (s.accept) {
-          q.add(s);
-          seen.add(s);
-        }
-      }
-
-      // Breadth-first search, from accept states,
-      // backwards:
-      while(!q.isEmpty()) {
-        final State s = q.removeFirst();
-        List<ArrivingTransition> arriving = allArriving.get(s);
-        if (arriving != null) {
-          for(ArrivingTransition at : arriving) {
-            final State from = at.from;
-            if (!seen.contains(from)) {
-              q.add(from);
-              seen.add(from);
-              leadsToAccept.put(at.t, Boolean.TRUE);
-            }
-          }
-        }
-      }
-    }
-
-    public int[] getRandomAcceptedString(Random r) {
-
-      final List<Integer> soFar = new ArrayList<>();
-      if (a.isSingleton()) {
-        // accepts only one
-        final String s = a.singleton;
-      
-        int charUpto = 0;
-        while(charUpto < s.length()) {
-          final int cp = s.codePointAt(charUpto);
-          charUpto += Character.charCount(cp);
-          soFar.add(cp);
-        }
-      } else {
-
-        State s = a.initial;
-
-        while(true) {
-      
-          if (s.accept) {
-            if (s.numTransitions == 0) {
-              // stop now
-              break;
-            } else {
-              if (r.nextBoolean()) {
-                break;
-              }
-            }
-          }
-
-          if (s.numTransitions == 0) {
-            throw new RuntimeException("this automaton has dead states");
-          }
-
-          boolean cheat = r.nextBoolean();
-
-          final Transition t;
-          if (cheat) {
-            // pick a transition that we know is the fastest
-            // path to an accept state
-            List<Transition> toAccept = new ArrayList<>();
-            for(int i=0;i<s.numTransitions;i++) {
-              final Transition t0 = s.transitionsArray[i];
-              if (leadsToAccept.containsKey(t0)) {
-                toAccept.add(t0);
-              }
-            }
-            if (toAccept.size() == 0) {
-              // this is OK -- it means we jumped into a cycle
-              t = s.transitionsArray[r.nextInt(s.numTransitions)];
-            } else {
-              t = toAccept.get(r.nextInt(toAccept.size()));
-            }
-          } else {
-            t = s.transitionsArray[r.nextInt(s.numTransitions)];
-          }
-          soFar.add(getRandomCodePoint(r, t.min, t.max));
-          s = t.to;
-        }
-      }
-
-      return ArrayUtil.toIntArray(soFar);
-    }
-  }
-
-  /**
-   * Lets you retrieve random strings accepted
    * by a LightAutomaton.
    * <p>
    * Once created, call {@link #getRandomAcceptedString(Random)}
@@ -449,16 +312,6 @@ public class AutomatonTestUtil {
   /**
    * Simple, original brics implementation of Brzozowski minimize()
    */
-  public static void minimizeSimple(Automaton a) {
-    if (a.isSingleton())
-      return;
-    determinizeSimple(a, SpecialOperations.reverse(a));
-    determinizeSimple(a, SpecialOperations.reverse(a));
-  }
-
-  /**
-   * Simple, original brics implementation of Brzozowski minimize()
-   */
   public static LightAutomaton minimizeSimple(LightAutomaton a) {
     Set<Integer> initialSet = new HashSet<Integer>();
     a = determinizeSimpleLight(SpecialOperations.reverse(a, initialSet), initialSet);
@@ -470,65 +323,6 @@ public class AutomatonTestUtil {
   /**
    * Simple, original brics implementation of determinize()
    */
-  public static void determinizeSimple(Automaton a) {
-    if (a.deterministic || a.isSingleton())
-      return;
-    Set<State> initialset = new HashSet<>();
-    initialset.add(a.initial);
-    determinizeSimple(a, initialset);
-  }
-  
-  /** 
-   * Simple, original brics implementation of determinize()
-   * Determinizes the given automaton using the given set of initial states. 
-   */
-  public static void determinizeSimple(Automaton a, Set<State> initialset) {
-    int[] points = a.getStartPoints();
-    // subset construction
-    Map<Set<State>, Set<State>> sets = new HashMap<>();
-    LinkedList<Set<State>> worklist = new LinkedList<>();
-    Map<Set<State>, State> newstate = new HashMap<>();
-    sets.put(initialset, initialset);
-    worklist.add(initialset);
-    a.initial = new State();
-    newstate.put(initialset, a.initial);
-    while (worklist.size() > 0) {
-      Set<State> s = worklist.removeFirst();
-      State r = newstate.get(s);
-      for (State q : s)
-        if (q.accept) {
-          r.accept = true;
-          break;
-        }
-      for (int n = 0; n < points.length; n++) {
-        Set<State> p = new HashSet<>();
-        for (State q : s)
-          for (Transition t : q.getTransitions())
-            if (t.min <= points[n] && points[n] <= t.max)
-              p.add(t.to);
-        if (!sets.containsKey(p)) {
-          sets.put(p, p);
-          worklist.add(p);
-          newstate.put(p, new State());
-        }
-        State q = newstate.get(p);
-        int min = points[n];
-        int max;
-        if (n + 1 < points.length)
-          max = points[n + 1] - 1;
-        else
-          max = Character.MAX_CODE_POINT;
-        r.addTransition(new Transition(min, max, q));
-      }
-    }
-    a.deterministic = true;
-    a.clearNumberedStates();
-    a.removeDeadTransitions();
-  }
-
-  /**
-   * Simple, original brics implementation of determinize()
-   */
   public static LightAutomaton determinizeSimpleLight(LightAutomaton a) {
     Set<Integer> initialset = new HashSet<>();
     initialset.add(0);
@@ -604,62 +398,6 @@ public class AutomatonTestUtil {
    * frame for each digit in the returned strings (ie, max
    * is the max length returned string).
    */
-  public static Set<IntsRef> getFiniteStringsRecursive(Automaton a, int limit) {
-    HashSet<IntsRef> strings = new HashSet<>();
-    if (a.isSingleton()) {
-      if (limit > 0) {
-        strings.add(Util.toUTF32(a.singleton, new IntsRef()));
-      }
-    } else if (!getFiniteStrings(a.initial, new HashSet<State>(), strings, new IntsRef(), limit)) {
-      return strings;
-    }
-    return strings;
-  }
-
-  /**
-   * Returns the strings that can be produced from the given state, or
-   * false if more than <code>limit</code> strings are found. 
-   * <code>limit</code>&lt;0 means "infinite".
-   */
-  private static boolean getFiniteStrings(State s, HashSet<State> pathstates, 
-      HashSet<IntsRef> strings, IntsRef path, int limit) {
-    pathstates.add(s);
-    for (Transition t : s.getTransitions()) {
-      if (pathstates.contains(t.to)) {
-        return false;
-      }
-      for (int n = t.min; n <= t.max; n++) {
-        path.grow(path.length+1);
-        path.ints[path.length] = n;
-        path.length++;
-        if (t.to.accept) {
-          strings.add(IntsRef.deepCopyOf(path));
-          if (limit >= 0 && strings.size() > limit) {
-            return false;
-          }
-        }
-        if (!getFiniteStrings(t.to, pathstates, strings, path, limit)) {
-          return false;
-        }
-        path.length--;
-      }
-    }
-    pathstates.remove(s);
-    return true;
-  }
-
-  /**
-   * Simple, original implementation of getFiniteStrings.
-   *
-   * <p>Returns the set of accepted strings, assuming that at most
-   * <code>limit</code> strings are accepted. If more than <code>limit</code> 
-   * strings are accepted, the first limit strings found are returned. If <code>limit</code>&lt;0, then 
-   * the limit is infinite.
-   *
-   * <p>This implementation is recursive: it uses one stack
-   * frame for each digit in the returned strings (ie, max
-   * is the max length returned string).
-   */
   public static Set<IntsRef> getFiniteStringsRecursiveLight(LightAutomaton a, int limit) {
     HashSet<IntsRef> strings = new HashSet<>();
     if (!getFiniteStringsLight(a, 0, new HashSet<Integer>(), strings, new IntsRef(), limit)) {
@@ -709,31 +447,6 @@ public class AutomatonTestUtil {
    * WARNING: this method is slow, it will blow up if the automaton is large.
    * this is only used to test the correctness of our faster implementation.
    */
-  public static boolean isFiniteSlow(Automaton a) {
-    if (a.isSingleton()) return true;
-    return isFiniteSlow(a.initial, new HashSet<State>());
-  }
-  
-  /**
-   * Checks whether there is a loop containing s. (This is sufficient since
-   * there are never transitions to dead states.)
-   */
-  // TODO: not great that this is recursive... in theory a
-  // large automata could exceed java's stack
-  private static boolean isFiniteSlow(State s, HashSet<State> path) {
-    path.add(s);
-    for (Transition t : s.getTransitions())
-      if (path.contains(t.to) || !isFiniteSlow(t.to, path)) return false;
-    path.remove(s);
-    return true;
-  }
-
-  /**
-   * Returns true if the language of this automaton is finite.
-   * <p>
-   * WARNING: this method is slow, it will blow up if the automaton is large.
-   * this is only used to test the correctness of our faster implementation.
-   */
   public static boolean isFiniteSlow(LightAutomaton a) {
     return isFiniteSlow(a, 0, new HashSet<Integer>());
   }
@@ -758,17 +471,6 @@ public class AutomatonTestUtil {
     return true;
   }
   
-  
-  /**
-   * Checks that an automaton has no detached states that are unreachable
-   * from the initial state.
-   */
-  public static void assertNoDetachedStates(Automaton a) {
-    int numStates = a.getNumberOfStates();
-    a.clearNumberedStates(); // force recomputation of cached numbered states
-    assert numStates == a.getNumberOfStates() : "automaton has " + (numStates - a.getNumberOfStates()) + " detached states";
-  }
-
   /**
    * Checks that an automaton has no detached states that are unreachable
    * from the initial state.

Modified: lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java (original)
+++ lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java Thu Jun 12 16:57:33 2014
@@ -17,6 +17,12 @@
 
 package org.apache.solr.parser;
 
+import java.io.StringReader;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.util.TokenFilterFactory;
 import org.apache.lucene.index.Term;
@@ -34,9 +40,9 @@ import org.apache.lucene.search.Wildcard
 import org.apache.lucene.util.QueryBuilder;
 import org.apache.lucene.util.ToStringUtils;
 import org.apache.lucene.util.Version;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.BasicOperations;
+import org.apache.lucene.util.automaton.LightAutomaton;
 import org.apache.lucene.util.automaton.SpecialOperations;
 import org.apache.solr.analysis.ReversedWildcardFilterFactory;
 import org.apache.solr.analysis.TokenizerChain;
@@ -49,12 +55,6 @@ import org.apache.solr.schema.TextField;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.SyntaxError;
 
-import java.io.StringReader;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 /** This class is overridden by QueryParser in QueryParser.jj
  * and acts to separate the majority of the Java code from the .jj grammar file. 
  */
@@ -777,19 +777,22 @@ public abstract class SolrQueryParserBas
     if (factory != null) {
       Term term = new Term(field, termStr);
       // fsa representing the query
-      Automaton automaton = WildcardQuery.toAutomaton(term);
+      LightAutomaton automaton = WildcardQuery.toAutomaton(term);
       // TODO: we should likely use the automaton to calculate shouldReverse, too.
       if (factory.shouldReverse(termStr)) {
-        automaton = BasicOperations.concatenate(automaton, BasicAutomata.makeChar(factory.getMarkerChar()));
-        SpecialOperations.reverse(automaton);
+        automaton = BasicOperations.concatenateLight(automaton, BasicAutomata.makeCharLight(factory.getMarkerChar()));
+        automaton = SpecialOperations.reverse(automaton);
+        // nocommit why did i have to insert det here?  reverse didn't det before
+        automaton = BasicOperations.determinize(automaton);
       } else {
         // reverse wildcardfilter is active: remove false positives
         // fsa representing false positives (markerChar*)
-        Automaton falsePositives = BasicOperations.concatenate(
-            BasicAutomata.makeChar(factory.getMarkerChar()),
-            BasicAutomata.makeAnyString());
+        LightAutomaton falsePositives = BasicOperations.concatenateLight(
+            BasicAutomata.makeCharLight(factory.getMarkerChar()),
+            BasicAutomata.makeAnyStringLight());
         // subtract these away
-        automaton = BasicOperations.minus(automaton, falsePositives);
+        automaton = BasicOperations.minusLight(automaton, falsePositives);
+        // nocommit and do i need to det here?
       }
       return new AutomatonQuery(term, automaton) {
         // override toString so its completely transparent

Modified: lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java (original)
+++ lucene/dev/branches/lucene5752/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java Thu Jun 12 16:57:33 2014
@@ -25,7 +25,6 @@ import org.apache.lucene.analysis.util.T
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.*;
 import org.apache.lucene.util.ToStringUtils;
-import org.apache.lucene.util.automaton.Automaton;
 import org.apache.lucene.util.automaton.BasicAutomata;
 import org.apache.lucene.util.automaton.BasicOperations;
 import org.apache.lucene.util.automaton.SpecialOperations;

Modified: lucene/dev/branches/lucene5752/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java (original)
+++ lucene/dev/branches/lucene5752/solr/core/src/test/org/apache/solr/analysis/TestReversedWildcardFilterFactory.java Thu Jun 12 16:57:33 2014
@@ -19,7 +19,6 @@ package org.apache.solr.analysis;
 
 import java.io.IOException;
 import java.lang.reflect.Field;
-
 import java.util.HashMap;
 import java.util.Map;
 
@@ -27,7 +26,7 @@ import org.apache.lucene.analysis.Analyz
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.search.AutomatonQuery;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.util.automaton.Automaton;
+import org.apache.lucene.util.automaton.LightAutomaton;
 import org.apache.lucene.util.automaton.SpecialOperations;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.request.SolrQueryRequest;
@@ -160,11 +159,7 @@ public class TestReversedWildcardFilterF
     Query q = qp.parse(query);
     if (!(q instanceof AutomatonQuery))
       return false;
-    // this is a hack to get the protected Automaton field in AutomatonQuery,
-    // may break in later lucene versions - we have no getter... for good reasons.
-    final Field automatonField = AutomatonQuery.class.getDeclaredField("automaton");
-    automatonField.setAccessible(true);
-    Automaton automaton = (Automaton) automatonField.get(q);
+    LightAutomaton automaton = ((AutomatonQuery) q).getLightAutomaton();
     String prefix = SpecialOperations.getCommonPrefix(automaton);
     return prefix.length() > 0 && prefix.charAt(0) == '\u0001';
   }

Modified: lucene/dev/branches/lucene5752/solr/test-framework/src/java/org/apache/solr/analysis/MockTokenFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5752/solr/test-framework/src/java/org/apache/solr/analysis/MockTokenFilterFactory.java?rev=1602228&r1=1602227&r2=1602228&view=diff
==============================================================================
--- lucene/dev/branches/lucene5752/solr/test-framework/src/java/org/apache/solr/analysis/MockTokenFilterFactory.java (original)
+++ lucene/dev/branches/lucene5752/solr/test-framework/src/java/org/apache/solr/analysis/MockTokenFilterFactory.java Thu Jun 12 16:57:33 2014
@@ -48,7 +48,7 @@ public class MockTokenFilterFactory exte
       }
     } else if (null != stopregex) {
       RegExp regex = new RegExp(stopregex);
-      filter = new CharacterRunAutomaton(regex.toAutomaton());
+      filter = new CharacterRunAutomaton(regex.toLightAutomaton());
     } else {
       throw new IllegalArgumentException
           ("Configuration Error: either the 'stopset' or the 'stopregex' parameter must be specified.");
@@ -62,4 +62,4 @@ public class MockTokenFilterFactory exte
   public MockTokenFilter create(TokenStream stream) {
     return new MockTokenFilter(stream, filter);
   }
-}
\ No newline at end of file
+}