From 025022251d55a72ec43984b4874f5d9291d137e3 Mon Sep 17 00:00:00 2001 From: Daniel Naber Date: Mon, 18 Jul 2005 19:28:57 +0000 Subject: [PATCH] adding toString() implementation git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@219555 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/analysis/Token.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/java/org/apache/lucene/analysis/Token.java b/src/java/org/apache/lucene/analysis/Token.java index d510c08dc32..a761bed7520 100644 --- a/src/java/org/apache/lucene/analysis/Token.java +++ b/src/java/org/apache/lucene/analysis/Token.java @@ -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(); + } }