public class MethodCallStatement extends JavaStatement implements StatementContainer, ExpressionContainer
ProgramElement.TreeStructure
SourceElement.Position
Modifier and Type | Field and Description |
---|---|
protected Statement |
body
Body.
|
protected ExecutionContext |
ec |
protected Expression |
resultVar
resultVar (should be a VariableReference, but the parser can't enforce this)
|
private static long |
serialVersionUID |
parent
comments
factory
STRUCTURAL_EQUALITY, STRUCTURAL_HASH_CODE
Modifier | Constructor and Description |
---|---|
|
MethodCallStatement(Expression resultVar,
ExecutionContext ec,
StatementBlock body)
MethodCallStatement.
|
protected |
MethodCallStatement(MethodCallStatement proto)
MethodCallStatement.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(SourceVisitor v) |
MethodCallStatement |
deepClone()
Deep clone.
|
Statement |
getBody()
Get body.
|
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) |
ExecutionContext |
getExecutionContext()
returns the execution context
|
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.
|
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
Expression |
getResultVariable()
Get the result variable.
|
Statement |
getStatementAt(int index)
Return the statement at the specified index in this node's
"virtual" statement array.
|
int |
getStatementCount()
Get the number of statements 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 |
setBody(Statement body)
Set body.
|
void |
setResultVariable(Expression resultVar)
Set the result variable.
|
getASTParent, getStatementContainer, setStatementContainer
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
getASTParent, getComments, setComments
getEndPosition, getFactory, getRelativePosition, getStartPosition, setEndPosition, setRelativePosition, setStartPosition, toSource
validate
private static final long serialVersionUID
protected Expression resultVar
protected ExecutionContext ec
protected Statement body
public MethodCallStatement(Expression resultVar, ExecutionContext ec, StatementBlock body)
resultVar
- the ProgramVariable the return value is assigned tobody
- a Statement containing the method body of
the called methodprotected MethodCallStatement(MethodCallStatement proto)
proto
- a MethodCallStatementpublic void setResultVariable(Expression resultVar)
resultVar
- the result variablepublic Expression getResultVariable()
public void setBody(Statement body)
body
- the Statementpublic Statement getBody()
public SourceElement getFirstElement()
getFirstElement
in interface SourceElement
getFirstElement
in class JavaSourceElement
public SourceElement getLastElement()
getLastElement
in interface SourceElement
getLastElement
in class JavaSourceElement
public ExecutionContext getExecutionContext()
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 getChildPositionCode(ProgramElement child)
getChildPositionCode
in interface NonTerminalProgramElement
public int getStatementCount()
getStatementCount
in interface StatementContainer
public Statement getStatementAt(int index)
getStatementAt
in interface StatementContainer
index
- an index for a statement.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 void accept(SourceVisitor v)
accept
in interface SourceElement
public MethodCallStatement deepClone()
deepClone
in interface SourceElement
deepClone
in interface Statement