lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r410954 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/analysis/Token.java
Date Thu, 01 Jun 2006 21:15:38 GMT
Author: yonik
Date: Thu Jun  1 14:15:37 2006
New Revision: 410954

URL: http://svn.apache.org/viewvc?rev=410954&view=rev
Log:
remove final, implement Cloneable, setTermText(): LUCENE-438

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/analysis/Token.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=410954&r1=410953&r2=410954&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Thu Jun  1 14:15:37 2006
@@ -8,6 +8,11 @@
 
  1.
 
+API Changes
+
+ 1. LUCENE-438: Remove "final" from Token, implement Cloneable, allow
+    changing of termText via setTermText().  (Yonik Seeley)
+
 Bug fixes
 
  1. Fixed the web application demo (built with "ant war-demo") which

Modified: lucene/java/trunk/src/java/org/apache/lucene/analysis/Token.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/analysis/Token.java?rev=410954&r1=410953&r2=410954&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/analysis/Token.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/analysis/Token.java Thu Jun  1 14:15:37 2006
@@ -30,7 +30,7 @@
   belongs to.  For example an end of sentence marker token might be implemented
   with type "eos".  The default token type is "word".  */
 
-public final class Token {
+public class Token implements Cloneable {
   String termText;				  // the text of the term
   int startOffset;				  // start in source text
   int endOffset;				  // end in source text
@@ -91,6 +91,11 @@
    */
   public int getPositionIncrement() { return positionIncrement; }
 
+  /** Sets the Token's term text. */
+  public void setTermText(String text) {
+    termText = text;
+  }
+
   /** Returns the Token's term text. */
   public final String termText() { return termText; }
 
@@ -109,7 +114,7 @@
   /** Returns this Token's lexical type.  Defaults to "word". */
   public final String type() { return type; }
 
-  public final String toString() {
+  public String toString() {
     StringBuffer sb = new StringBuffer();
     sb.append("(" + termText + "," + startOffset + "," + endOffset);
     if (!type.equals("word"))
@@ -118,5 +123,13 @@
       sb.append(",posIncr="+positionIncrement);
     sb.append(")");
     return sb.toString();
+  }
+
+  public Object clone() {
+    try {
+      return super.clone();
+    } catch (CloneNotSupportedException e) {
+      throw new RuntimeException(e); // shouldn't happen since we implement Cloneable
+    }
   }
 }



Mime
View raw message