public class MethodBodyStatement extends JavaStatement implements TypeReferenceContainer, ExpressionContainer, NamedProgramElement, ReferenceSuffix
NamedModelElement.LexicalOrder
ProgramElement.TreeStructure
SourceElement.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 |
parent
comments
factory
LEXICAL_ORDER
STRUCTURAL_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, validateAll
getComments, setComments, validate
getEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIndexOfChild, getIndexOfChild, getRoleOfChild, makeAllParentRolesValid, validateAll
getComments, setComments
getEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
validate
private 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 ProgramElement
getASTParent
in class JavaStatement
public StatementContainer getStatementContainer()
getStatementContainer
in interface Statement
getStatementContainer
in class JavaStatement
public void setStatementContainer(StatementContainer parent)
setStatementContainer
in interface Statement
setStatementContainer
in class JavaStatement
public SourceElement getFirstElement()
getFirstElement
in interface SourceElement
getFirstElement
in class JavaSourceElement
public SourceElement getLastElement()
getLastElement
in interface SourceElement
getLastElement
in class JavaSourceElement
public int getChildCount()
getChildCount
in interface NonTerminalProgramElement
public ProgramElement getChildAt(int index)
getChildAt
in interface NonTerminalProgramElement
index
- an index into this node's "virtual" child arrayjava.lang.ArrayIndexOutOfBoundsException
- if index is out
of boundspublic int getTypeReferenceCount()
getTypeReferenceCount
in interface TypeReferenceContainer
public TypeReference getTypeReferenceAt(int index)
getTypeReferenceAt
in interface TypeReferenceContainer
index
- an index for a type reference.java.lang.ArrayIndexOutOfBoundsException
- if index is out
of bounds.public int getExpressionCount()
getExpressionCount
in interface ExpressionContainer
public Expression getExpressionAt(int index)
getExpressionAt
in interface ExpressionContainer
index
- an index for a expression.java.lang.ArrayIndexOutOfBoundsException
- if index is out
of bounds.public boolean replaceChild(ProgramElement p, ProgramElement q)
replaceChild
in interface NonTerminalProgramElement
p
- 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 NonTerminalProgramElement
makeParentRoleValid
in class JavaNonTerminalProgramElement
public int getChildPositionCode(ProgramElement child)
getChildPositionCode
in interface NonTerminalProgramElement
public void accept(SourceVisitor v)
accept
in interface SourceElement
public MethodBodyStatement deepClone()
deepClone
in interface SourceElement
deepClone
in interface Statement
public java.lang.String getName()
getName
in interface NamedModelElement
public 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 NamedProgramElement
public void setIdentifier(Identifier name)
setIdentifier
in interface NamedProgramElement
public MethodReference getsMethodReference()
public ReferencePrefix getReferencePrefix()
getReferencePrefix
in interface ReferenceSuffix