openjava.ptree
Class MethodCall

java.lang.Object
  |
  +--openjava.ptree.ParseTreeObject
        |
        +--openjava.ptree.NonLeaf
              |
              +--openjava.ptree.MethodCall
All Implemented Interfaces:
java.lang.Cloneable, Expression, ParseTree, VariableInitializer

public class MethodCall
extends NonLeaf
implements Expression

The MethodCall class represents a method call expression.

See Also:
NonLeaf, Expression

Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
MethodCall(Expression expr, java.lang.String name, ExpressionList args)
          Allocates a new method call expression object.
MethodCall(OJClass clazz, java.lang.String name, ExpressionList args)
           
MethodCall(java.lang.String name, ExpressionList args)
          Allocates a new method call expression for 'this'.
MethodCall(TypeName type, java.lang.String name, ExpressionList args)
          Allocates a new method call expression object.
 
Method Summary
 void accept(ParseTreeVisitor v)
          Accepts a ParseTreeVisitor object as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern. This invoke an appropriate visit() method on the accepted visitor.
 ExpressionList getArguments()
          Gets the arguments for this method.
 java.lang.String getName()
          Gets the method name.
 Expression getReferenceExpr()
          Gets the expression accessed.
 TypeName getReferenceType()
           
 OJClass getType(Environment env)
           
 void setArguments(ExpressionList exprs)
          Sets the arguments for this method.
 void setName(java.lang.String name)
          Sets the method name.
 void setReferenceExpr(Expression expr)
          Sets the expression accessed.
 void setReferenceType(TypeName type)
           
 void writeCode()
          Writes the code this parse-tree presents for.
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, elementAt, equals, getComment, getContents, getLength, makeRecursiveCopy, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt
 
Methods inherited from class openjava.ptree.ParseTreeObject
clone, eq, eq, equal, flushPrintWriter, getDebugFlag, getNest, getObjectID, getParent, getPrintWriter, getTab, hashCode, lastObjectID, makeCopy, popNest, popPrintWriter, pushNest, pushPrintWriter, replace, setDebugFlag, setDebugLevel, setNest, setParent, setPrintStream, setTab, toFlattenString, toString, writeDebug, writeDebugL, writeDebugLln, writeDebugln, writeDebugLR, writeDebugR, writeDebugRln, writeTab
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface openjava.ptree.ParseTree
childrenAccept, eq, equals, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString
 

Constructor Detail

MethodCall

public MethodCall(Expression expr,
                  java.lang.String name,
                  ExpressionList args)
Allocates a new method call expression object.
Parameters:
expr - the expression which indicates an object or a class. This may be null for invocation on 'this'.
name - the method name.
args - the argumetns for this method.

MethodCall

public MethodCall(java.lang.String name,
                  ExpressionList args)
Allocates a new method call expression for 'this'. This is equivalent to:
     new MethodCall( (Expression) null, name, args )
 
Parameters:
name - the method name.
args - the argumetns for this method.

MethodCall

public MethodCall(TypeName type,
                  java.lang.String name,
                  ExpressionList args)
Allocates a new method call expression object.
Parameters:
name - the method name.
args - the argumetns for this method.

MethodCall

public MethodCall(OJClass clazz,
                  java.lang.String name,
                  ExpressionList args)
Method Detail

writeCode

public void writeCode()
Description copied from class: NonLeaf
Writes the code this parse-tree presents for.
Specified by:
writeCode in interface ParseTree
Overrides:
writeCode in class NonLeaf

getReferenceExpr

public Expression getReferenceExpr()
Gets the expression accessed.
Returns:
the expression accessed.

setReferenceExpr

public void setReferenceExpr(Expression expr)
Sets the expression accessed.
Parameters:
expr - the expression accessed.

getReferenceType

public TypeName getReferenceType()

setReferenceType

public void setReferenceType(TypeName type)

getName

public java.lang.String getName()
Gets the method name.
Returns:
the method name.

setName

public void setName(java.lang.String name)
Sets the method name.
Parameters:
name - the method name.

getArguments

public ExpressionList getArguments()
Gets the arguments for this method.
Returns:
the expression list as the arguments.

setArguments

public void setArguments(ExpressionList exprs)
Sets the arguments for this method.
Parameters:
exprs - the expression list as the arguments.

accept

public void accept(ParseTreeVisitor v)
            throws ParseTreeException
Description copied from interface: ParseTree
Accepts a ParseTreeVisitor object as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern.

This invoke an appropriate visit() method on the accepted visitor.

Specified by:
accept in interface ParseTree
Overrides:
accept in class ParseTreeObject
Following copied from interface: openjava.ptree.ParseTree
Parameters:
visitor - a visitor

getType

public OJClass getType(Environment env)
                throws java.lang.Exception
Specified by:
getType in interface Expression