public class SymbolTable extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_TABLE_SIZE
Default table size.
|
| 构造器和说明 |
|---|
SymbolTable()
Constructs a symbol table with a default number of buckets.
|
SymbolTable(int tableSize)
Constructs a symbol table with a specified number of buckets.
|
| 限定符和类型 | 方法和说明 |
|---|---|
String |
addSymbol(char[] buffer,
int offset,
int len) |
String |
addSymbol(char[] buffer,
int offset,
int len,
int hash)
Adds the specified symbol to the symbol table and returns a reference to the unique symbol.
|
String |
addSymbol(String symbol)
Adds the specified symbol to the symbol table and returns a reference to the unique symbol.
|
int |
getIndexMask() |
static int |
hash(char[] buffer,
int offset,
int len) |
static int |
hash(String symbol) |
public static final int DEFAULT_TABLE_SIZE
public SymbolTable()
public SymbolTable(int tableSize)
public String addSymbol(String symbol)
symbol - The new symbol.public int getIndexMask()
public String addSymbol(char[] buffer, int offset, int len)
public String addSymbol(char[] buffer, int offset, int len, int hash)
buffer - The buffer containing the new symbol.offset - The offset into the buffer of the new symbol.len - The length of the new symbol in the buffer.public static final int hash(String symbol)
public static final int hash(char[] buffer,
int offset,
int len)
Copyright © 2012 Alibaba Group. All Rights Reserved.