|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.javatools.parser.util.KeywordTable
public final class KeywordTable
The KeywordTable utility class is a stripped down hash table implementation with a couple assumptions:
Lexer| Constructor Summary | |
|---|---|
KeywordTable(int numKeywords)Constructs a new empty KeywordTable for the given size (number of keywords.) |
|
| Method Summary | |
|---|---|
void |
addKeyword(java.lang.String keyword, int token)Adds the given keywords/token pair to the keyword table. |
static int |
computeHash(char[] keyword)Utility routine to calculate the hash value of a string used for this keyword table. |
static int |
computeInsensitiveHash(char[] keyword)Utility routine to calculate the (case insensitive) hash value of a string used for this keyword table. |
static int |
computeInsensitivePartialHash(char nextChar, int lastHash)Utility routine to calculate the (case insensitive) hash value of a keyword character by character (from left to right). |
static int |
computePartialHash(char nextChar, int lastHash)Utility routine to calculate the hash value of a keyword character by character (from left to right). |
int |
lookupKeyword(ReadTextBuffer buffer, int startOffset, int endOffset, int precomputedHash)Lookup the given keyword marked by the given start and end offset in the ReadTextBuffer, and return the matching token value, or Lexer.TK_NOT_FOUND if there is no such keyword in the table. |
void |
setCaseSensitivity(boolean isCaseSensitive)Sets the case sensitivity of the table as indiciated by client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public KeywordTable(int numKeywords)
KeywordTable for the given size (number of keywords.)
numKeywords - number of expected keywords in table| Method Detail |
|---|
public void setCaseSensitivity(boolean isCaseSensitive)
isCaseSensitive - true to perform case-sensitive lookups
public void addKeyword(java.lang.String keyword,
int token)
keyword - the keyword to use as a key to the hash tabletoken - the token value to use as the value
public int lookupKeyword(ReadTextBuffer buffer,
int startOffset,
int endOffset,
int precomputedHash)
buffer - the TextBuffer of the keyword to look upstartOffset - the starting offset of the keyword in the bufferendOffset - the ending offset of the keyword in the bufferpublic static int computeHash(char[] keyword)
keyword - the keyword to hashpublic static int computeInsensitiveHash(char[] keyword)
keyword - the keyword to hash
public static int computePartialHash(char nextChar,
int lastHash)
nextChar - the next character in the sequencelastHash - the last last value computed
public static int computeInsensitivePartialHash(char nextChar,
int lastHash)
nextChar - the next character in the sequencelastHash - the last last value computed
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||