mirror of https://github.com/apache/lucene.git
remove dead states after union(), just like intersection() and complement() do
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1607139 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c75969c04
commit
33bf336cd4
|
@ -505,7 +505,7 @@ final public class Operations {
|
|||
|
||||
result.finishState();
|
||||
|
||||
return result;
|
||||
return removeDeadStates(result);
|
||||
}
|
||||
|
||||
// Simple custom ArrayList<Transition>
|
||||
|
|
|
@ -34,7 +34,14 @@ public class TestOperations extends LuceneTestCase {
|
|||
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) {
|
||||
|
|
Loading…
Reference in New Issue