lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1607138 - in /lucene/dev/branches/branch_4x/lucene/core/src: java/org/apache/lucene/util/automaton/Operations.java test/org/apache/lucene/util/automaton/TestOperations.java
Date Tue, 01 Jul 2014 16:50:43 GMT
Author: rmuir
Date: Tue Jul  1 16:50:43 2014
New Revision: 1607138

URL: http://svn.apache.org/r1607138
Log:
remove dead states after union(), just like intersection() and complement() do

Modified:
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java?rev=1607138&r1=1607137&r2=1607138&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java
Tue Jul  1 16:50:43 2014
@@ -505,7 +505,7 @@ final public class Operations {
 
     result.finishState();
 
-    return result;
+    return removeDeadStates(result);
   }
 
   // Simple custom ArrayList<Transition>

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java?rev=1607138&r1=1607137&r2=1607138&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java
Tue Jul  1 16:50:43 2014
@@ -34,7 +34,14 @@ public class TestOperations extends Luce
     Collections.sort(strings);
     Automaton union = Automata.makeStringUnion(strings);
     assertTrue(union.isDeterministic());
-    assertTrue(Operations.sameLanguage(union, naiveUnion(strings)));
+    assertFalse(Operations.hasDeadStatesFromInitial(union));
+    
+    Automaton naiveUnion = naiveUnion(strings);
+    assertTrue(naiveUnion.isDeterministic());
+    assertFalse(Operations.hasDeadStatesFromInitial(naiveUnion));
+
+    
+    assertTrue(Operations.sameLanguage(union, naiveUnion));
   }
 
   private static Automaton naiveUnion(List<BytesRef> strings) {



Mime
View raw message