entities
Class NameSpace

java.lang.Object
  extended byentities.NameSpace
All Implemented Interfaces:
ScopeManager
Direct Known Subclasses:
Module

public class NameSpace
extends java.lang.Object
implements ScopeManager

The NameSpace class represents the information regarding a C++ NameSpace.


Field Summary
protected  java.util.Vector fBody
          Contain all the statements associated with the case.
protected  java.util.Vector fClasses
          Represent the classes defined in the namespace
protected  java.util.Hashtable fClassMapToHeaderFile
          Associates a class name with the file in which it is declared
protected  java.util.Vector fEnumerators
          Represent the enumerators defined in the namespace
protected  java.util.Vector fExternalFields
          Represent the fields whose class is not defined in the files analyzed.
protected  java.util.Vector fExternalMethods
          Represent the methods whose class is not defined in the files analyzed.
protected  java.util.Vector fFunctions
          Represent the functions defined in the namespace
protected  java.util.Vector fGlobalVariables
          Represent the global variables defined in the namespace
protected  java.lang.String fName
          Name of the namespace
protected  java.util.Vector fNestedNameSpaces
          Represent the nested namespaces defined in the namespace
protected  ScopeManager fParentScope
          Represent the scope in which the namespace is defined.
protected  java.util.Hashtable fTypeTable
          Contains all the new types defined using the typedef statement (the key is the new name)
protected  java.util.Hashtable fUserTypeTable
          Contains all the new types defined by the user throught the typedef statement (the key is the new name)
 
Constructor Summary
NameSpace()
          Construct a NameSpace object
NameSpace(ScopeManager parentScope, java.lang.String name)
          Construct a NameSpace object
 
Method Summary
 void addClass(ClassEntity c)
          Add a Class to NameSpace
 void addClassHeaderFile(java.lang.String className, java.lang.String headerFileName)
          Add the correspondence between a class name and the file in which the class is defined
 void addEnumerator(Enumerator e)
          Add a global Enumerator to NameSpace
 void addExpression(Expression expr, ScopeManager wrapper)
          Add an Expression object to Module, NamesSpace, Function, Method and Expression objects
 void addExternalField(Variable f)
          Add a external field to NameSpace
 void addExternalMethod(Method m)
          Add a external method to NameSpace
 void addField(Variable variable)
          Empty
 void addFriendClass(Variable variable)
          Empty
 void addFriendFunction(Function function)
          Empty
 void addFriendMethod(Method method)
          Empty
 void addFunction(Function f)
          Add a Function to NameSpace
 void addGeneralization(SuperClass superClass)
          Empty
 void addMethod(Method method)
          Empty
 void addNameSpace(NameSpace n)
          Add a namespace
 void addType(java.lang.String newType, java.lang.String definition)
          Add a new type
 void addUserType(java.lang.String newType, java.lang.String definition)
          Add a new user type
 void addVariable(Variable v)
          Add a global Variable to NameSpace
static void createTable(java.sql.Connection dbConnection)
           
static void delete(java.sql.Connection dbConnection, int id)
          Add the flow analysis information to the insertion and extraction graphs
 ScopeManager findVariableType(java.lang.String nameToBeFound, java.lang.StringBuffer typeToBeFound, Expression expr)
          Look for the variable declaration whose name is "nameToBeFound" and return the ScopeManager in which it is defined (if found), filling "typeToBeFound" with the variable type.
 java.util.Vector getBody()
           
 java.util.Vector getClasses()
           
 java.util.Hashtable getClassMapToHeaderFile()
           
 Method getCurrentMethod(java.lang.String methodName, java.util.Vector parameters)
           
 java.util.Vector getEnumerators()
           
 java.util.Vector getExternalFields()
           
 java.util.Vector getExternalMethods()
           
 java.util.Vector getFunctions()
           
 java.util.Vector getGlobalVariables()
           
 java.lang.String getName()
           
 java.util.Vector getNameSpaces()
           
 ScopeManager getParent()
           
 java.util.Hashtable getTypeTable()
           
 java.util.Hashtable getUserTypeTable()
           
 void insert(java.sql.Connection dbConnection, int sourceId, int sourceType)
           
 void print(java.lang.String indentation)
          Print all information in a Module object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fName

protected java.lang.String fName
Name of the namespace


fClasses

protected java.util.Vector fClasses
Represent the classes defined in the namespace


fFunctions

protected java.util.Vector fFunctions
Represent the functions defined in the namespace


fGlobalVariables

protected java.util.Vector fGlobalVariables
Represent the global variables defined in the namespace


fEnumerators

protected java.util.Vector fEnumerators
Represent the enumerators defined in the namespace


fNestedNameSpaces

protected java.util.Vector fNestedNameSpaces
Represent the nested namespaces defined in the namespace


fExternalMethods

protected java.util.Vector fExternalMethods
Represent the methods whose class is not defined in the files analyzed.


fExternalFields

protected java.util.Vector fExternalFields
Represent the fields whose class is not defined in the files analyzed.


fTypeTable

protected java.util.Hashtable fTypeTable
Contains all the new types defined using the typedef statement (the key is the new name)


fUserTypeTable

protected java.util.Hashtable fUserTypeTable
Contains all the new types defined by the user throught the typedef statement (the key is the new name)


fParentScope

protected ScopeManager fParentScope
Represent the scope in which the namespace is defined.


fClassMapToHeaderFile

protected java.util.Hashtable fClassMapToHeaderFile
Associates a class name with the file in which it is declared


fBody

protected java.util.Vector fBody
Contain all the statements associated with the case.

Constructor Detail

NameSpace

public NameSpace()
Construct a NameSpace object


