|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.fife.ui.rsyntaxtextarea.TokenMap
public class TokenMap
A hash table for reserved words, etc. defined by a TokenMaker
.
This class is designed for the quick lookup of tokens, as it can compare
Segment
s without the need to allocate a new string.
The org.fife.ui.rsyntaxtextarea
package uses this class to help
identify reserved words in programming languages. An instance of
TokenMaker
will create and initialize an instance of this class
containing all reserved words, data types, and all other words that need to
be syntax-highlighted for that particular language. When the token maker
parses a line and identifies an individual token, it is looked up in the
TokenMap
to see if it should be syntax-highlighted.
Constructor Summary | |
---|---|
TokenMap()
Constructs a new token map that is case-sensitive. |
|
TokenMap(boolean ignoreCase)
Constructs a new token map. |
|
TokenMap(int size)
Constructs a new token map that is case-sensitive. |
|
TokenMap(int size,
boolean ignoreCase)
Constructs a new token map. |
Method Summary | |
---|---|
int |
get(char[] array1,
int start,
int end)
Returns the token type associated with the given text, if the given text is in this token map. |
int |
get(javax.swing.text.Segment text,
int start,
int end)
Returns the token type associated with the given text, if the given text is in this token map. |
protected boolean |
isIgnoringCase()
Returns whether this token map ignores case when checking for tokens. |
void |
put(java.lang.String string,
int tokenType)
Adds a string to this token map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TokenMap()
public TokenMap(int size)
size
- The size of the token map.public TokenMap(boolean ignoreCase)
ignoreCase
- Whether or not this token map should ignore case
when comparing tokens.public TokenMap(int size, boolean ignoreCase)
size
- The size of the token map.ignoreCase
- Whether or not this token map should ignore case
when comparing tokens.Method Detail |
---|
public int get(javax.swing.text.Segment text, int start, int end)
-1
is returned.
text
- The segment from which to get the text to compare.start
- The starting index in the segment of the text.end
- The ending index in the segment of the text.
-1
if this token was not specified in this map.public int get(char[] array1, int start, int end)
-1
is returned.
array1
- An array of characters containing the text.start
- The starting index in the array of the text.end
- The ending index in the array of the text.
-1
if this token was not specified in this map.protected boolean isIgnoringCase()
public void put(java.lang.String string, int tokenType)
string
- The string to add.tokenType
- The type of token the string is.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |