[Snowball-discuss] Why not abstract Snowball Java?

Karl Wettin karl.wettin at gmail.com
Wed Jan 7 08:30:32 GMT 2009


FYI, I recently commited a SnoballProgram.java to Apache Lucene  
patched with the below. This reflectionless access to the programs  
saves us quite a bit of resources. It really would make a lot of sense  
if this patch was applied to the tartarus trunk. But we can keep our  
own branch over at Lucene, no problem.

http://svn.apache.org/repos/asf/lucene/java/trunk/contrib/snowball/src/java/org/tartarus/snowball/SnowballProgram.java


     karl


18 jan 2008 kl. 18.15 skrev Karl Wettin:

>
> 18 jan 2008 kl. 13.44 skrev Karl Wettin:
>
>> How is it that the snowball program is not abstract and has the  
>> abstract method stem()?
>
>
> It is so much more expesive to do the now required reflection to stem.
>
> Index: java/org/tartarus/snowball/SnowballProgram.java
> ===================================================================
> --- java/org/tartarus/snowball/SnowballProgram.java	(revision 500)
> +++ java/org/tartarus/snowball/SnowballProgram.java	(working copy)
> @@ -2,13 +2,15 @@
> package org.tartarus.snowball;
> import java.lang.reflect.InvocationTargetException;
>
> -public class SnowballProgram {
> +public abstract class SnowballProgram {
>     protected SnowballProgram()
>     {
> 	current = new StringBuffer();
> 	setCurrent("");
>     }
>
> +    public abstract boolean stem();
> +
>     /**
>      * Set the current string.
>      */
>
>
> _______________________________________________
> Snowball-discuss mailing list
> Snowball-discuss at lists.tartarus.org
> http://lists.tartarus.org/mailman/listinfo/snowball-discuss




More information about the Snowball-discuss mailing list