git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@179637 13f79535-47bb-0310-9956-ffa450edef68

This commit is contained in:
Mark Harwood 2005-06-02 20:27:06 +00:00
parent b305174366
commit 07cee0b287
1 changed files with 16 additions and 14 deletions

View File

@ -34,19 +34,22 @@ public class TokenGroup
void addToken(Token token, float score) void addToken(Token token, float score)
{ {
if(numTokens==0) if(numTokens < MAX_NUM_TOKENS_PER_GROUP)
{ {
startOffset=token.startOffset(); if(numTokens==0)
endOffset=token.endOffset(); {
} startOffset=token.startOffset();
else endOffset=token.endOffset();
{ }
startOffset=Math.min(startOffset,token.startOffset()); else
endOffset=Math.max(endOffset,token.endOffset()); {
} startOffset=Math.min(startOffset,token.startOffset());
tokens[numTokens]=token; endOffset=Math.max(endOffset,token.endOffset());
scores[numTokens]=score; }
numTokens++; tokens[numTokens]=token;
scores[numTokens]=score;
numTokens++;
}
} }
boolean isDistinct(Token token) boolean isDistinct(Token token)
@ -116,5 +119,4 @@ public class TokenGroup
} }
return total; return total;
} }
} }