public class DefaultToken extends AbstractOccurrenceInText<Term> implements Token
Token interface. It just stores the
text of the token as a String.DEFAULT_LENGTH, DEFAULT_START, length, start| Constructor and Description |
|---|
DefaultToken()
Creates a new
Token. |
DefaultToken(java.lang.String text,
int start)
Creates a new
Token with the given text. |
DefaultToken(java.lang.String text,
int start,
int length)
Creates a new
Token with the given text, start, and length. |
| Modifier and Type | Method and Description |
|---|---|
DefaultTerm |
asTerm()
Tokens always are treated as
DefaultTerm objects that contain
the text of the Token. |
DefaultTerm |
getData()
Gets the data that occurred in the text.
|
DefaultTerm |
getTerm()
Gets the term that occurred in the text.
|
java.lang.String |
getText()
Gets the text of the token.
|
void |
setText(java.lang.String text)
Sets the text of the token.
|
java.lang.String |
toString()
The text of the token.
|
getLength, getStart, setLength, setStartcloneequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLength, getStartpublic DefaultToken()
Token. The text defaults to null.public DefaultToken(java.lang.String text,
int start)
Token with the given text. The length is assumed
to be the length of the text.text - The text of the token.start - The starting point of the token in its source.public DefaultToken(java.lang.String text,
int start,
int length)
Token with the given text, start, and length.text - The text of the token.start - The starting point of the token in its source.length - The length of the token in the source.public DefaultTerm getData()
OccurrenceInTextgetData in interface OccurrenceInText<Term>public DefaultTerm asTerm()
TokenDefaultTerm objects that contain
the text of the Token.public DefaultTerm getTerm()
TermOccurrencegetTerm in interface TermOccurrencepublic java.lang.String getText()
Tokenpublic void setText(java.lang.String text)
text - The text of the token.public java.lang.String toString()
toString in class java.lang.Object