mirror of https://github.com/apache/lucene.git
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:
parent
f50db81cd1
commit
025022251d
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue