lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: svn commit: r1023379 - in /lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache: DocTermsCreator.java DocTermsIndexCreator.java
Date Sat, 16 Oct 2010 21:58:19 GMT
Hi Ryan,

That looks much better! I think you can do the same for all the other classes! If you have
a specific subclass using a fixed generic type, declare it in the extends.

I am sorry, I cannot help, this code is so complicated and un-understandable, that I don't
want to touch it. I simply want no @SuppressWarnings as it makes it more ugly.

Thanks for talking care,
Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: ryan@apache.org [mailto:ryan@apache.org]
> Sent: Saturday, October 16, 2010 11:28 PM
> To: commits@lucene.apache.org
> Subject: svn commit: r1023379 - in
> /lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache:
> DocTermsCreator.java DocTermsIndexCreator.java
> 
> Author: ryan
> Date: Sat Oct 16 21:27:39 2010
> New Revision: 1023379
> 
> URL: http://svn.apache.org/viewvc?rev=1023379&view=rev
> Log:
> LUCENE-2671 -- bind DocTermsCreator and DocTermsIndexCreator to the raw
> class
> 
> Modified:
> 
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocTerms
> Creator.java
> 
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocTermsI
> ndexCreator.java
> 
> Modified:
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocTerms
> Creator.java
> URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lu
> cene/search/cache/DocTermsCreator.java?rev=1023379&r1=1023378&r2=102
> 3379&view=diff
> ================================================================
> ==============
> ---
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocTerms
> Creator.java (original)
> +++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocT
> +++ ermsCreator.java Sat Oct 16 21:27:39 2010
> @@ -34,7 +34,7 @@ import org.apache.lucene.util.packed.Gro  import
> org.apache.lucene.util.packed.PackedInts;
> 
>  // TODO: this if DocTermsIndex was already created, we should share it...
> -public class DocTermsCreator<T extends DocTerms> extends
> EntryCreatorWithOptions<T>
> +public class DocTermsCreator extends EntryCreatorWithOptions<DocTerms>
>  {
>    public static final int FASTER_BUT_MORE_RAM = 2;
> 
> @@ -64,7 +64,7 @@ public class DocTermsCreator<T extends D
>    }
> 
>    @Override
> -  public T create(IndexReader reader) throws IOException {
> +  public DocTerms create(IndexReader reader) throws IOException {
> 
>      String field = StringHelper.intern(this.field); // TODO?? necessary?
>      Terms terms = MultiFields.getTerms(reader, field); @@ -134,13 +134,11
> @@ public class DocTermsCreator<T extends D
>      }
> 
>      // maybe an int-only impl?
> -    @SuppressWarnings("unchecked") final T t =
> -      (T)new DocTermsImpl(bytes.freeze(true), docToOffset.getMutable());
> -    return t;
> +    return new DocTermsImpl(bytes.freeze(true),
> + docToOffset.getMutable());
>    }
> 
>    @Override
> -  public T validate(T entry, IndexReader reader) throws IOException {
> +  public DocTerms validate(DocTerms entry, IndexReader reader) throws
> + IOException {
>      // TODO? nothing? perhaps subsequent call with FASTER_BUT_MORE_RAM?
>      return entry;
>    }
> 
> Modified:
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocTermsI
> ndexCreator.java
> URL:
> http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lu
> cene/search/cache/DocTermsIndexCreator.java?rev=1023379&r1=1023378&r2
> =1023379&view=diff
> ================================================================
> ==============
> ---
> lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocTermsI
> ndexCreator.java (original)
> +++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/cache/DocT
> +++ ermsIndexCreator.java Sat Oct 16 21:27:39 2010
> @@ -36,7 +36,7 @@ import org.apache.lucene.util.StringHelp  import
> org.apache.lucene.util.packed.GrowableWriter;
>  import org.apache.lucene.util.packed.PackedInts;
> 
> -public class DocTermsIndexCreator<T extends DocTermsIndex> extends
> EntryCreatorWithOptions<T>
> +public class DocTermsIndexCreator extends
> +EntryCreatorWithOptions<DocTermsIndex>
>  {
>    public static final int FASTER_BUT_MORE_RAM = 2;
> 
> @@ -66,7 +66,7 @@ public class DocTermsIndexCreator<T exte
>    }
> 
>    @Override
> -  public T create(IndexReader reader) throws IOException
> +  public DocTermsIndex create(IndexReader reader) throws IOException
>    {
>      String field = StringHelper.intern(this.field); // TODO?? necessary?
>      Terms terms = MultiFields.getTerms(reader, field); @@ -166,13 +166,11
> @@ public class DocTermsIndexCreator<T exte
>      }
> 
>      // maybe an int-only impl?
> -    @SuppressWarnings("unchecked") final T t =
> -      (T)new DocTermsIndexImpl(bytes.freeze(true),
> termOrdToBytesOffset.getMutable(), docToTermOrd.getMutable(), termOrd);
> -    return t;
> +    return new DocTermsIndexImpl(bytes.freeze(true),
> + termOrdToBytesOffset.getMutable(), docToTermOrd.getMutable(),
> + termOrd);
>    }
> 
>    @Override
> -  public T validate(T entry, IndexReader reader) throws IOException {
> +  public DocTermsIndex validate(DocTermsIndex entry, IndexReader
> + reader) throws IOException {
>      // TODO? nothing? perhaps subsequent call with FASTER_BUT_MORE_RAM?
>      return entry;
>    }
> 



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


Mime
View raw message