org.jtool.jxplatform.graph.cfg
Class CFGNode

java.lang.Object
  extended byorg.jtool.jxplatform.graph.GraphNode
      extended byorg.jtool.jxplatform.graph.cfg.CFGNode
All Implemented Interfaces:
GraphElement, GraphNodeSort
Direct Known Subclasses:
CFGExit, CFGMerge, CFGMethodEntry, CFGStatement

public class CFGNode
extends GraphNode

A node of CFGs.

Author:
Katsuhsa Maruyama

Field Summary
protected  java.lang.String defid
          The identifier of the DOM element correspoinding to this node.
protected  org.w3c.dom.Element element
          A DOM element correspoinding to this node.
 
Fields inherited from class org.jtool.jxplatform.graph.GraphNode
id, nodeNum, sort
 
Fields inherited from interface org.jtool.jxplatform.graph.GraphNodeSort
actualIn, actualOut, assignments, assignmentSt, branches, breakSt, callings, caseLabel, classEntry, classExit, constructorCall, constructorEntry, constructorExit, continueSt, defaultLabel, doSt, entries, exits, fieldDecl, formalIn, formalOut, forSt, ifSt, ignores, instanceCreation, interfaceEntry, interfaceExit, labelSt, localDecl, mergeSt, methodCall, methodEntry, methodExit, newSt, parameters, polymorphicCall, returnSt, switchSt, synchronizedSt, throwSt, trySt, whileSt
 
Constructor Summary
protected CFGNode()
          Creates a new, empty object.
protected CFGNode(int sort)
          Creates a new node when the corresponding DOM element does not exist.
protected CFGNode(int sort, org.w3c.dom.Element elem)
          Creates a new node.
 
Method Summary
 boolean equals(GraphElement elem)
          Tests if this node equals to a given node.
 java.lang.String getDefId()
          Returns the identifier of the DOM element corresponding to this node.
 org.w3c.dom.Element getElem()
          Returns the DOM element corresponding to this node.
 GraphElementSet getPredecessors()
          Returns predecessors of this node.
 int getPredecessorsNumber()
          Returns the number of predecessors of this node.
 GraphElementSet getSuccessors()
          Returns successors of this node.
 int getSuccessorsNumber()
          Returns the number of successors of this node.
 boolean hasDefVariable()
          Tests if this node might have a defined variable.
 boolean hasUseVariable()
          Tests if this node might have a used variable.
 boolean isAssignmentSt()
          Tests if this node corresponds to the assignment statement.
 boolean isBranch()
          Tests if this node is a branch node which has multiple outgoing edges.
 boolean isBranchSt()
          Tests if this node corresponds to the branch statement.
 boolean isBreakSt()
          Tests if this correspnds to the break statement.
 boolean isCallSt()
          Tests if corresponds to the call statement.
 boolean isContinueSt()
          Tests if this correspnds to the continue statement.
 boolean isDoSt()
          Tests if this correspnds to the do statement.
 boolean isEntrySt()
          Tests if this node corresponds to the entry statement.node
 boolean isExitSt()
          Tests if this node corresponds to the exit statement.
 boolean isFieldSt()
          Tests if this correspnds to the field declaration statement.
 boolean isFormalInSt()
          Tests if this node corresponds to the formal-in statement.
 boolean isFormalOutSt()
          Tests if this node corresponds to the formal-out statement.
 boolean isFormalSt()
          Tests if this node corresponds to the formal parameter statement.
 boolean isForSt()
          Tests if this correspnds to the for statement.
 boolean isGeneralAssignmentSt()
          Tests if this node corresponds to the general assignment statement.
 boolean isGeneralStatement()
          Tests if this node is classified into the general statement.
 boolean isIfSt()
          Tests if this correspnds to the if statement.
 boolean isIgnoredSt()
          Tests if this node corresponds to the ignored statement.
 boolean isJoin()
          Tests if this node is a join node which has multiple incoming edges.
 boolean isLabelSt()
          Tests if this node corresponds to the label statement.
 boolean isLocalSt()
          Tests if this correspnds to the local declaration statement.
 boolean isLoopSt()
          Tests if this node is classified into the loop (while, do, and for).
 boolean isMergeSt()
          Tests if this node corresponds to the merge statement.
 boolean isMethodEntry()
          Tests if this node indicates a method entry node.
 boolean isParameterSt()
          Tests if this node corresponds to the parameter statement.
 boolean isReturnSt()
          Tests if this correspnds to the return statement.
 boolean isStatement()
          Tests if this node indicates a statement node.
 boolean isSwitchLabel()
          Tests if this node corresponds to the switch label.
 boolean isSwitchSt()
          Tests if this correspnds to the switch statement.
 boolean isWhileSt()
          Tests if this correspnds to the while statement.
 void print()
          Displays information about this node.
 void print(java.lang.String mesg, java.lang.StringBuffer buf)
          Displays information about this node.
 void write(java.lang.StringBuffer buf)
          Collects information about this node for writing an XML document.
 
