You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Michael McCandless <lu...@mikemccandless.com> on 2011/06/14 14:38:23 UTC

Re: svn commit: r1135487 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java

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,  <dw...@apache.org> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: svn commit: r1135487 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java

Posted by Michael McCandless <lu...@mikemccandless.com>.
On Tue, Jun 14, 2011 at 8:42 AM, Dawid Weiss
<da...@cs.put.poznan.pl> wrote:
>> Don't forget to fix on 3.x too :)
>
> Seems like you did it on both, right?

No, I just fixed the @Override 1.6 only issue, not this one!

>> Re using up -1, I agree... but, this actually simplified the *FSTEnum
>> classes (I think?).
>
> I'll see if I can come up with something.

Cool, thanks!

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: svn commit: r1135487 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/fst/FST.java

Posted by Dawid Weiss <da...@cs.put.poznan.pl>.
> Don't forget to fix on 3.x too :)

Seems like you did it on both, right?

> Re using up -1, I agree... but, this actually simplified the *FSTEnum
> classes (I think?).

I'll see if I can come up with something.

Dawid

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org