entities
Class ClassEntity

java.lang.Object
  extended byentities.ClassEntity
All Implemented Interfaces:
ScopeManager

public class ClassEntity
extends java.lang.Object
implements ScopeManager

The ClassEntity class represents the information regarding a C++ Class.


Field Summary
protected  java.util.Hashtable fTypeTable
           
protected  java.util.Hashtable fUserTypeTable
           
 
Constructor Summary
ClassEntity(ScopeManager parentScope, java.lang.String name, java.lang.String file, java.lang.String classId, int position, boolean nestedFlag, java.util.Vector enclosingClasses)
          Construct a new ClassEntity
 
Method Summary
 void addClass(ClassEntity cl)
          Add a ClassEntity object to the nested classes
 void addClassHeaderFile(java.lang.String className, java.lang.String headerFileName)
          Empty
 void addEnumerator(Enumerator en)
          Add an Enumerator object to the ClassEntity
 void addExpression(Expression expr, ScopeManager wrapper)
          Add an Expression object to the ClassEntity (these expressions correspond to the filed initializations)
 void addExternalField(Variable variable)
          Empty
 void addExternalMethod(Method method)
          Empty
 void addField(Variable field)
          Add a Variable object to the fields of the class
 void addFriendClass(Variable v)
          Add a Variable object representing a friend class to the friend classes
 void addFriendFunction(Function f)
          Add a Function object to the friend functions
 void addFriendMethod(Method m)
          Add a Method object to the friend methods
 void addFunction(Function function)
          Empty
 void addGeneralization(SuperClass superClass)
          Add a SuperClass object
 void addMethod(Method method)
          Add a Method object
 void addNameSpace(NameSpace namespace)
          Empty
 void addType(java.lang.String name, java.lang.String type)
          Empty
 void addUserType(java.lang.String name, java.lang.String type)
          Add a new type defined with typedef to the user types.
 void addVariable(Variable variable)
          Add a Variable object corresponding to a local variable to the current Expression.
static void createTable(java.sql.Connection dbConnection)
           
static void delete(java.sql.Connection dbConnection, int id)
           
 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 getAccessList()
           
 java.util.Vector getBody()
           
 java.util.Vector getClasses()
           
 java.lang.String getClassId()
           
 Method getCurrentMethod(java.lang.String methodName, java.util.Vector parameters)
           
 java.util.Vector getEnclosingClasses()
          Deprecated.  
 java.util.Vector getEnumerators()
           
 Variable getField(java.lang.String fieldName)
           
 java.util.Vector getFields()
           
 java.lang.String getFile()
           
 java.util.Vector getFriendClasses()
           
 java.util.Vector getFriendFunctions()
           
 java.util.Vector getFriendMethods()
           
 java.util.Vector getGeneralizations()
           
 java.util.Vector getMethods()
           
 java.lang.String getName()
           
 ScopeManager getParent()
           
 int getPosition()
           
 java.util.Hashtable getTypeTable()
           
 java.util.Hashtable getUserTypeTable()
           
 void insert(java.sql.Connection dbConnection, int sourceId, int sourceType)
           
 boolean isATemplate()
           
 boolean isNested()
           
 void print(java.lang.String indentation)
          Print all information in a ClassEntity objects
 void setTemplateFlag(boolean templateFlag)
          Set the template flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fTypeTable

protected java.util.Hashtable fTypeTable

fUserTypeTable

protected java.util.Hashtable fUserTypeTable
Constructor Detail

ClassEntity

public ClassEntity(ScopeManager parentScope,
                   java.lang.String name,
                   java.lang.String file,
                   java.lang.String classId,
                   int position,
                   boolean nestedFlag,
                   java.util.Vector enclosingClasses)
Construct a new ClassEntity

Parameters:
parentScope - The entity containing the class
name - Name of the C++ class
file - Declaration file
classId - The keyword used to define the class ("struct", "union" or "class")
position - Position of the C++ class name in the file
nestedFlag - Flag that says if the class is nested in another class
enclosingClasses - Vector of String objects that represent the enclosing classes from the outer to the inner
Method Detail

getName

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

getFile

public java.lang.String getFile()
Returns:
the String corresponding to the file in which the class is declared

getPosition

public int getPosition()
Returns:
an integer corresponding to the line (of the class name) in the file

getMethods

public java.util.Vector getMethods()
Returns:
the Vector of objects (of type Method) corresponding to the methods of the class

See Also:
Method

getFields

public java.util.Vector getFields()
Returns:
the Vector of objects Variable (of type Variable) correspondig to the fields of the class

See Also:
Variable

getField

public Variable getField(java.lang.String fieldName)
Returns:
the object (of type Variable) corresponding to the field called fieldName if it is a field of the class, null otherwise (with the quickExecution a field declared in a superClass will not be found)

See Also:
Variable

getEnumerators

