detabify and removed redundant (char) cast

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150127 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2003-11-12 01:00:50 +00:00
parent cad41dbce6
commit 812d3329d7
1 changed files with 22 additions and 20 deletions

View File

@ -62,7 +62,7 @@ public abstract class CharTokenizer extends Tokenizer {
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 @@ public abstract class CharTokenizer extends Tokenizer {
/** 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 @@ public abstract class CharTokenizer extends Tokenizer {
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 (length == 0) // start of token
start = offset-1;
if (isTokenChar(c)) { // if it's a token char
buffer[length++] = normalize(c); // buffer it, normalized
if (length == 0) // start of token
start = offset - 1;
if (length == MAX_WORD_LEN) // buffer overflow!
break;
buffer[length++] = normalize(c); // buffer it, normalized
} else if (length > 0) // at non-Letter w/ chars
break; // return 'em
if (length == MAX_WORD_LEN) // buffer overflow!
break;
} 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);
}
}