lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/analysis CharTokenizer.java
Date Wed, 12 Nov 2003 01:00:50 GMT
ehatcher    2003/11/11 17:00:50

  Modified:    src/java/org/apache/lucene/analysis CharTokenizer.java
  Log:
  detabify and removed redundant (char) cast
  
  Revision  Changes    Path
  1.4       +22 -20    jakarta-lucene/src/java/org/apache/lucene/analysis/CharTokenizer.java
  
  Index: CharTokenizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/analysis/CharTokenizer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CharTokenizer.java	9 Dec 2002 19:02:20 -0000	1.3
  +++ CharTokenizer.java	12 Nov 2003 01:00:50 -0000	1.4
  @@ -62,7 +62,7 @@
       super(input);
     }
   
  -  private int offset = 0, bufferIndex=0, dataLen=0;
  +  private int offset = 0, bufferIndex = 0, dataLen = 0;
     private static final int MAX_WORD_LEN = 255;
     private static final int IO_BUFFER_SIZE = 1024;
     private final char[] buffer = new char[MAX_WORD_LEN];
  @@ -77,7 +77,9 @@
     /** Called on each token character to normalize it before it is added to the
      * token.  The default implementation does nothing.  Subclasses may use this
      * to, e.g., lowercase tokens. */
  -  protected char normalize(char c) { return c; }
  +  protected char normalize(char c) {
  +    return c;
  +  }
   
     /** Returns the next token in the stream, or null at EOS. */
     public final Token next() throws java.io.IOException {
  @@ -90,31 +92,31 @@
         if (bufferIndex >= dataLen) {
           dataLen = input.read(ioBuffer);
           bufferIndex = 0;
  -      };
  -      if (dataLen == -1) {
  -	if (length > 0)
  -	  break;
  -	else
  -	  return null;
         }
  -      else
  -        c = (char) ioBuffer[bufferIndex++];
  -      
  -      if (isTokenChar(c)) {                       // if it's a token char
  +      ;
  +      if (dataLen == -1) {
  +        if (length > 0)
  +          break;
  +        else
  +          return null;
  +      } else
  +        c = ioBuffer[bufferIndex++];
  +
  +      if (isTokenChar(c)) {               // if it's a token char
   
  -	if (length == 0)			  // start of token
  -	  start = offset-1;
  +        if (length == 0)			           // start of token
  +          start = offset - 1;
   
  -	buffer[length++] = normalize(c);          // buffer it, normalized
  +        buffer[length++] = normalize(c); // buffer it, normalized
   
  -	if (length == MAX_WORD_LEN)		  // buffer overflow!
  -	  break;
  +        if (length == MAX_WORD_LEN)		   // buffer overflow!
  +          break;
   
  -      } else if (length > 0)			  // at non-Letter w/ chars
  -	break;					  // return 'em
  +      } else if (length > 0)             // at non-Letter w/ chars
  +        break;                           // return 'em
   
       }
   
  -    return new Token(new String(buffer, 0, length), start, start+length);
  +    return new Token(new String(buffer, 0, length), start, start + length);
     }
   }
  
  
  

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


Mime
View raw message