|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectantlr.BaseAST
antlr.CommonAST
antlr.CommonASTWithHiddenTokens
jparse.JavaAST
jparse.MethAST
An AST node that represents a method definition
Field Summary | |
private CompoundAST |
body
The body of the method |
private Type[] |
exceptions
The checked exceptions this method might throw |
private IdentifierAST[] |
exceptNames
The names of the exception types thrown by this method |
private IdentifierAST |
methodName
The name of the method |
private ModifierAST |
modifiers
The modifiers for this method |
private ParameterAST[] |
paramNames
The names of the parameters for this method |
private Type[] |
paramTypes
The parameter types for this method |
private JavaAST |
returnBrackets
Any brackets to add onto the return type |
private TypeAST |
returnName
The name of the return type for this method |
private Type |
returnType
The return type for this method |
Fields inherited from class jparse.JavaAST |
context, currSymTable, noTypes, symTable, topLevel, typeAST |
Fields inherited from class antlr.CommonASTWithHiddenTokens |
hiddenAfter, hiddenBefore |
Fields inherited from class antlr.CommonAST |
|
Fields inherited from class antlr.BaseAST |
down, right |
Constructor Summary | |
(package private) |
MethAST(ModifierAST mods,
TypeAST retType,
IdentifierAST name,
JavaAST parameters,
JavaAST brackets,
JavaAST exceptions,
CompoundAST block)
Create a new method AST |
Method Summary | |
Method |
bestMatch(Method meth)
Find the best match, given two matching methods |
int |
compareTo(MethAST meth)
Compares this method with another for order, where the order is based on the method names |
protected Type[] |
computeExceptions()
Returns an array of Type objects that represent the types
of the exceptions declared to be thrown by this method. |
boolean |
exactMatch(Method meth)
Determine whether two methods are exact matches: i.e., whether the names are the same, they take the same number of parameters, and all the parameter types are exactly equal. |
CompoundAST |
getBody()
Get the code for the body of this method |
Type |
getDeclaringClass()
Returns the Type object representing the class or
interface that declares the method represented by this object. |
Type[] |
getExceptionTypes()
Returns an array of Type objects that represent the types
of the exceptions declared to be thrown by this method. |
int |
getModifiers()
Returns the Java language modifiers for the method represented by this object, as an integer. |
String |
getName()
Returns the name of the method represented by this MethAST
object, as a String . |
ParameterAST[] |
getParameters()
Get the formal parameters of this method |
Type[] |
getParameterTypes()
Returns an array of Type objects that represent the formal
parameter types, in declaration order, of this method. |
Type |
getReturnType()
Returns a Type object that represents the formal return
type of this method. |
boolean |
isAccessible(Type caller)
Determines whether the method is accessible to a given caller |
boolean |
match(String methName,
Type[] params,
Type caller)
Determines whether this method matches the parameters given by a caller |
boolean |
match(Type[] params,
Type caller)
Determines whether this method matches the parameters given by a caller |
void |
parseComplete()
Compute any derived attributes that must be evaluated after the initial parse. |
String |
toString()
Return a string describing this MethAST |
Methods inherited from class jparse.JavaAST |
print, printHiddenAfter, printHiddenBefore |
Methods inherited from class antlr.CommonASTWithHiddenTokens |
getHiddenAfter, getHiddenBefore, initialize |
Methods inherited from class antlr.CommonAST |
getText, getType, initialize, initialize, setText, setType |
Methods inherited from class antlr.BaseAST |
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getFirstChild, getLine, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private final ModifierAST modifiers
private final TypeAST returnName
private final JavaAST returnBrackets
private Type returnType
private IdentifierAST methodName
private final ParameterAST[] paramNames
private Type[] paramTypes
private final IdentifierAST[] exceptNames
private Type[] exceptions
private final CompoundAST body
Constructor Detail |
MethAST(ModifierAST mods, TypeAST retType, IdentifierAST name, JavaAST parameters, JavaAST brackets, JavaAST exceptions, CompoundAST block)
mods
- the modifiers for this methodretType
- the return type of the methodname
- the name of the methodparameters
- the parameters for this methodbrackets
- any brackets that modify the return typeexceptions
- the exceptions thrown by this methodblock
- the body of the methodMethod Detail |
public void parseComplete()
JavaAST
parseComplete
in class JavaAST
public Type getDeclaringClass()
Type
object representing the class or
interface that declares the method represented by this object.
getDeclaringClass
in interface Method
Type
of the declaring classpublic String getName()
MethAST
object, as a String
.
getName
in interface Method
public int getModifiers()
Modifier
class should be used to decode the modifiers.
getModifiers
in interface Method
public Type getReturnType()
Type
object that represents the formal return
type of this method.
getReturnType
in interface Method
public ParameterAST[] getParameters()
public Type[] getParameterTypes()
Type
objects that represent the formal
parameter types, in declaration order, of this method. Returns an
array of length 0 if the underlying method takes no parameters.
getParameterTypes
in interface Method
public final Type[] getExceptionTypes()
Method
Type
objects that represent the types
of the exceptions declared to be thrown by this method. Returns an
array of length 0 if the method declares no exceptions in its
throws
clause.
getExceptionTypes
in interface Method
protected Type[] computeExceptions()
Type
objects that represent the types
of the exceptions declared to be thrown by this method. Returns an
array of length 0 if the method declares no exceptions in its
throws
clause.
public boolean isAccessible(Type caller)
Method
isAccessible
in interface Method
caller
- the type of the caller
true
if the caller is able to access this method,
false
otherwisepublic CompoundAST getBody()
public boolean match(String methName, Type[] params, Type caller)
match
in interface Method
methName
- the name of the method to matchparams
- the types of the parameters to the methodcaller
- the type of the caller
true
if this method matches, false
otherwisepublic boolean match(Type[] params, Type caller)
match
in interface Method
params
- the types of the parameters to the methodcaller
- the type of the caller
true
if this method matches, false
otherwisepublic Method bestMatch(Method meth)
bestMatch
in interface Method
meth
- the other method to compare
null
if neither matches bestpublic boolean exactMatch(Method meth)
Method
exactMatch
in interface Method
meth
- the method to compare against
true
if the methods match exactly;
false
if they differ in any particularpublic int compareTo(MethAST meth)
meth
- the MethAST
to compare with this one
MethAST
public String toString()
MethAST
toString
in interface antlr.collections.AST
MethAST
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |