entities
Class Allocation

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

public class Allocation
extends Expression

The Allocation class represents the information regarding the allocation of a new object obtained by the "new" statement


Field Summary
 
Fields inherited from class entities.Expression
fCast, fFile, fLBracketPosition, fOperator, fParentScope, fPosition, fPreviousExpression, fRBracketPosition, fToTrace, fTypeOfCast, SEPARATORS
 
Constructor Summary
Allocation(ScopeManager parentScope)
           
 
Method Summary
 void computeType(ScopeInfo scopeInfo, java.lang.String indentation)
          This method computes recursively the types on the parameters, size and placement expressions
 void fillName(java.lang.StringBuffer fullName, java.lang.String previousType)
          Compute the complete name to be associated to a SimpleVariable or to a Call expression.
 java.lang.String getAllocationType()
          Give the information about the type
 Parameter getFormalParameter(int i)
           
 java.util.Vector getFormalParameters()
           
 Method getMethod()
           
 java.util.Vector getParameters()
           
 Expression getPlacement()
           
 java.util.Vector getSize()
           
 java.lang.String getString()
           
 java.lang.String getType()
          For expressions that have a field corresponding to the type, it returns the type or null
 void print(java.lang.String indentation)
          Print all information contained in the expression
 void setAllocationType(java.lang.String type)
          The parameter "type" (of type String) is used to represent the type of the just created object.
 void setParameters(java.util.Vector parameters)
          The parameter "parameters" is used to represent the actual parameters
 void setPlacement(Expression placement)
          The parameter "placement" is used to represent the address in memory where to start to allocate the new object
 void setSize(java.util.Vector size)
          The parameter "size" is used to represent the numbers of objects that have to be created
 
Methods inherited from class entities.Expression
addClass, addClassHeaderFile, addEnumerator, addExpression, addExternalField, addExternalMethod, addField, addFriendClass, addFriendFunction, addFriendMethod, addFunction, addGeneralization, addMethod, addNameSpace, addType, addUserType, addVariable, cleanType, fillNameNew, findVariableType, getCast, getCastType, getClassContext, getContainingMethod, getContext, getContextNew, getCurrentMethod, getFile, getLBracketPosition, getName, getOperator, getOperators, getParent, getParentScope, getPosition, getPreviousExpression, getRBracketPosition, getTypeOfCast, propagateParentScope, resolveType, setCast, setFile, setLBracketPosition, setOperator, setParentScope, setPosition, setPreviousExpression, setRBracketPosition, setTypeOfCast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Allocation

public Allocation(ScopeManager parentScope)
Method Detail

getType

public java.lang.String getType()
Description copied from class: Expression
For expressions that have a field corresponding to the type, it returns the type or null

Overrides:
getType in class Expression
Returns:
the String corresponding to the Allocation type

Ex: new A () the type is "A".


getParameters

public java.util.Vector getParameters()
Returns:
the Vector of Expression objects corresponding to the parameters

getFormalParameters

public java.util.Vector getFormalParameters()
Returns:
the Vector of Parameter objects corresponding to the definition parameters

getFormalParameter

public Parameter getFormalParameter(int i)
Returns:
the Parameter object corresponding to the i-parameter if it exists, null otherwise

getMethod

public Method getMethod()
Returns:
the Method entity corresponding to the call if this has been found, null otherwise

getPlacement

public Expression getPlacement()
Returns:
the Expression object corresponding to the placement if this exists, null otherwise.

Ex: X* = new (buf)X; --> construct an X at "buf"

In this case it returns the object (of type Expression) corresponding to "buf";


getSize

public java.util.Vector getSize()
Returns:
the Vector of Expression objects corresponding to the size.

Ex: int s; Employee *p = new Employee[s];

In this case it returns the Expression object corresponding to "s"


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)

setAllocationType

public void setAllocationType(java.lang.String type)
The parameter "type" (of type String) is used to represent the type of the just created object.

Ex: new A () the type is "A".


setParameters

public void setParameters(java.util.Vector parameters)
The parameter "parameters" is used to represent the actual parameters

Ex: int x =10; A* a = new A(x);

In this case it will contain the expression (of type SimpleVariable) corresponding to the variable "x"


setPlacement

public void setPlacement(Expression placement)
The parameter "placement" is used to represent the address in memory where to start to allocate the new object

Ex: X* = new (buf)X;

In this case "placement" will contain the expression (of type SimpleVariable) correspondig to the variable "buf".


setSize

public void setSize(java.util.Vector size)
The parameter "size" is used to represent the numbers of objects that have to be created

Ex: int s; Employee *p = new Employee[s];

In this case "size" will contain the expression (of type SimpleVariable) correspondig to the variable "s"


computeType

public void computeType(ScopeInfo scopeInfo,
                        java.lang.String indentation)
This method computes recursively the types on the parameters, size and placement expressions

Overrides:
computeType in class Expression

print

public void print(java.lang.String indentation)
Print all information contained in the expression

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

getAllocationType

public java.lang.String getAllocationType()
Give the information about the type

Overrides:
getAllocationType in class Expression
Returns:
null

fillName

public void fillName(java.lang.StringBuffer fullName,
                     java.lang.String previousType)
Description copied from class: Expression
Compute the complete name to be associated to a SimpleVariable or to a Call expression.

Overrides:
fillName in class Expression