aspoev.interpreter.base
Class MethodDeclarationElement

java.lang.Object
  extended byaspoev.interpreter.base.Element
      extended byaspoev.interpreter.base.MethodDeclarationElement
All Implemented Interfaces:
java.lang.Cloneable, aspoev.Executable, MemberElement, pJ.jasmine.PRI, java.io.Serializable
Direct Known Subclasses:
ConstructorDeclarationElement

public class MethodDeclarationElement
extends Element
implements MemberElement, pJ.jasmine.PRI

A meta method. This structure contains the executable portion of vejal types.

See Also:
Serialized Form

Field Summary
protected static int ID_BASE
           
protected  BlockElement methodBody
           
protected  java.lang.String methodName
           
protected  ParameterListElement methodParameters
           
protected  TypeReferenceElement returnType
           
protected  int uniqueID
           
 
Fields inherited from class aspoev.interpreter.base.Element
parent
 
Fields inherited from interface pJ.jasmine.PRI
DELETECHANGE, MODIFYCHANGE, NOCHANGE
 
Constructor Summary
MethodDeclarationElement()
           
MethodDeclarationElement(TypeReferenceElement returnType, java.lang.String methodName, ParameterListElement parameters, BlockElement methodBody)
           
 
Method Summary
protected  void addParameter(TypeReferenceElement newParam, java.lang.String paramName)
           
 void addParameter(TypeReferenceElement paramType, java.lang.String paramName, int position)
           
protected  java.lang.String changeMethodName(java.lang.String newName)
           
protected  TypeReferenceElement changeParameterType(int position, TypeReferenceElement newType)
           
 TypeReferenceElement changeReturnType(TypeReferenceElement newType)
           
 java.lang.Object clone()
          Returns a copy of this method.
 boolean equals(java.lang.Object other)
           
 java.lang.Object execute(ArgumentListElement arguments)
           
protected  java.lang.Object executeElement()
           
 java.util.Collection getChildrenByType(java.lang.Class childClass)
           
 java.lang.String getCodeString()
           
 TypeReferenceElement getDeclaration()
          Returns the type in which this method is declared.
 VariableDeclarationElement getDeclaration(VariableReferenceElement handle)
          Returns the local declaration of the variable.
 java.util.Collection getFieldReferences()
           
 java.util.Collection getMethodInvokations()
           
 java.util.Collection getMethodInvokations(MethodDeclarationElement method)
           
 int getNumParameters()
           
 ParameterListElement getParameters()
           
 TypeReferenceElement[] getParameterTypes()
           
 java.lang.Object getRValue()
           
 java.lang.String getSigniture()
           
 TypeReferenceElement getStaticType(VariableReferenceElement variable)
           
 java.util.Collection getTypeDependencies()
           
 java.util.Collection getVariableDeclarations()
           
 java.util.Collection getVariableReferences()
           
 boolean invokesMethod(MethodDeclarationElement method)
           
 int parameterTypeMatch(TypeReferenceElement[] paramTypes)
           
 boolean referencesField(FieldDeclarationElement field)
           
 void setBody(BlockElement body)
           
 void setDeclaration(ClassDeclarationElement declaration)
           
 void setParameters(ParameterListElement params)
           
 int signitureMatch(MethodDeclarationElement otherMethod)
          Returns an integer describing how equal the signiture of the other method is to the signiture of this method.
 java.lang.String toShortString()
           
 boolean usesMember(MemberElement member)
           
 
Methods inherited from class aspoev.interpreter.base.Element
execute, persist, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID_BASE

protected static int ID_BASE

uniqueID

protected int uniqueID

methodBody

protected BlockElement methodBody

methodParameters

protected ParameterListElement methodParameters

methodName

protected java.lang.String methodName

returnType

protected TypeReferenceElement returnType
Constructor Detail

MethodDeclarationElement

public MethodDeclarationElement()

MethodDeclarationElement

public MethodDeclarationElement(TypeReferenceElement returnType,
                                java.lang.String methodName,
                                ParameterListElement parameters,
                                BlockElement methodBody)
Method Detail

addParameter

public void addParameter(TypeReferenceElement paramType,
                         java.lang.String paramName,
                         int position)

addParameter

protected void addParameter(TypeReferenceElement newParam,
                            java.lang.String paramName)

changeMethodName

protected java.lang.String changeMethodName(java.lang.String newName)

changeParameterType

protected TypeReferenceElement changeParameterType(int position,
                                                   TypeReferenceElement newType)

changeReturnType

public TypeReferenceElement changeReturnType(TypeReferenceElement newType)

clone

public java.lang.Object clone()
Returns a copy of this method.

Specified by:
clone in class Element

equals

public boolean equals(java.lang.Object other)

execute

public java.lang.Object execute(ArgumentListElement arguments)

executeElement

protected java.lang.Object executeElement()
Specified by:
executeElement in class Element

getTypeDependencies

public java.util.Collection getTypeDependencies()

getDeclaration

public TypeReferenceElement getDeclaration()
Returns the type in which this method is declared.


getDeclaration

public VariableDeclarationElement getDeclaration(VariableReferenceElement handle)
Returns the local declaration of the variable. If the variable was not declared locally, returns null.


getFieldReferences

public java.util.Collection getFieldReferences()

getVariableDeclarations

public java.util.Collection getVariableDeclarations()

getVariableReferences

public java.util.Collection getVariableReferences()

getMethodInvokations

public java.util.Collection getMethodInvokations()

getMethodInvokations

public java.util.Collection getMethodInvokations(MethodDeclarationElement method)

getNumParameters

public int getNumParameters()

getRValue

public java.lang.Object getRValue()
Overrides:
getRValue in class Element

getStaticType

public TypeReferenceElement getStaticType(VariableReferenceElement variable)

getParameters

public ParameterListElement getParameters()

getParameterTypes

public TypeReferenceElement[] getParameterTypes()

getSigniture

public java.lang.String getSigniture()

invokesMethod

public boolean invokesMethod(MethodDeclarationElement method)

referencesField

public boolean referencesField(FieldDeclarationElement field)

usesMember

public boolean usesMember(MemberElement member)

setDeclaration

public void setDeclaration(ClassDeclarationElement declaration)

setBody

public void setBody(BlockElement body)

setParameters

public void setParameters(ParameterListElement params)

signitureMatch

public int signitureMatch(MethodDeclarationElement otherMethod)
Returns an integer describing how equal the signiture of the other method is to the signiture of this method. 0 is a perfect match.


parameterTypeMatch

public int parameterTypeMatch(TypeReferenceElement[] paramTypes)

getChildrenByType

public java.util.Collection getChildrenByType(java.lang.Class childClass)
Specified by:
getChildrenByType in class Element

getCodeString

public java.lang.String getCodeString()
Specified by:
getCodeString in class Element

toShortString

public java.lang.String toShortString()