|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cburch.editor.tokens.BasicToken
public class BasicToken
Represents a token in the stream, holding minimal information necessary for the tokenizer to work.
| Constructor Summary | |
|---|---|
BasicToken(javax.swing.text.Position end,
java.lang.String text)
Constructs a token with the given information. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object other)
Compares this token with the parameter. |
java.lang.String |
getAbbreviatedText(int maxLength)
Returns a formatted string, abbreviated to the given length, with any line breaks replaced with "\n." As an example of the abbreviation, the text veryLargeIdentifierName would be abbreviated to veryLa..me if maxLength
were 10. |
int |
getBeginOffset()
Returns the offset where this token's first character is currently located within its document. |
int |
getEndOffset()
Returns the current offset of the first character following this token within its document. |
javax.swing.text.Position |
getEndPosition()
Returns the position within the document just past this token. |
int |
getLength()
Returns the number of characters in this token. |
java.lang.String |
getText()
Returns the underlying text that this token represents. |
int |
hashCode()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BasicToken(javax.swing.text.Position end,
java.lang.String text)
end - the position within the source document just past
this token's last character.text - the underlying text that this token represents.| Method Detail |
|---|
public final javax.swing.text.Position getEndPosition()
public final int getBeginOffset()
public final int getEndOffset()
public final int getLength()
public java.lang.String getText()
public java.lang.String getAbbreviatedText(int maxLength)
maxLength
were 10.
maxLength - the maximum length of the returned string.
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object other)
The tokenizer uses this method to determine when it can legally stop rescanning a file. If the tokens come from a scanner with additional state, then the subclass should override this method to make it more specific, reflecting that the tokens are not equal in the eyes of the scanner.
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||