public class MethodBodyStatement extends JavaStatement implements TypeReferenceContainer, ExpressionContainer, NamedProgramElement, ReferenceSuffix
NamedModelElement.LexicalOrderProgramElement.TreeStructureSourceElement.Position| Modifier and Type | Field and Description |
|---|---|
private ASTList<Expression> |
arguments |
private StatementContainer |
astParent
the ast parent
|
protected TypeReference |
bodySource |
private Identifier |
methodName |
private ReferencePrefix |
methodReferencePrefix |
protected Expression |
resultVar |
private static long |
serialVersionUID |
parentcommentsfactoryLEXICAL_ORDERSTRUCTURAL_EQUALITY, STRUCTURAL_HASH_CODE| Constructor and Description |
|---|
MethodBodyStatement(TypeReference bodySource,
Expression resultVar,
MethodReference methRef)
Construct a method body shortcut
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(SourceVisitor v) |
MethodBodyStatement |
deepClone() |
ASTList<Expression> |
getArguments() |
NonTerminalProgramElement |
getASTParent() |
TypeReference |
getBodySource()
Get the exact Class the denoted method body is from.
|
ProgramElement |
getChildAt(int index)
Returns the child at the specified index in this node's "virtual"
child array
|
int |
getChildCount()
Returns the number of children of this node.
|
int |
getChildPositionCode(ProgramElement child) |
Expression |
getExpressionAt(int index)
Return the expression at the specified index in this node's
"virtual" expression array.
|
int |
getExpressionCount()
Get the number of expressions in this container.
|
SourceElement |
getFirstElement()
Finds the source element that occurs first in the source.
|
Identifier |
getIdentifier() |
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
Identifier |
getMethodName() |
ReferencePrefix |
getMethodReferencePrefix() |
java.lang.String |
getName() |
ReferencePrefix |
getReferencePrefix() |
Expression |
getResultVariable()
Get the result variable.
|
MethodReference |
getsMethodReference() |
StatementContainer |
getStatementContainer() |
TypeReference |
getTypeReferenceAt(int index)
Return the type reference at the specified index in this node's
"virtual" statement array.
|
int |
getTypeReferenceCount()
Get the number of type references in this container.
|
void |
makeParentRoleValid()
Ensures that each child has "this" as syntactical parent.
|
boolean |
replaceChild(ProgramElement p,
ProgramElement q)
Replace a single child in the current node.
|
void |
setArguments(ASTList<Expression> arguments) |
void |
setBodySource(TypeReference bodySource)
Set the exact Class the denoted method body is from.
|
void |
setIdentifier(Identifier name) |
void |
setMethodName(Identifier methodName) |
void |
setMethodReference(MethodReference methRef)
Set the MethodReference that caused this call.
|
void |
setMethodReferencePrefix(ReferencePrefix methodReferencePrefix) |
void |
setResultVariable(Expression resultVar)
Set the result variable.
|
void |
setStatementContainer(StatementContainer parent) |
getIndexOfChild, getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAllgetComments, setComments, validategetEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSourceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetIndexOfChild, getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAllgetComments, setCommentsgetEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSourcevalidateprivate static final long serialVersionUID
private StatementContainer astParent
protected TypeReference bodySource
protected Expression resultVar
private Identifier methodName
private ReferencePrefix methodReferencePrefix
private ASTList<Expression> arguments
public MethodBodyStatement(TypeReference bodySource, Expression resultVar, MethodReference methRef)
bodySource - exact class where the body is declaredresultVar - the Expression naming the variable to which
the result of the mthod is assignedmethRef - MethodReference that represents the callpublic void setBodySource(TypeReference bodySource)
public TypeReference getBodySource()
public void setResultVariable(Expression resultVar)
resultVar - the Expression used as result variablepublic Expression getResultVariable()
public void setMethodReference(MethodReference methRef)
public NonTerminalProgramElement getASTParent()
getASTParent in interface ProgramElementgetASTParent in class JavaStatementpublic StatementContainer getStatementContainer()
getStatementContainer in interface StatementgetStatementContainer in class JavaStatementpublic void setStatementContainer(StatementContainer parent)
setStatementContainer in interface StatementsetStatementContainer in class JavaStatementpublic SourceElement getFirstElement()
getFirstElement in interface SourceElementgetFirstElement in class JavaSourceElementpublic SourceElement getLastElement()
getLastElement in interface SourceElementgetLastElement in class JavaSourceElementpublic int getChildCount()
getChildCount in interface NonTerminalProgramElementpublic ProgramElement getChildAt(int index)
getChildAt in interface NonTerminalProgramElementindex - an index into this node's "virtual" child arrayjava.lang.ArrayIndexOutOfBoundsException - if index is out
of boundspublic int getTypeReferenceCount()
getTypeReferenceCount in interface TypeReferenceContainerpublic TypeReference getTypeReferenceAt(int index)
getTypeReferenceAt in interface TypeReferenceContainerindex - an index for a type reference.java.lang.ArrayIndexOutOfBoundsException - if index is out
of bounds.public int getExpressionCount()
getExpressionCount in interface ExpressionContainerpublic Expression getExpressionAt(int index)
getExpressionAt in interface ExpressionContainerindex - an index for a expression.java.lang.ArrayIndexOutOfBoundsException - if index is out
of bounds.public boolean replaceChild(ProgramElement p, ProgramElement q)
replaceChild in interface NonTerminalProgramElementp - the old child.q - the new child.java.lang.ClassCastException - if the new child cannot take over
the role of the old one.public void makeParentRoleValid()
makeParentRoleValid in interface NonTerminalProgramElementmakeParentRoleValid in class JavaNonTerminalProgramElementpublic int getChildPositionCode(ProgramElement child)
getChildPositionCode in interface NonTerminalProgramElementpublic void accept(SourceVisitor v)
accept in interface SourceElementpublic MethodBodyStatement deepClone()
deepClone in interface SourceElementdeepClone in interface Statementpublic java.lang.String getName()
getName in interface NamedModelElementpublic ASTList<Expression> getArguments()
public void setArguments(ASTList<Expression> arguments)
public Identifier getMethodName()
public void setMethodName(Identifier methodName)
public ReferencePrefix getMethodReferencePrefix()
public void setMethodReferencePrefix(ReferencePrefix methodReferencePrefix)
public Identifier getIdentifier()
getIdentifier in interface NamedProgramElementpublic void setIdentifier(Identifier name)
setIdentifier in interface NamedProgramElementpublic MethodReference getsMethodReference()
public ReferencePrefix getReferencePrefix()
getReferencePrefix in interface ReferenceSuffix