|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectentities.Expression
Represent a generic C++ statement
Field Summary | |
protected java.lang.String |
fCast
Represents the type to which the expression is cast. |
protected java.lang.String |
fFile
The string corresponding to the name of file containing the statement |
protected int |
fLBracketPosition
Represent the position of "{" if present |
protected java.lang.String |
fOperator
Contains the operators associated with the expression. |
protected ScopeManager |
fParentScope
The entity in which the expression is. |
protected int |
fPosition
The line corresponding to the statement |
protected Expression |
fPreviousExpression
Given an expression A with attribute "fField" not null, the attribute fPreviousExpression of the fField expression is the expression A. |
protected int |
fRBracketPosition
Represent the position of "}" if present |
protected boolean |
fToTrace
Temporary field to trace the expressions |
protected java.lang.String |
fTypeOfCast
If a cast is present fTypeOfCast contains information about the type of cast (dynamic_cast, static_cast, reinterpret_cast, const_cast, typeid, normal) |
protected static java.lang.String |
SEPARATORS
|
Constructor Summary | |
Expression()
|
Method Summary | |
void |
addClass(ClassEntity cl)
Empty |
void |
addClassHeaderFile(java.lang.String className,
java.lang.String headerFileName)
Empty |
void |
addEnumerator(Enumerator en)
Empty |
void |
addExpression(Expression expr,
ScopeManager wrapper)
Empty |
void |
addExternalField(Variable variable)
Empty |
void |
addExternalMethod(Method method)
Empty |
void |
addField(Variable variable)
Empty |
void |
addFriendClass(Variable variable)
Empty |
void |
addFriendFunction(Function function)
Empty |
void |
addFriendMethod(Method method)
Empty |
void |
addFunction(Function function)
Empty |
void |
addGeneralization(SuperClass superClass)
Empty |
void |
addMethod(Method method)
Empty |
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)
Empty |
void |
addVariable(Variable var)
Empty |
protected java.lang.String |
cleanType(java.lang.String type)
Remove from "type" the symbols "*", "&", "const".... |
void |
computeType(ScopeInfo scopeInfo,
java.lang.String indentation)
This method, properly overwritten in the subclasses, computes recursively the types of variables involved in the expressions |
void |
fillName(java.lang.StringBuffer fullName,
java.lang.String type)
Compute the complete name to be associated to a SimpleVariable or to a Call expression. |
void |
fillNameNew(java.lang.StringBuffer fullName,
java.lang.String type)
Compute the complete name to be associated to a SimpleVariable or to a Call expression. |
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 variabl type. |
java.lang.String |
getAllocationType()
|
java.lang.String |
getCast()
|
java.lang.String |
getCastType()
|
protected java.lang.String |
getClassContext(ScopeManager parent)
|
Method |
getContainingMethod()
|
protected java.lang.String |
getContext(ScopeManager parent)
|
java.lang.String |
getContextNew()
|
Method |
getCurrentMethod(java.lang.String methodName,
java.util.Vector parameters)
|
java.lang.String |
getFile()
|
int |
getLBracketPosition()
|
java.lang.String |
getName()
|
java.lang.String |
getOperator()
|
java.util.Vector |
getOperators()
|
ScopeManager |
getParent()
|
ScopeManager |
getParentScope()
|
int |
getPosition()
|
Expression |
getPreviousExpression()
|
int |
getRBracketPosition()
|
java.lang.String |
getString()
|
java.lang.String |
getType()
For expressions that have a field corresponding to the type, it returns the type or null |
java.lang.String |
getTypeOfCast()
|
void |
print(java.lang.String indentation)
Empty |
void |
propagateParentScope(ScopeManager scope)
Propagate the scope to related expressions (it is properly overwritten in the subclasses). |
java.lang.String |
resolveType()
|
void |
setCast(java.lang.String cast)
|
void |
setFile(java.lang.String file)
|
void |
setLBracketPosition(int position)
Empty |
void |
setOperator(java.lang.String operator)
|
void |
setParentScope(ScopeManager parentScope)
|
void |
setPosition(int position)
|
void |
setPreviousExpression(Expression expr)
|
void |
setRBracketPosition(int position)
Empty |
void |
setTypeOfCast(java.lang.String typeOfCast)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String fFile
protected int fPosition
protected ScopeManager fParentScope
Ex: A a; for(...) {a->b();... }
Both the Expression objects corresponding to a and b have the expression corresponding to the for as parent scope.
protected java.lang.String fCast
Ex: (A) x; fCast contains A.
protected java.lang.String fTypeOfCast
protected java.lang.String fOperator
Ex: the expression "a + b - c + d" is represented with a CompositeExpression expression with fOperator equals to "+ - +")
protected Expression fPreviousExpression
Ex: a->b(); a->f;
On the Expression object representing the call b() returns the Expression object representing the variable a.
On the Expression object representing the variable f returns the Expression object representing the variable a.
protected int fLBracketPosition
protected int fRBracketPosition
protected boolean fToTrace
protected static final java.lang.String SEPARATORS
Constructor Detail |
public Expression()
Method Detail |
public java.lang.String getFile()
public int getPosition()
public java.lang.String getType()
public java.lang.String getCast()
public java.lang.String getTypeOfCast()
public ScopeManager getParentScope()
fParentScope
public Expression getPreviousExpression()
fPreviousExpression
public java.lang.String getString()
public java.lang.String getOperator()
public java.util.Vector getOperators()
Ex: called on the CompositeExpression representing the expression "a+b-c+d" return the Vector containing the elements "+", "-", "+".
protected java.lang.String getContext(ScopeManager parent)
public java.lang.String getContextNew()
protected java.lang.String getClassContext(ScopeManager parent)
public Method getContainingMethod()
public int getLBracketPosition()
public int getRBracketPosition()
public void setFile(java.lang.String file)
file
- represent the name of the file in which the
statement has been foundpublic void setPosition(int position)
position
- represent the line (the first if it is on more
lines) in which the statement has been foundpublic void setTypeOfCast(java.lang.String typeOfCast)
typeOfCast
- represent the type of cast (dynamic_cast,
static_cast, reinterpret_cast, const_cast, typeid, normal)public void setCast(java.lang.String cast)
cast
- represent the cast before the expression if it is
presentfCast
public void setOperator(java.lang.String operator)
operator
- represent the operator before the expression if it is
presentfOperator
public void print(java.lang.String indentation)
print
in interface ScopeManager
public void setParentScope(ScopeManager parentScope)
parentScope
- represent the entity in which the expression is foundfParentScope
public void setPreviousExpression(Expression expr)
expr
- represent the expression found before the "." or "->",fPreviousExpression
public void setLBracketPosition(int position)
public void setRBracketPosition(int position)
public void computeType(ScopeInfo scopeInfo, java.lang.String indentation)
public void propagateParentScope(ScopeManager scope)
protected java.lang.String cleanType(java.lang.String type)
public java.lang.String resolveType()
public void fillName(java.lang.StringBuffer fullName, java.lang.String type)
public void fillNameNew(java.lang.StringBuffer fullName, java.lang.String type)
public java.lang.String getAllocationType()
public java.lang.String getCastType()
public void addEnumerator(Enumerator en)
addEnumerator
in interface ScopeManager
public void addNameSpace(NameSpace namespace)
addNameSpace
in interface ScopeManager
public void addExpression(Expression expr, ScopeManager wrapper)
addExpression
in interface ScopeManager
public void addClass(ClassEntity cl)
addClass
in interface ScopeManager
public void addFunction(Function function)
addFunction
in interface ScopeManager
public void addMethod(Method method)
addMethod
in interface ScopeManager
public void addVariable(Variable var)
addVariable
in interface ScopeManager
public void addField(Variable variable)
addField
in interface ScopeManager
public void addType(java.lang.String name, java.lang.String type)
addType
in interface ScopeManager
public void addUserType(java.lang.String name, java.lang.String type)
addUserType
in interface ScopeManager
public void addGeneralization(SuperClass superClass)
addGeneralization
in interface ScopeManager
public void addExternalMethod(Method method)
addExternalMethod
in interface ScopeManager
public void addExternalField(Variable variable)
addExternalField
in interface ScopeManager
public void addFriendFunction(Function function)
addFriendFunction
in interface ScopeManager
public void addFriendMethod(Method method)
addFriendMethod
in interface ScopeManager
public void addFriendClass(Variable variable)
addFriendClass
in interface ScopeManager
public void addClassHeaderFile(java.lang.String className, java.lang.String headerFileName)
addClassHeaderFile
in interface ScopeManager
public Method getCurrentMethod(java.lang.String methodName, java.util.Vector parameters)
getCurrentMethod
in interface ScopeManager
public java.lang.String getName()
getName
in interface ScopeManager
public ScopeManager findVariableType(java.lang.String nameToBeFound, java.lang.StringBuffer typeToBeFound, Expression expr)
findVariableType
in interface ScopeManager
public ScopeManager getParent()
getParent
in interface ScopeManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |