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

java.lang.Object
  extended by edu.uci.eecs.doc.cascade.controlflow.Node
      extended by edu.uci.eecs.doc.cascade.controlflow.Loop
          extended by edu.uci.eecs.doc.cascade.controlflow.DoWhileLoop
All Implemented Interfaces:
Iterable<Node>

public class DoWhileLoop
extends Loop

Represents do-while loops in control flow graphs and trees.

Author:
Trevor Harmon

Field Summary
 
Fields inherited from class edu.uci.eecs.doc.cascade.controlflow.Loop
body, instructions
 
Fields inherited from class edu.uci.eecs.doc.cascade.controlflow.Node
block, nextNode, parent, scope, tree
 
Constructor Summary
DoWhileLoop(Tree tree, int scope, Node parent, LoopBlock loopBlock, List<InstructionHandle> instructions)
          Creates a new DoWhileLoop object.
 
Method Summary
protected  InstructionHandle getFirstInstruction()
           
 void setBody(Node body)
          Sets the body of the loop.
 String toString()
          Converts the do-while loop to a string.
 
Methods inherited from class edu.uci.eecs.doc.cascade.controlflow.Loop
getBody, getCondition, getMethodInvocations, hasBody
 
Methods inherited from class edu.uci.eecs.doc.cascade.controlflow.Node
getBlock, getEnclosingLoop, 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

DoWhileLoop

public DoWhileLoop(Tree tree,
                   int scope,
                   Node parent,
                   LoopBlock loopBlock,
                   List<InstructionHandle> instructions)
Creates a new DoWhileLoop 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)
loopBlock - a JODE object representing the do-while loop
instructions - the list of instructions in the loop's method (the whole method, not just the loop)
Method Detail

getFirstInstruction

protected InstructionHandle getFirstInstruction()
Overrides:
getFirstInstruction in class Node

setBody

public void setBody(Node body)
Sets the body of the loop. This may be necessary if, for example, the loop body is determined to be empty and needs to be "fixed up" accordingly.

Overrides:
setBody in class Loop
Parameters:
body - a control flow node representing the loop's body

toString

public String toString()
Converts the do-while loop to a string.

Overrides:
toString in class Object
Returns:
a source-code-like string representing the do-while loop