public class SymbolHash extends Object
The hash code uses the same algorithm as SymbolTable class.
Modifier and Type | Class and Description |
---|---|
protected static class |
SymbolHash.Entry
This class is a key table entry.
|
Modifier and Type | Field and Description |
---|---|
protected SymbolHash.Entry[] |
fBuckets
Buckets.
|
protected int |
fNum
Number of elements.
|
protected int |
fTableSize
Default table size.
|
Constructor and Description |
---|
SymbolHash()
Constructs a key table with the default size.
|
SymbolHash(int size)
Constructs a key table with a given size.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all key/value assocaition.
|
Object |
get(Object key)
Get the value associated with the given key.
|
int |
getLength()
Get the number of key/value pairs stored in this table.
|
int |
getValues(Object[] elements,
int from)
Add all values to the given array.
|
SymbolHash |
makeClone()
Make a clone of this object.
|
void |
put(Object key,
Object value)
Adds the key/value mapping to the key table.
|
protected SymbolHash.Entry |
search(Object key,
int bucket) |
protected int fTableSize
protected SymbolHash.Entry[] fBuckets
protected int fNum
public SymbolHash()
public SymbolHash(int size)
size
- the size of the key table.public void put(Object key, Object value)
key
- value
- public Object get(Object key)
key
- public int getLength()
public int getValues(Object[] elements, int from)
elements
- the array to store the elementsfrom
- where to start store element in the arraypublic SymbolHash makeClone()
public void clear()
protected SymbolHash.Entry search(Object key, int bucket)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.