You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/07/01 18:50:43 UTC
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
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) {