entities
Class ForExpression

java.lang.Object
  extended byentities.Expression
      extended byentities.ForExpression
All Implemented Interfaces:
ScopeManager

public class ForExpression
extends Expression

The class ForExpression represents a for statement


Field Summary
 
Fields inherited from class entities.Expression
fCast, fFile, fLBracketPosition, fOperator, fParentScope, fPosition, fPreviousExpression, fRBracketPosition, fToTrace, fTypeOfCast, SEPARATORS
 
Constructor Summary
ForExpression(ScopeManager parentScope)
           
 
Method Summary
 void addExpression(Expression expr, ScopeManager wrapper)
          Add an Expression object associated with a statement inside the for statement to the current Expression
 void addVariable(Variable var)
          Add a Variable object corresponding to a local variable to the current 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.util.Vector getBody()
           
 Expression getCondition()
           
 Expression getIncrement()
           
 Expression getInitialization()
           
 java.lang.String getString()
           
 void print(java.lang.String indentation)
          Print all information contained in a expression of type ForExpression
 void setCondition(Expression expr, ScopeManager wrapper)
          The Expression "expr" is used to represent the condition in the for statement
 void setIncrement(Expression expr, ScopeManager wrapper)
          The Expression "expr" is used to represent the increment in the for statement
 void setInitialization()
          Set the Expression corresponding to the initialization part of for statement
 void setInitialization(Expression expr, ScopeManager wrapper)
          The Expression "expr" is used to represent the initialization part of the for statement
 void setInitialization(ScopeManager wrapper)
          Set the Expression corresponding to the initialization part of for statement
 void setLBracketPosition(int position)
          Empty
 void setRBracketPosition(int position)
          Empty
 
Methods inherited from class entities.Expression
addClass, addClassHeaderFile, addEnumerator, addExternalField, addExternalMethod, addField, addFriendClass, addFriendFunction, addFriendMethod, addFunction, addGeneralization, addMethod, addNameSpace, addType, addUserType, cleanType, computeType, fillName, fillNameNew, getAllocationType, getCast, getCastType, getClassContext, getContainingMethod, getContext, getContextNew, getCurrentMethod, getFile, getLBracketPosition, getName, getOperator, getOperators, getParent, getParentScope, getPosition, getPreviousExpression, getRBracketPosition, getType, getTypeOfCast, propagateParentScope, resolveType, setCast, setFile, setOperator, setParentScope, setPosition, setPreviousExpression, setTypeOfCast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForExpression

public ForExpression(ScopeManager parentScope)
Method Detail

getInitialization

public Expression getInitialization()
Returns:
the Expression corresponding to the initialization statement
 
 Ex: for(i=0; i<10; i++) {...}
 
It returns the Assignment corresponding to the statement "i=0"

getCondition

public Expression getCondition()
Returns:
the Expression corresponding to the condition statement
 
 Ex: for(i=0; i<10; i++) {...}
 
It returns the CompositeExpression corresponding to the statement "i<0"

getIncrement

public Expression getIncrement()
Returns:
the Expression corresponding to the iteration step
 
 Ex: for(i=0; i<10; i++) {...}
 
It returns the AssignmentExpression corresponding to the statement "i++"

getBody

public java.util.Vector getBody()
Returns:
the Vector of the Expression objects contained in the for statement.

setInitialization

public void setInitialization()
Set the Expression corresponding to the initialization part of for statement


setInitialization

public void setInitialization(ScopeManager wrapper)
Set the Expression corresponding to the initialization part of for statement


getString

public java.lang.String getString()
Overrides:
getString in class Expression
Returns:
the representation of the Expression as a String (it is not a thorough reconstruction)

addVariable

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

Specified by:
addVariable in interface ScopeManager
Overrides:
addVariable in class Expression

addExpression

public void addExpression(Expression expr,
                          ScopeManager wrapper)
Add an Expression object associated with a statement inside the for statement to the current Expression

Specified by:
addExpression in interface ScopeManager
Overrides:
addExpression in class Expression

setInitialization

public void setInitialization(Expression expr,
                              ScopeManager wrapper)
The Expression "expr" is used to represent the initialization part of the for statement

Ex: for(i=0; i<10; i++) {...}

In this case "expr" represents the expression (of type CompositeExpression) corresponding to "i=0;"


setCondition

public void setCondition(Expression expr,
                         ScopeManager wrapper)
The Expression "expr" is used to represent the condition in the for statement
 Ex: for(i=0; i<10; i++) {...}
 

In this case "expr" represents the expression (of type CompositeExpression) corresponding to "i<0;"


setIncrement

public void setIncrement(Expression expr,
                         ScopeManager wrapper)
The Expression "expr" is used to represent the increment in the for statement
 Ex: for(i=0; i<10; i++) {...}
 

In this case "expr" represents the expression (of type Assignment) corresponding to "i++;"


findVariableType

public ScopeManager findVariableType(java.lang.String nameToBeFound,
                                     java.lang.StringBuffer typeToBeFound,
                                     Expression expr)
Description copied from class: Expression
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.

Specified by:
findVariableType in interface ScopeManager
Overrides:
findVariableType in class Expression

setLBracketPosition

public void setLBracketPosition(int position)
Description copied from class: Expression
Empty

Overrides:
setLBracketPosition in class Expression
Parameters:
position - represents the position of "{", if present

setRBracketPosition

public void setRBracketPosition(int position)
Description copied from class: Expression
Empty

Overrides:
setRBracketPosition in class Expression
Parameters:
position - represents the position of "}", if present

print

public void print(java.lang.String indentation)
Print all information contained in a expression of type ForExpression

Specified by:
print in interface ScopeManager
Overrides:
print in class Expression