Methods inherited from class org.jtool.jxplatform.graph.GraphNode
addIncomingEdge, addIncomingEdges, addOutgoingEdge, addOutgoingEdges, clear, clearId, clearIncomingEdges, clearOutgoingEdges, getDstNodes, getId, getIncomingEdges, getOutgoingEdges, getSort, getSrcNodes, print, removeIncomingEdge, removeOutgoingEdge, setDstNodes, setIncomingEdges, setOutgoingEdges, setSort, setSrcNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

protected org.w3c.dom.Element element
A DOM element correspoinding to this node.


defid

protected java.lang.String defid
The identifier of the DOM element correspoinding to this node. If a DOM element has no id attribute, the default value will be used.

Constructor Detail

CFGNode

protected CFGNode()
Creates a new, empty object.


CFGNode

protected CFGNode(int sort,
                  org.w3c.dom.Element elem)
Creates a new node.

Parameters:
sort - The sort of this node.
elem - A DOM element corresponding to this node.

CFGNode

protected CFGNode(int sort)
Creates a new node when the corresponding DOM element does not exist.

Parameters:
sort - The sort of this node.
Method Detail

getElem

public org.w3c.dom.Element getElem()
Returns the DOM element corresponding to this node.

Returns:
The corresponding DOM element.

getDefId

public java.lang.String getDefId()
Returns the identifier of the DOM element corresponding to this node.

Returns:
The identifier of the DOM element.

equals

public boolean equals(GraphElement elem)
Tests if this node equals to a given node.

Specified by:
equals in interface GraphElement
Overrides:
equals in class GraphNode
Parameters:
elem - A node to be checked.
Returns:
true if the nodes are equal, otherwise false.

isStatement

public boolean isStatement()
Tests if this node indicates a statement node.

Returns:
always false.

isMethodEntry

public boolean isMethodEntry()
Tests if this node indicates a method entry node.

Returns:
always false.

getPredecessors

public GraphElementSet getPredecessors()
Returns predecessors of this node.

Returns:
The collection of predecessors.

getSuccessors

public GraphElementSet getSuccessors()
Returns successors of this node.

Returns:
The collection of successors.

getPredecessorsNumber

public int getPredecessorsNumber()
Returns the number of predecessors of this node.

Returns:
The number of predecessors.

getSuccessorsNumber

public int getSuccessorsNumber()
Returns the number of successors of this node.

Returns:
The number of successors.

isBranch

public boolean isBranch()
Tests if this node is a branch node which has multiple outgoing edges.

Returns:
true if this node is a branch node, otherwise false.

isJoin

public boolean isJoin()
Tests if this node is a join node which has multiple incoming edges.

Returns:
true if this node is a join node, otherwise false.

isEntrySt

public boolean isEntrySt()
Tests if this node corresponds to the entry statement.node

Returns:
true if this node corresponds to the entry statement, otherwise false.
See Also:
GraphNodeSort

isExitSt

public boolean isExitSt()
Tests if this node corresponds to the exit statement.

Returns:
true if this node corresponds to the exit statement, otherwise false.
See Also:
GraphNodeSort

isCallSt

public boolean isCallSt()
Tests if corresponds to the call statement.

Returns:
true if this node is classified into the call node, otherwise false.
See Also:
GraphNodeSort

isParameterSt

public boolean isParameterSt()
Tests if this node corresponds to the parameter statement.

Returns:
true if this node corresponds to the parameter statement, otherwise false.
See Also:
GraphNodeSort

isAssignmentSt

public boolean isAssignmentSt()
Tests if this node corresponds to the assignment statement.

