lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r783371 - /lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java
Date Wed, 10 Jun 2009 14:39:56 GMT
Author: mikemccand
Date: Wed Jun 10 14:39:56 2009
New Revision: 783371

URL: http://svn.apache.org/viewvc?rev=783371&view=rev
Log:
LUCENE-1679: make difference non-final

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java?rev=783371&r1=783370&r2=783371&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java Wed Jun 10 14:39:56
2009
@@ -32,11 +32,11 @@
  * @version $Id$
  */
 public class WildcardTermEnum extends FilteredTermEnum {
-  Term searchTerm;
-  String field = "";
-  String text = "";
-  String pre = "";
-  int preLen = 0;
+  final Term searchTerm;
+  final String field;
+  final String text;
+  final String pre;
+  final int preLen;
   boolean endEnum = false;
 
   /**
@@ -49,10 +49,10 @@
     super();
     searchTerm = term;
     field = searchTerm.field();
-    text = searchTerm.text();
+    final String searchTermText = searchTerm.text();
 
-    int sidx = text.indexOf(WILDCARD_STRING);
-    int cidx = text.indexOf(WILDCARD_CHAR);
+    final int sidx = searchTermText.indexOf(WILDCARD_STRING);
+    final int cidx = searchTermText.indexOf(WILDCARD_CHAR);
     int idx = sidx;
     if (idx == -1) {
       idx = cidx;
@@ -60,14 +60,10 @@
     else if (cidx >= 0) {
       idx = Math.min(idx, cidx);
     }
-    if (idx != -1) {
-      pre = searchTerm.text().substring(0,idx);
-    } else {
-      pre = "";
-    }
+    pre = idx != -1?searchTerm.text().substring(0,idx): "";
 
     preLen = pre.length();
-    text = text.substring(preLen);
+    text = searchTermText.substring(preLen);
     setEnum(reader.terms(new Term(searchTerm.field(), pre)));
   }
 
@@ -82,7 +78,7 @@
     return false;
   }
 
-  public final float difference() {
+  public float difference() {
     return 1.0f;
   }
 
@@ -190,12 +186,4 @@
       }
       return false;
   }
-
-  public void close() throws IOException
-  {
-    super.close();
-    searchTerm = null;
-    field = null;
-    text = null;
-  }
 }



Mime
View raw message