public java.util.Vector getEnumerators()
Returns:
The Vector of Enumerator objects found in the class

See Also:
Enumerator

getAccessList

public java.util.Vector getAccessList()
Returns:
The Vector of Access objects in the class

See Also:
Access

getGeneralizations

public java.util.Vector getGeneralizations()
Returns:
The Vector of SuperClass objects, which contain the String objects corresponding to the superclass names and the access type.
See Also:
SuperClass

getFriendClasses

public java.util.Vector getFriendClasses()
Returns:
The Vector of objects (of type Variable) corresponding to the friend classes

See Also:
Variable

getFriendMethods

public java.util.Vector getFriendMethods()
Returns:
The Vector of Method objects corresponding to the friend methods

See Also:
Method

getFriendFunctions

public java.util.Vector getFriendFunctions()
Returns:
The Vector of friend Function objects

See Also:
Function

getEnclosingClasses

public java.util.Vector getEnclosingClasses()
Deprecated.  

Returns:
The Vector of String objects corresponding to the class names that include the class. The String of index 0 corresponds to the outer one.

getBody

public java.util.Vector getBody()
Returns:
the Vector of the Expression objects found in the class (that is the field initializations)

getTypeTable

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

getUserTypeTable

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

getClasses

public java.util.Vector getClasses()
Returns:
The Vector containing the ClassEntity objects corresponding to the nested classes.

See Also:
ClassEntity

getClassId

public java.lang.String getClassId()
Returns:
the String corresponding to the class identifier

Ex: struct A {}; union B { }; class C {};

Returns respectively the String objects "struct", "union" and "class"


getParent

public ScopeManager getParent()
Specified by:
getParent in interface ScopeManager
Returns:
the entity containing the class

getCurrentMethod

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

isNested

public boolean isNested()
Returns:
true if the class is embedded in a class

isATemplate

public boolean isATemplate()
Returns:
true if the class is a template

addEnumerator

public void addEnumerator(Enumerator en)
Add an Enumerator object to the ClassEntity

Specified by:
addEnumerator in interface ScopeManager
See Also:
Enumerator

addNameSpace

public void addNameSpace(NameSpace namespace)
Empty

Specified by:
addNameSpace in interface ScopeManager

addExpression

public void addExpression(Expression expr,
                          ScopeManager wrapper)
Add an Expression object to the ClassEntity (these expressions correspond to the filed initializations)

Specified by:
addExpression in interface ScopeManager

addClass

public void addClass(ClassEntity cl)
Add a ClassEntity object to the nested classes

Specified by:
addClass in interface ScopeManager

addFunction

public void addFunction(Function function)
Empty

Specified by:
addFunction in interface ScopeManager

addMethod

public void addMethod(Method method)
Add a Method object

Specified by:
addMethod in interface ScopeManager
See Also:
Method

addVariable

public void addVariable(Variable variable)
Add a Variable object corresponding to a local variable to the current Expression.

Specified by:
addVariable in interface ScopeManager

addField

public void addField(Variable field)
Add a Variable object to the fields of the class

Specified by:
addField in interface ScopeManager
See Also:
Variable

addType

public void addType(java.lang.String name,
                    java.lang.String type)
Empty

Specified by:
addType in interface ScopeManager

addUserType

public void addUserType(java.lang.String name,
                        java.lang.String type)
Add a new type defined with typedef to the user types.

Specified by:
addUserType in interface ScopeManager

addGeneralization

public void addGeneralization(SuperClass superClass)
Add a SuperClass object

Specified by:
addGeneralization in interface ScopeManager
See Also:
SuperClass

addExternalMethod

public void addExternalMethod(Method method)
Empty

Specified by:
addExternalMethod in interface ScopeManager

addExternalField

public void addExternalField(Variable variable)
Empty

Specified by:
addExternalField in interface ScopeManager

addFriendFunction

public void addFriendFunction(Function f)
Add a Function object to the friend functions

Specified by:
addFriendFunction in interface ScopeManager
See Also:
Function

addFriendMethod

public void addFriendMethod(Method m)
Add a Method object to the friend methods

Specified by:
addFriendMethod in interface ScopeManager
See Also:
Method

addFriendClass

public void addFriendClass(Variable v)
Add a Variable object representing a friend class to the friend classes

Specified by:
addFriendClass in interface ScopeManager
See Also:
Variable

addClassHeaderFile

public void addClassHeaderFile(java.lang.String className,
                               java.lang.String headerFileName)
Empty

Specified by:
addClassHeaderFile in interface ScopeManager

setTemplateFlag

public void setTemplateFlag(boolean templateFlag)
Set the template flag. It says if the class is a template


print

public void print(java.lang.String indentation)
Print all information in a ClassEntity objects

Specified by:
print in interface ScopeManager
Parameters:
indentation - String containing blank characters to use as indentation

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
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