jrre.api.java.lang
Class SymbolTable

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--jrre.api.java.lang.SymbolTable
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class SymbolTable
extends java.util.HashMap

Author:
Christopher Ellsworth (Chris@chrisellsworth.com)
, Clerance Alston (massclax@hotmail.com)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
SymbolTable()
          Default constructor for the symbol table.
SymbolTable(int capacity)
          Constructs the symbol table with the maximum number of entries it will need to have.
 
Method Summary
 void addSymbol(int constantPoolIndex, CPInfo entry)
          Adds a symbol to the table based on its index in the constant pool.
 int getSize()
           
 CPInfo getSymbol(int constantPoolIndex)
          Gets a symbol from the table based its key into the constant pool.
 java.lang.String toString()
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

SymbolTable

public SymbolTable()
Default constructor for the symbol table.


SymbolTable

public SymbolTable(int capacity)
Constructs the symbol table with the maximum number of entries it will need to have.

Parameters:
capacity - The capacity to initialise it with.
Method Detail

addSymbol

public void addSymbol(int constantPoolIndex,
                      CPInfo entry)
Adds a symbol to the table based on its index in the constant pool.

Parameters:
constantPoolIndex - The index in the constant pool associated with the entry.
entry - The entry in the constant pool to add to the symbol table.

getSymbol

public CPInfo getSymbol(int constantPoolIndex)
Gets a symbol from the table based its key into the constant pool.

Parameters:
constantPoolIndex - The index in the constant pool associated with the desired entry.
Returns:
The entry in the constant pool associated with the constant pool index specified.

getSize

public int getSize()

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractMap


Copyright © 2002-2002 Appalachian State University. All Rights Reserved.