Don't forget to fix on 3.x too :) Re using up -1, I agree... but, this actually simplified the *FSTEnum classes (I think?).
Mike McCandless http://blog.mikemccandless.com On Tue, Jun 14, 2011 at 7:13 AM, <[email protected]> wrote: > Author: dweiss > Date: Tue Jun 14 11:13:27 2011 > New Revision: 1135487 > > URL: http://svn.apache.org/viewvc?rev=1135487&view=rev > Log: > Replaced magic constants with END_LABEL. I don't like this END_LABEL > thingy... it makes code more complex and, worse of all, it makes having -1 > label on a transition impossible. > > Modified: > lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java > > Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java > URL: > http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java?rev=1135487&r1=1135486&r2=1135487&view=diff > ============================================================================== > --- lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java > (original) > +++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java Tue > Jun 14 11:13:27 2011 > @@ -490,7 +490,7 @@ public class FST<T> { > if (!targetHasArcs(follow)) { > //System.out.println(" end node"); > assert follow.isFinal(); > - arc.label = -1; > + arc.label = END_LABEL; > arc.output = follow.nextFinalOutput; > arc.flags = BIT_LAST_ARC; > return arc; > @@ -544,7 +544,7 @@ public class FST<T> { > //System.out.println(" readFirstTarget follow.target=" + follow.target > + " isFinal=" + follow.isFinal()); > if (follow.isFinal()) { > // Insert "fake" final first arc: > - arc.label = -1; > + arc.label = END_LABEL; > arc.output = follow.nextFinalOutput; > if (follow.target <= 0) { > arc.flags = BIT_LAST_ARC; > @@ -599,7 +599,7 @@ public class FST<T> { > > /** In-place read; returns the arc. */ > public Arc<T> readNextArc(Arc<T> arc) throws IOException { > - if (arc.label == -1) { > + if (arc.label == END_LABEL) { > // This was a fake inserted "final" arc > if (arc.nextArc <= 0) { > // This arc went to virtual final node, ie has no outgoing arcs > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
