edu.uci.eecs.doc.cascade.controlflow
Class Statement

java.lang.Object
  extended by edu.uci.eecs.doc.cascade.controlflow.Node
      extended by edu.uci.eecs.doc.cascade.controlflow.Statement
All Implemented Interfaces:
Iterable<Node>
Direct Known Subclasses:
ReturnStatement

public class Statement
extends Node

Represents simple statements (e.g., i = x + y) in control flow graphs and trees.

Author:
Trevor Harmon

Field Summary
 
Fields inherited from class edu.uci.eecs.doc.cascade.controlflow.Node
block, nextNode, parent, scope, tree
 
Constructor Summary
Statement(Tree tree, int scope, Node parent, InstructionContainer instructionContainer, List<InstructionHandle> instructions)
          Creates a new Statement object.
 
Method Summary
protected  Expression getExpression()
          Returns the statement's expression.
 List<MethodInvocation> getMethodInvocations()
          Returns the methods that this statement invokes in the order in which they are invoked.
 String toString()
          Converts the statement to a string.
 
Methods inherited from class edu.uci.eecs.doc.cascade.controlflow.Node
getBlock, getEnclosingLoop, getFirstInstruction, getInstructions, getLastInstruction, getMethodInvocations, getNext, getOutermostLoop, getParent, getScope, getSourceCodeLineNumber, getStartAddress, getTree, iterator, lastNode, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Statement

public Statement(Tree tree,
                 int scope,
                 Node parent,
                 InstructionContainer instructionContainer,
                 List<InstructionHandle> instructions)
Creates a new Statement object.

Parameters:
tree - the control flow tree to which this node belongs
scope - the lexical scope of the node (0 = top-level scope)
parent - the node's parent (null if the node has no parent)
instructionContainer - a JODE object representing the statement
instructions - the list of instructions in the statement's method (the whole method, not just the statement)
Method Detail

getMethodInvocations

public List<MethodInvocation> getMethodInvocations()
Returns the methods that this statement invokes in the order in which they are invoked. If the same method is invoked more than once, it will appear in the list more than once.

Overrides:
getMethodInvocations in class Node
Returns:
a list of Java method handles, or an empty list if this statement does not invoke any methods

toString

public String toString()
Converts the statement to a string.

Overrides:
toString in class Object
Returns:
a source-code-like string representing the statement

getExpression

protected Expression getExpression()
Returns the statement's expression.

Returns:
a JODE object representing a Java expression, or null if the statement has no expression (e.g., return void statements)