bsh
Class BSHMethodDeclaration

java.lang.Object
  extended bybsh.SimpleNode
      extended bybsh.BSHMethodDeclaration
All Implemented Interfaces:
Node, java.io.Serializable

class BSHMethodDeclaration
extends SimpleNode


Field Summary
(package private)  BSHBlock blockNode
           
protected  Node[] children
           
(package private)  int firstThrowsClause
           
(package private)  Token firstToken
           
protected  int id
           
static SimpleNode JAVACODE
           
(package private)  Token lastToken
           
 Modifiers modifiers
           
 java.lang.String name
           
(package private)  int numThrows
           
(package private)  BSHFormalParameters paramsNode
           
protected  Node parent
           
(package private)  java.lang.Class returnType
           
(package private)  BSHReturnType returnTypeNode
           
(package private)  java.lang.String sourceFile
          the source of the text from which this was parsed
 
Constructor Summary
(package private) BSHMethodDeclaration(int id)
           
 
Method Summary
 void dump(java.lang.String prefix)
           
 java.lang.Object eval(CallStack callstack, Interpreter interpreter)
          Evaluate the declaration of the method.
(package private)  java.lang.Class evalReturnType(CallStack callstack, Interpreter interpreter)
          Evaluate the return type node.
 SimpleNode getChild(int i)
           
 int getLineNumber()
          Get the line number of the starting token
(package private)  java.lang.String getReturnTypeDescriptor(CallStack callstack, Interpreter interpreter, java.lang.String defaultPackage)
           
(package private)  BSHReturnType getReturnTypeNode()
           
 java.lang.String getSourceFile()
          Get the name of the source file (or more generally source) of the text from which this node was parsed.
 java.lang.String getText()
          Get the text of the tokens comprising this node.
(package private)  void insureNodesParsed()
          Set the returnTypeNode, paramsNode, and blockNode based on child node structure.
 void jjtAddChild(Node n, int i)
          This method tells the node to add its argument to the node's list of children.
 void jjtClose()
          This method is called after all the child nodes have been added.
 Node jjtGetChild(int i)
          This method returns a child node.
 int jjtGetNumChildren()
          Return the number of children the node has.
 Node jjtGetParent()
           
 void jjtOpen()
          This method is called after the node has been made the current node.
 void jjtSetParent(Node n)
          This pair of methods are used to inform the node of its parent.
 void prune()
          Detach this node from its parent.
 void setSourceFile(java.lang.String sourceFile)
          Set the name of the source file (or more generally source) of the text from which this node was parsed.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name

returnTypeNode

BSHReturnType returnTypeNode

paramsNode

BSHFormalParameters paramsNode

blockNode

BSHBlock blockNode

firstThrowsClause

int firstThrowsClause

modifiers

public Modifiers modifiers

returnType

java.lang.Class returnType

numThrows

int numThrows

JAVACODE

public static SimpleNode JAVACODE

parent

protected Node parent

children

protected Node[] children

id

protected int id

firstToken

Token firstToken

lastToken

Token lastToken

sourceFile

java.lang.String sourceFile
the source of the text from which this was parsed

Constructor Detail

BSHMethodDeclaration

BSHMethodDeclaration(int id)
Method Detail

insureNodesParsed

void insureNodesParsed()
Set the returnTypeNode, paramsNode, and blockNode based on child node structure. No evaluation is done here.


evalReturnType

java.lang.Class evalReturnType(CallStack callstack,
                               Interpreter interpreter)
                         throws EvalError
Evaluate the return type node.

Returns:
the type or null indicating loosely typed return
Throws:
EvalError

getReturnTypeDescriptor

java.lang.String getReturnTypeDescriptor(CallStack callstack,
                                         Interpreter interpreter,
                                         java.lang.String defaultPackage)

getReturnTypeNode

BSHReturnType getReturnTypeNode()

eval

public java.lang.Object eval(CallStack callstack,
                             Interpreter interpreter)
                      throws EvalError
Evaluate the declaration of the method. That is, determine the structure of the method and install it into the caller's namespace.

Overrides:
eval in class SimpleNode
Throws:
EvalError

toString

public java.lang.String toString()
Overrides:
toString in class SimpleNode

jjtOpen

public void jjtOpen()
Description copied from interface: Node
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.

Specified by:
jjtOpen in interface Node

jjtClose

public void jjtClose()
Description copied from interface: Node
This method is called after all the child nodes have been added.

Specified by:
jjtClose in interface Node

jjtSetParent

public void jjtSetParent(Node n)
Description copied from interface: Node
This pair of methods are used to inform the node of its parent.

Specified by:
jjtSetParent in interface Node

jjtGetParent

public Node jjtGetParent()
Specified by:
jjtGetParent in interface Node

jjtAddChild

public void jjtAddChild(Node n,
                        int i)
Description copied from interface: Node
This method tells the node to add its argument to the node's list of children.

Specified by:
jjtAddChild in interface Node

jjtGetChild

public Node jjtGetChild(int i)
Description copied from interface: Node
This method returns a child node. The children are numbered from zero, left to right.

Specified by:
jjtGetChild in interface Node

getChild

public SimpleNode getChild(int i)

jjtGetNumChildren

public int jjtGetNumChildren()
Description copied from interface: Node
Return the number of children the node has.

Specified by:
jjtGetNumChildren in interface Node

toString

public java.lang.String toString(java.lang.String prefix)

dump

public void dump(java.lang.String prefix)

prune

public void prune()
Detach this node from its parent. This is primarily useful in node serialization. (see BSHMethodDeclaration)


setSourceFile

public void setSourceFile(java.lang.String sourceFile)
Set the name of the source file (or more generally source) of the text from which this node was parsed.


getSourceFile

public java.lang.String getSourceFile()
Get the name of the source file (or more generally source) of the text from which this node was parsed. This will recursively search up the chain of parent nodes until a source is found or return a string indicating that the source is unknown.


getLineNumber

public int getLineNumber()
Get the line number of the starting token


getText

public java.lang.String getText()
Get the text of the tokens comprising this node.