entities
Class TryExpression

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

public class TryExpression
extends Expression

The class TryExpression represents the statements in a try block


Field Summary
 
Fields inherited from class entities.Expression
fCast, fFile, fLBracketPosition, fOperator, fParentScope, fPosition, fPreviousExpression, fRBracketPosition, fToTrace, fTypeOfCast, SEPARATORS
 
Constructor Summary
TryExpression(ScopeManager parentScope)
           
 
Method Summary
 void addCatch(CatchExpression catchExpr)
           
 void addExpression(Expression expr, ScopeManager wrapper)
          Add an Expression object associated with a statement inside the try block to the current object
 void addVariable(Variable var)
          Empty
 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
 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()
           
 java.util.Vector getCatches()
           
 java.lang.String getString()
           
 void print(java.lang.String indentation)
          Empty
 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, 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

TryExpression

public TryExpression(ScopeManager parentScope)
Method Detail

getBody

public java.util.Vector getBody()
Returns:
a Vector of objects of type Expression corresponding to the statements found inside the try block.

getCatches

public java.util.Vector getCatches()
Returns:
the Vector containing the objects (of type Expression) corresponding to catch blocks
 
 Ex:  try { 
      } catch (Overflow& o) {
            ....
       }
       catch (Underflow& u) {
            ....
       }
 }
 
In this case it returns a Vector containing 2 CatchExpression associated to the 2 catch statements

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)
Description copied from class: Expression
Empty

Specified by:
addVariable in interface ScopeManager
Overrides:
addVariable in class Expression
Parameters:
var - represents a local variable declared inside the try block

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

addExpression

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

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

addCatch

public void addCatch(CatchExpression catchExpr)
Parameters:
catchExpr - represents the expression associated with a catch block
 
 Ex:  try { 
      } catch (Overflow& o) {
            ....
       }
 }
 
In this case "catchExpr" represents the statement "catch (Overflow& o) {....}"

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

computeType

public void computeType(ScopeInfo scopeInfo,
                        java.lang.String indentation)
Description copied from class: Expression
This method, properly overwritten in the subclasses, computes recursively the types of variables involved in the expressions

Overrides:
computeType in class Expression

print

public void print(java.lang.String indentation)
Description copied from class: Expression
Empty

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