home *** CD-ROM | disk | FTP | other *** search
- package allaire.util.template;
-
- import netscape.util.Enumeration;
- import netscape.util.Hashtable;
-
- public class SymbolTable {
- private Hashtable m_symbols = new Hashtable();
-
- public SymbolTable(Hashtable var1) throws SymbolTableException {
- Enumeration var2 = var1.keys();
-
- while(var2.hasMoreElements()) {
- String var3 = (String)var2.nextElement();
- this.set(var3.toUpperCase(), var1.get(var3));
- }
-
- }
-
- public void set(String var1, Object var2) throws SymbolTableException {
- this.verifySymbol(var1);
- this.m_symbols.put(var1.toUpperCase(), var2);
- }
-
- public Object get(String var1) {
- return this.m_symbols.get(var1.toUpperCase());
- }
-
- public final Object getRequired(String var1) throws SymbolTableException {
- Object var2 = this.get(var1);
- if (var2 != null) {
- return var2;
- } else {
- throw new SymbolTableException(202, "Attempted to retrieve the value of a variable (" + var1 + ") which does not currently exist.");
- }
- }
-
- public final String getString(String var1) {
- Object var2 = this.get(var1);
- return var2 == null ? null : var2.toString();
- }
-
- public final String getStringRequired(String var1) throws SymbolTableException {
- return this.getRequired(var1).toString();
- }
-
- protected void verifySymbol(String var1) throws SymbolTableException {
- if (var1.length() == 0) {
- throw new SymbolTableException(201, "Attempted to set a variable value without a valid " + "variable name.");
- }
- }
-
- public void remove(String var1) {
- this.m_symbols.remove(var1.toUpperCase());
- }
-
- public SymbolTable() {
- }
- }
-