|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.uci.eecs.doc.cascade.controlflow.Node edu.uci.eecs.doc.cascade.controlflow.IfThenElse
public class IfThenElse
Represents if-then and if-then-else constructs in control flow graphs and trees.
Field Summary | |
---|---|
protected Goto |
gotoNode
|
Fields inherited from class edu.uci.eecs.doc.cascade.controlflow.Node |
---|
block, nextNode, parent, scope, tree |
Constructor Summary | |
---|---|
IfThenElse(Tree tree,
int scope,
Node parent,
IfThenElseBlock ifThenElseBlock)
Creates a new if-then-else object. |
Method Summary | |
---|---|
protected Expression |
getCondition()
Returns the conditional expression of the if-then-else construct (e.g., i<10 ) |
Node |
getElse()
Returns a control flow node representing the "else" part of the if-then-else construct. |
Goto |
getGoto()
Returns a Goto node representing the goto instruction that jumps over the "else" part in if-then-else constructs. |
protected InstructionHandle |
getLastInstruction()
|
List<MethodInvocation> |
getMethodInvocations()
Returns the methods that the if's conditional expression invokes in the order in which they are invoked. |
Node |
getThen()
Returns a control flow node representing the "then" part of the if-then-else construct. |
boolean |
hasElse()
Returns true if this is an if-then-else branch; returns false if this is an if-then branch. |
void |
setElse(Node elseNode,
List<InstructionHandle> instructions)
Sets the "else" part of the if-then-else construct |
void |
setThen(Node thenNode)
Sets the "then" part of the if-then-else construct. |
String |
toString()
Converts the if-then-else construct to a string. |
Methods inherited from class edu.uci.eecs.doc.cascade.controlflow.Node |
---|
getBlock, getEnclosingLoop, getFirstInstruction, getInstructions, 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 |
Field Detail |
---|
protected Goto gotoNode
Constructor Detail |
---|
public IfThenElse(Tree tree, int scope, Node parent, IfThenElseBlock ifThenElseBlock)
tree
- the control flow tree to which this node belongsscope
- the lexical scope of the node (0 = top-level scope)parent
- the node's parent (null if the node has no parent)ifThenElseBlock
- a JODE object representing the if-then-else constructMethod Detail |
---|
public boolean hasElse()
public List<MethodInvocation> getMethodInvocations()
getMethodInvocations
in class Node
public Node getThen()
public void setThen(Node thenNode)
thenNode
- a node representing a "then" block, or null if the "then" block is emptypublic Node getElse()
hasElse()
is falsepublic void setElse(Node elseNode, List<InstructionHandle> instructions)
elseNode
- a node representing a "then" block, or null if the statement has no "else" branchinstructions
- the list of instructions in the node's method (the whole method, not just the if-then part)public Goto getGoto()
if (o == null) { if (p == null) { return true; } } else if (o.equals(p)) { return true; }In this example, there are no goto instructions anywhere, so it doesn't make sense to have a Goto node.
hasElse()
is false or if the else
node has not yet been setprotected Expression getCondition()
i<10
)
protected InstructionHandle getLastInstruction()
getLastInstruction
in class Node
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |