public class MethodDeclaration extends JavaDeclaration implements MemberDeclaration, TypeReferenceContainer, NamedProgramElement, ParameterContainer, Method, VariableScope
Modifier and Type | Field and Description |
---|---|
protected StatementBlock |
body |
protected Throws |
exceptions |
protected ProgramElementName |
name |
protected ImmutableArray<ParameterDeclaration> |
parameters |
protected boolean |
parentIsInterfaceDeclaration
this field stores if parent is an InterfaceDeclaration because we will be
unable to walk the tree upwards to check this
|
protected TypeReference |
returnType |
protected Comment[] |
voidComments |
modArray
Constructor and Description |
---|
MethodDeclaration(ExtList children,
boolean parentIsInterfaceDeclaration,
Comment[] voidComments)
Method declaration.
|
MethodDeclaration(Modifier[] modifiers,
TypeReference returnType,
ProgramElementName name,
ImmutableArray<ParameterDeclaration> parameters,
Throws exceptions,
StatementBlock body,
boolean parentIsInterfaceDeclaration)
Method declaration.
|
MethodDeclaration(Modifier[] modifiers,
TypeReference returnType,
ProgramElementName name,
ParameterDeclaration[] parameters,
Throws exceptions,
StatementBlock body,
boolean parentIsInterfaceDeclaration)
Method declaration.
|
Modifier and Type | Method and Description |
---|---|
StatementBlock |
getBody() |
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.
|
SourceElement |
getFirstElement()
Finds the source element that occurs first in the source.
|
java.lang.String |
getFullName()
Returns the maximal expanded name including all applicable
qualifiers.
|
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
java.lang.String |
getName()
Return the name of the model element.
|
ParameterDeclaration |
getParameterDeclarationAt(int index)
Return the parameter declaration at the specified index in this node's
"virtual" parameter declaration array.
|
int |
getParameterDeclarationCount()
Get the number of parameters in this container.
|
ImmutableArray<ParameterDeclaration> |
getParameters() |
ProgramElementName |
getProgramElementName()
Get identifier.
|
int |
getStateCount()
Get the state count of the declaration
|
Statement |
getStatementAt(int index) |
int |
getStatementCount()
Get the number of statements in this container.
|
Throws |
getThrown() |
TypeReference |
getTypeReference()
Get return type.
|
TypeReference |
getTypeReferenceAt(int index) |
int |
getTypeReferenceCount()
Get the number of type references in this container.
|
Comment[] |
getVoidComments() |
boolean |
isAbstract()
Test whether the declaration is abstract.
|
boolean |
isFinal()
Test whether the declaration is final.
|
boolean |
isModel()
Test whether the declaration is model (the jml modifier is meant).
|
boolean |
isNative()
Test whether the declaration is native.
|
boolean |
isPrivate()
Test whether the declaration is private.
|
boolean |
isProtected()
Test whether the declaration is protected.
|
boolean |
isPublic()
Test whether the declaration is public.
|
boolean |
isStatic()
Test whether the declaration is static.
|
boolean |
isStrictFp()
Test whether the declaration is strictfp.
|
boolean |
isSynchronized()
Test whether the declaration is synchronized.
|
boolean |
isVarArgMethod()
test whether the declaration is a method with a variable number of arguments (i.e. the ellipsis ...)
|
void |
prettyPrint(PrettyPrinter p)
Pretty printing the source element.
|
void |
visit(Visitor v)
calls the corresponding method of a visitor in order to
perform some action/transformation on this element
|
getModifiers, getVisibilityModifier, isGhost, isTransient, isVolatile
compatibleBlockSize, computeHashCode, equals, equalsModRenaming, getArrayPos, match, matchChildren
getComments, hashCode, prettyPrintMain, reuseSignature
getEndPosition, getFirstElementIncludingBlocks, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getModifiers
getComments, match
equalsModRenaming, getEndPosition, getFirstElementIncludingBlocks, getPositionInfo, getRelativePosition, getStartPosition
protected final TypeReference returnType
protected final Comment[] voidComments
protected final ProgramElementName name
protected final ImmutableArray<ParameterDeclaration> parameters
protected final Throws exceptions
protected final StatementBlock body
protected final boolean parentIsInterfaceDeclaration
public MethodDeclaration(ExtList children, boolean parentIsInterfaceDeclaration, Comment[] voidComments)
children
- an ExtList of children. May
include: a TypeReference (as a reference to the return type), a
de.uka.ilkd.key.logic.ProgramElementName (as Name of the method),
several ParameterDeclaration (as parameters of the declared method), a
StatementBlock (as body of the declared method), several Modifier
(taken as modifiers of the declaration), a CommentparentIsInterfaceDeclaration
- a boolean set true iff
parent is an InterfaceDeclarationpublic MethodDeclaration(Modifier[] modifiers, TypeReference returnType, ProgramElementName name, ParameterDeclaration[] parameters, Throws exceptions, StatementBlock body, boolean parentIsInterfaceDeclaration)
modifiers
- a modifier arrayreturnType
- a type reference.name
- an identifier.parameters
- a parameter declaration mutable list.exceptions
- a throws.body
- a statement block.parentIsInterfaceDeclaration
- a boolean set true iff
parent is an InterfaceDeclarationpublic MethodDeclaration(Modifier[] modifiers, TypeReference returnType, ProgramElementName name, ImmutableArray<ParameterDeclaration> parameters, Throws exceptions, StatementBlock body, boolean parentIsInterfaceDeclaration)
modifiers
- a modifier arrayreturnType
- a type reference.name
- an identifier.parameters
- a parameter declaration mutable list.exceptions
- a throws.body
- a statement block.parentIsInterfaceDeclaration
- a boolean set true iff
parent is an InterfaceDeclarationpublic ProgramElementName getProgramElementName()
NamedProgramElement
getProgramElementName
in interface NamedProgramElement
public SourceElement getFirstElement()
JavaSourceElement
getFirstElement
in interface SourceElement
getFirstElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getStartPosition()
public SourceElement getLastElement()
JavaSourceElement
getLastElement
in interface SourceElement
getLastElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getEndPosition()
public int getChildCount()
NonTerminalProgramElement
getChildCount
in interface NonTerminalProgramElement
public ProgramElement getChildAt(int index)
NonTerminalProgramElement
getChildAt
in interface NonTerminalProgramElement
index
- an index into this node's "virtual" child arraypublic int getStatementCount()
StatementContainer
getStatementCount
in interface StatementContainer
public Statement getStatementAt(int index)
getStatementAt
in interface StatementContainer
public int getTypeReferenceCount()
TypeReferenceContainer
getTypeReferenceCount
in interface TypeReferenceContainer
public TypeReference getTypeReferenceAt(int index)
getTypeReferenceAt
in interface TypeReferenceContainer
public int getParameterDeclarationCount()
ParameterContainer
getParameterDeclarationCount
in interface ParameterContainer
public ParameterDeclaration getParameterDeclarationAt(int index)
ParameterContainer
getParameterDeclarationAt
in interface ParameterContainer
index
- an index for a parameter declaration.public TypeReference getTypeReference()
public Comment[] getVoidComments()
public final java.lang.String getName()
NamedModelElement
getName
in interface NamedModelElement
public ImmutableArray<ParameterDeclaration> getParameters()
public java.lang.String getFullName()
ProgramModelElement
getFullName
in interface ProgramModelElement
public Throws getThrown()
public StatementBlock getBody()
public boolean isFinal()
JavaDeclaration
isFinal
in interface Member
isFinal
in class JavaDeclaration
true
if this member is final,
false
otherwise.public boolean isPrivate()
JavaDeclaration
isPrivate
in interface Member
isPrivate
in interface MemberDeclaration
isPrivate
in class JavaDeclaration
true
if this member is private,
false
otherwise.public boolean isProtected()
JavaDeclaration
isProtected
in interface Member
isProtected
in interface MemberDeclaration
isProtected
in class JavaDeclaration
true
if this member is protected,
false
otherwise.public boolean isPublic()
isPublic
in interface Member
isPublic
in interface MemberDeclaration
isPublic
in class JavaDeclaration
true
if this member is public,
false
otherwise.public boolean isStatic()
JavaDeclaration
isStatic
in interface Member
isStatic
in interface MemberDeclaration
isStatic
in class JavaDeclaration
true
if this member is static,
false
otherwise.public boolean isModel()
JavaDeclaration
isModel
in class JavaDeclaration
public int getStateCount()
JavaDeclaration
getStateCount
in class JavaDeclaration
public boolean isVarArgMethod()
public boolean isStrictFp()
JavaDeclaration
isStrictFp
in interface Member
isStrictFp
in interface MemberDeclaration
isStrictFp
in class JavaDeclaration
true
if this member is strictfp,
false
otherwise.public boolean isAbstract()
isAbstract
in interface Method
isAbstract
in class JavaDeclaration
true
if this member is abstract,
false
otherwise.Constructor
public boolean isNative()
isNative
in interface Method
isNative
in class JavaDeclaration
true
if this method is native,
false
otherwise.Constructor
public boolean isSynchronized()
JavaDeclaration
isSynchronized
in interface Method
isSynchronized
in class JavaDeclaration
true
if this method is synchronized,
false
otherwise.Constructor
public void visit(Visitor v)
SourceElement
visit
in interface SourceElement
v
- the Visitorpublic void prettyPrint(PrettyPrinter p) throws java.io.IOException
JavaSourceElement
prettyPrint
in interface SourceElement
prettyPrint
in class JavaProgramElement
p
- a pretty printer.java.io.IOException
- occasionally thrown.