eece496.util
Class SymbolHashtable

java.lang.Object
  extended byeece496.util.SymbolHashtable

public class SymbolHashtable
extends java.lang.Object

Symbol table using hashtable implementation.

$Source: K:/cvsrepo/ee496/codes/jbuilder/src/TestCaseGenerator/src/eece496/util/SymbolHashtable.java,v $
Last updated by $Author: cyiu $
$Date: 2003/08/07 19:36:26 $
$Revision: 1.11 $
$State: Exp $

Author:
Charles Chung Man Yiu

Nested Class Summary
 class SymbolHashtable.SymbolNotFoundException
           
 
Constructor Summary
SymbolHashtable()
          Constructor.
 
Method Summary
 boolean addMuEx(java.lang.String symbolName, java.util.Vector parentROIDs, java.util.Vector parentNames)
          Add Mutually Exclusive roids to the symbol with symbolName.
 boolean addParent(java.lang.String symbolName, parentListElement element)
          Insert a SINGLE new definition to a symbol with symbolName.
 boolean addParent(java.lang.String symbolName, java.util.Vector parentNames, java.util.Vector parentROIDs)
          Insert a SINGLE new definition to a symbol with symbolName.
 boolean addSymbol(java.lang.String symbolName, int type)
          Add a new symbol to the hashtable.
 java.util.Vector getMuExNames(java.lang.String symbolName)
          Get the Mutually Exclusive Names of this particular symbol.
 java.util.Vector getMuExROIDs(java.lang.String symbolName)
          Get the Mutually Exclusive Roids of this particular symbol
 parentListElement getParent(java.lang.String symbolName, int ID)
          get the parent list element with the specified ID.
 int getParentListLength(java.lang.String symbolName)
          Get the length of the parent list (linked list) of that symbol.
 java.util.Vector getParentNames(java.lang.String symbolName, int ID)
          Get the parent names of the specific parent in the list.
 java.util.Vector getParentRoids(java.lang.String symbolName, int ID)
          Get the parent roids of the specific parent in the list.
 java.util.LinkedList getParents(java.lang.String symbolName)
          Deprecated. Return the linked list of parents of the specified symbol.
 java.util.Enumeration getSymbolNames()
          Get the list of symbol name (keys) of the symbol hashtable.
 int getType(java.lang.String symbolName)
          Get the type of the symbol.
 boolean modifyParent(java.lang.String symbolName, int ID, java.util.Vector parentNames, java.util.Vector parentROIDs)
          modify the parent with ID (from zero in linked list) to the new content.
 void print()
          Print the content of the hashtable to the console output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolHashtable

public SymbolHashtable()
Constructor.

Method Detail

addSymbol

public boolean addSymbol(java.lang.String symbolName,
                         int type)
Add a new symbol to the hashtable. The name of the symbol is the key. there is NO definition yet.

Parameters:
symbolName - Hashtable key.
Returns:
true if successful; false otherwise.

addParent

public boolean addParent(java.lang.String symbolName,
                         java.util.Vector parentNames,
                         java.util.Vector parentROIDs)
Insert a SINGLE new definition to a symbol with symbolName. If the symbol is not declared in the hashtable yet this function will do the task also.

Parameters:
symbolName - Hashtable key.
Returns:
true if successful; false otherwise.

addParent

public boolean addParent(java.lang.String symbolName,
                         parentListElement element)
Insert a SINGLE new definition to a symbol with symbolName. If the symbol is not declared in the hashtable yet this function will do the task also.

Parameters:
symbolName - Hashtable key.
element - new definition to be added.
Returns:
true if successful; false otherwise.

modifyParent

public boolean modifyParent(java.lang.String symbolName,
                            int ID,
                            java.util.Vector parentNames,
                            java.util.Vector parentROIDs)
modify the parent with ID (from zero in linked list) to the new content.

Parameters:
symbolName - name of the symbol.
ID - ID of the element in the linked list, starts from zero.
parentNames - the new parent names.
parentROIDs - the new parent ROIDs.
Returns:
true if successful; false otherwise.

addMuEx

public boolean addMuEx(java.lang.String symbolName,
                       java.util.Vector parentROIDs,
                       java.util.Vector parentNames)
Add Mutually Exclusive roids to the symbol with symbolName.

Parameters:
symbolName - the spec. symbol in interest.
parentROIDs - MuEx condition roids.
parentNames - MuEx condition names.
Returns:
true when successful; false otherwise.

getParents

public java.util.LinkedList getParents(java.lang.String symbolName)
Deprecated. Return the linked list of parents of the specified symbol.

Parameters:
symbolName - name of the symbol.
Returns:
the symbol table linked list.

getParentNames

public java.util.Vector getParentNames(java.lang.String symbolName,
                                       int ID)
Get the parent names of the specific parent in the list.

Parameters:
ID - the index of the parent in the list.
Returns:
a Vector of parent names.

getParentRoids

public java.util.Vector getParentRoids(java.lang.String symbolName,
                                       int ID)
Get the parent roids of the specific parent in the list.

Parameters:
symbolName - name of the symbol.
ID - the index of the parent in the list.
Returns:
a Vector of parent ROIDs

getParent

public parentListElement getParent(java.lang.String symbolName,
                                   int ID)
get the parent list element with the specified ID.

Parameters:
symbolName - name of the symbol.
ID - from zero in the linked list, ID for the parent list element
Returns:
parent list element if exsits; null otherwise.

getMuExROIDs

public java.util.Vector getMuExROIDs(java.lang.String symbolName)
Get the Mutually Exclusive Roids of this particular symbol

Parameters:
symbolName - name of the particular symbol.
Returns:
a Vector of Mutually Exclusive ROIDs.

getMuExNames

public java.util.Vector getMuExNames(java.lang.String symbolName)
Get the Mutually Exclusive Names of this particular symbol.

Parameters:
symbolName - name of the particular symbol.
Returns:
a Vector of Mutually Exclusive names.

getType

public int getType(java.lang.String symbolName)
Get the type of the symbol.

Parameters:
symbolName - name of the symbol.
Returns:
-1 if no such symbol present; type of the symbol otherwise.

getParentListLength

public int getParentListLength(java.lang.String symbolName)
Get the length of the parent list (linked list) of that symbol.

Parameters:
symbolName - name of the symbol
Returns:
-1 if the parent list doesn't exist.

print

public void print()
Print the content of the hashtable to the console output.


getSymbolNames

public java.util.Enumeration getSymbolNames()
Get the list of symbol name (keys) of the symbol hashtable.

Returns:
an Enumeration of symbol names.