Returns:
true if this node corresponds to the assignment statement, otherwise false.
See Also:
GraphNodeSort

isBranchSt

public boolean isBranchSt()
Tests if this node corresponds to the branch statement.

Returns:
true if this node corresponds to the branch statement, otherwise false.
See Also:
GraphNodeSort

isIgnoredSt

public boolean isIgnoredSt()
Tests if this node corresponds to the ignored statement.

Returns:
true if this node corresponds to the ignored statement, otherwise false.

isLabelSt

public boolean isLabelSt()
Tests if this node corresponds to the label statement.

Returns:
true if this node corresponds to the label statement, otherwise false.

isMergeSt

public boolean isMergeSt()
Tests if this node corresponds to the merge statement.

Returns:
true if this node corresponds to the merge statement, otherwise false.

isFormalSt

public boolean isFormalSt()
Tests if this node corresponds to the formal parameter statement.

Returns:
true if this node corresponds to the formal parameter statement, otherwise false.

isFormalInSt

public boolean isFormalInSt()
Tests if this node corresponds to the formal-in statement.

Returns:
true if this node corresponds to the formal-in statement, otherwise false.

isFormalOutSt

public boolean isFormalOutSt()
Tests if this node corresponds to the formal-out statement.

Returns:
true if this node corresponds to the formal-out statement, otherwise false.

isLoopSt

public boolean isLoopSt()
Tests if this node is classified into the loop (while, do, and for).

Returns:
true if this node is classified into the loop, otherwise false.

isGeneralStatement

public boolean isGeneralStatement()
Tests if this node is classified into the general statement.

Returns:
true if this node is classified into the general statement, otherwise false.

hasDefVariable

public boolean hasDefVariable()
Tests if this node might have a defined variable.

Returns:
true if this node might have a defined variable, otherwise false.

hasUseVariable

public boolean hasUseVariable()
Tests if this node might have a used variable.

Returns:
true if this node might have a used variable, otherwise false.

isSwitchLabel

public boolean isSwitchLabel()
Tests if this node corresponds to the switch label.

Returns:
true if this node corresponds to the switch label, otherwise false.

isGeneralAssignmentSt

public boolean isGeneralAssignmentSt()
Tests if this node corresponds to the general assignment statement.

Returns:
true if this node corresponds to the general assignment statement, otherwise false.

isFieldSt

public boolean isFieldSt()
Tests if this correspnds to the field declaration statement.

Returns:
true if this correspnds to the field declaration statement, otherwise false.

isLocalSt

public boolean isLocalSt()
Tests if this correspnds to the local declaration statement.

Returns:
true if this correspnds to the local declaration statement, otherwise false.

isReturnSt

public boolean isReturnSt()
Tests if this correspnds to the return statement.

Returns:
true if this correspnds to the return statement, otherwise false.

isBreakSt

public boolean isBreakSt()
Tests if this correspnds to the break statement.

Returns:
true if this correspnds to the break statement, otherwise false.

isContinueSt

public boolean isContinueSt()
Tests if this correspnds to the continue statement.

Returns:
true this correspnds to the continue statement, otherwise false.

isWhileSt

public boolean isWhileSt()
Tests if this correspnds to the while statement.

Returns:
true if this correspnds to the while statement, otherwise false.

isDoSt

public boolean isDoSt()
Tests if this correspnds to the do statement.

Returns:
true this correspnds to the do statement, otherwise false.

isForSt

public boolean isForSt()
Tests if this correspnds to the for statement.

Returns:
true this correspnds to the for statement, otherwise false.

isSwitchSt

public boolean isSwitchSt()
Tests if this correspnds to the switch statement.

Returns:
true if this correspnds to the switch statement, otherwise false.

isIfSt

public boolean isIfSt()
Tests if this correspnds to the if statement.

Returns:
true this correspnds to the if statement, otherwise false.

print

public void print()
Displays information about this node.

Specified by:
print in interface GraphElement
Overrides:
print in class GraphNode

print

public void print(java.lang.String mesg,
                  java.lang.StringBuffer buf)
Displays information about this node.

Parameters:
mesg - The description about this node.
buf - The information about the node.

write

public void write(java.lang.StringBuffer buf)
Collects information about this node for writing an XML document.

Overrides:
write in class GraphNode
Parameters:
buf - The information about the node.