NameSpace

public NameSpace(ScopeManager parentScope,
                 java.lang.String name)
Construct a NameSpace object

Parameters:
parentScope - ScopeManager corresponding to the entity containing the namespace
name - Name of the namespace
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface ScopeManager
Returns:
the String corresponding to the name of the namespace

getClasses

public java.util.Vector getClasses()
Returns:
a Vector containing objects of type ClassEntity corresponding to the classes or null if there are not classes

getExternalFields

public java.util.Vector getExternalFields()
Returns:
a Vector of objects of type Variable corresponding to fields that are set here but defined in other modules

getExternalMethods

public java.util.Vector getExternalMethods()
Returns:
a Vector of objects of type Method corresponding to methods that are defined here but declared in other modules

getGlobalVariables

public java.util.Vector getGlobalVariables()
Returns:
a Vector containing objects the Variable corresponding to global variables

getEnumerators

public java.util.Vector getEnumerators()
Returns:
a Vector containing object of type Enumerator corresponding to enumerators

getFunctions

public java.util.Vector getFunctions()
Returns:
a Vector containing objects of type Function

getTypeTable

public java.util.Hashtable getTypeTable()
Returns:
a Hashtable containing all the new types defined by the typedef statement (the key is the new name)

getUserTypeTable

public java.util.Hashtable getUserTypeTable()
Returns:
a Hashtable containing the new types defined by the user throught the typedef statement (the key is the new name)

getNameSpaces

public java.util.Vector getNameSpaces()
Returns:
a Vector containing objects of type NameSpace associated to the nested namespaces.

getClassMapToHeaderFile

public java.util.Hashtable getClassMapToHeaderFile()
Returns:
a Hashtable containing the associations beetween classes and header files found during the analysis

getBody

public java.util.Vector getBody()
Returns:
a Vector containing objects of type Expression corresponding to the statements found at namespace level.

getParent

public ScopeManager getParent()
Specified by:
getParent in interface ScopeManager
Returns:
the parent ScopeManager

getCurrentMethod

public Method getCurrentMethod(java.lang.String methodName,
                               java.util.Vector parameters)
Specified by:
getCurrentMethod in interface ScopeManager
Returns:
the external method entity whose name is methodName and whose parameters are parameters if it exists null otherwise

addEnumerator

public void addEnumerator(Enumerator e)
Add a global Enumerator to NameSpace

Specified by:
addEnumerator in interface ScopeManager

addNameSpace

public void addNameSpace(NameSpace n)
Add a namespace

Specified by:
addNameSpace in interface ScopeManager

addExpression

public void addExpression(Expression expr,
                          ScopeManager wrapper)
Description copied from interface: ScopeManager
Add an Expression object to Module, NamesSpace, Function, Method and Expression objects

Specified by:
addExpression in interface ScopeManager

addClass

public void addClass(ClassEntity c)
Add a Class to NameSpace

Specified by:
addClass in interface ScopeManager

addFunction

public void addFunction(Function f)
Add a Function to NameSpace

Specified by:
addFunction in interface ScopeManager

addMethod

public void addMethod(Method method)
Empty

Specified by:
addMethod in interface ScopeManager

addVariable

public void addVariable(Variable v)
Add a global Variable to NameSpace

Specified by:
addVariable in interface ScopeManager

addField

public void addField(Variable variable)
Empty

Specified by:
addField in interface ScopeManager

addType

public void addType(java.lang.String newType,
                    java.lang.String definition)
Add a new type

Specified by:
addType in interface ScopeManager

addUserType

public void addUserType(java.lang.String newType,
                        java.lang.String definition)
Add a new user type

Specified by:
addUserType in interface ScopeManager

addGeneralization

public void addGeneralization(SuperClass superClass)
Empty

Specified by:
addGeneralization in interface ScopeManager

addExternalMethod

public void addExternalMethod(Method m)
Add a external method to NameSpace

Specified by:
addExternalMethod in interface ScopeManager

addExternalField

public void addExternalField(Variable f)
Add a external field to NameSpace

Specified by:
addExternalField in interface ScopeManager

addFriendFunction

public void addFriendFunction(Function function)
Empty

Specified by:
addFriendFunction in interface ScopeManager

addFriendMethod

public void addFriendMethod(Method method)
Empty

Specified by:
addFriendMethod in interface ScopeManager

addFriendClass

public void addFriendClass(Variable variable)
Empty

Specified by:
addFriendClass in interface ScopeManager

addClassHeaderFile

public void addClassHeaderFile(java.lang.String className,
                               java.lang.String headerFileName)
Description copied from interface: ScopeManager
Add the correspondence between a class name and the file in which the class is defined

Specified by:
addClassHeaderFile in interface ScopeManager

print

public void print(java.lang.String indentation)
Print all information in a Module object

Specified by:
print in interface ScopeManager

findVariableType

public ScopeManager findVariableType(java.lang.String nameToBeFound,
                                     java.lang.StringBuffer typeToBeFound,
                                     Expression expr)
Look for the variable declaration whose name is "nameToBeFound" and return the ScopeManager in which it is defined (if found), filling "typeToBeFound" with the variable type.

Specified by:
findVariableType in interface ScopeManager

delete

public static void delete(java.sql.Connection dbConnection,
                          int id)
                   throws java.sql.SQLException
Add the flow analysis information to the insertion and extraction graphs

Throws:
java.sql.SQLException

createTable

public static void createTable(java.sql.Connection dbConnection)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

insert

public void insert(java.sql.Connection dbConnection,
                   int sourceId,
                   int sourceType)
            throws java.sql.SQLException
Throws:
java.sql.SQLException