adding toString() implementation

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@219555 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2005-07-18 19:28:57 +00:00
parent f50db81cd1
commit 025022251d
1 changed files with 10 additions and 0 deletions

View File

@ -109,4 +109,14 @@ public final class Token {
/** Returns this Token's lexical type. Defaults to "word". */
public final String type() { return type; }
public final String toString() {
StringBuffer sb = new StringBuffer();
sb.append("(" + termText + "," + startOffset + "," + endOffset);
if (!type.equals("word"))
sb.append(",type="+type);
if (positionIncrement != 1)
sb.append(",posIncr="+positionIncrement);
sb.append(")");
return sb.toString();
}
}