|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cburch.editor.tokens.BasicToken
com.cburch.editor.Token
public class Token
Represents a token with an associated category.
| Constructor Summary | |
|---|---|
Token(TokenType type,
javax.swing.text.Position endPosition,
java.lang.String text)
Constructs a token with the given information. |
|
Token(TokenType type,
javax.swing.text.Position endPosition,
java.lang.String text,
java.lang.Object data)
Constructs a token with the given information. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object other)
Compares this token with the parameter. |
javax.swing.text.AttributeSet |
getAttributeSet()
Returns the style in which this token should be drawn. |
java.lang.Object |
getData()
Retrieves the data associated with this token. |
java.lang.String |
getErrorMessage()
Retrieves the error mesage associated with this token. |
TokenType |
getType()
Returns the category associated with this token. |
void |
setData(java.lang.Object value)
Sets the data value associated with this token. |
void |
setErrorMessage(java.lang.String value)
Sets the error message associated with this token. |
java.lang.String |
toString()
|
| Methods inherited from class com.cburch.editor.tokens.BasicToken |
|---|
getAbbreviatedText, getBeginOffset, getEndOffset, getEndPosition, getLength, getText, hashCode |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Token(TokenType type,
javax.swing.text.Position endPosition,
java.lang.String text)
null.
type - the category for this token.endPosition - the position within the source document just past
this token's last character.text - the underlying text that this token represents.
public Token(TokenType type,
javax.swing.text.Position endPosition,
java.lang.String text,
java.lang.Object data)
type - the category for this token.endPosition - the position within the source document just past
this token's last character.text - the underlying text that this token represents.data - the data value associated with this token.| Method Detail |
|---|
public TokenType getType()
public javax.swing.text.AttributeSet getAttributeSet()
public java.lang.Object getData()
setData method,
and it can be used for many purposes. For literals, it might
be an object representing the literal values. For error
tokens, it might be a description of the error.
Note that BracketMatcher uses the data to track brackets' corresponding tokens.
public void setData(java.lang.Object value)
value - the value to associate with this token.public java.lang.String getErrorMessage()
setErrorMessage method.
Note that BracketMatcher sets the error message for unmatched brackets.
public void setErrorMessage(java.lang.String value)
value - the error message to associate with this token.public java.lang.String toString()
toString in class BasicTokenpublic boolean equals(java.lang.Object other)
BasicTokenThe 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 BasicToken
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||