org.jtool.jxplatform.graph
Class GraphNode

java.lang.Object
  extended byorg.jtool.jxplatform.graph.GraphNode
All Implemented Interfaces:
GraphElement, GraphNodeSort
Direct Known Subclasses:
CFGNode, PDGNode

public class GraphNode
extends java.lang.Object
implements GraphElement, GraphNodeSort

A node object of CFGs and PDGs.

Author:
Katsuhsa Maruyama

Field Summary
protected  long id
          The identifier of this node.
protected static long nodeNum
          The total number of created nodes.
protected  int sort
          The sort of this node which is selected from among GraphNodeSort.
 
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 GraphNode()
          Creates a new, empty node.
  GraphNode(int sort)
          Creates a new node.
  GraphNode(int sort, long id)
          Creates a new node.
 
Method Summary
 void addIncomingEdge(GraphEdge edge)
          Adds an edge incoming to this node.
 void addIncomingEdges(GraphElementSet edges)
          Adds an edges incoming to this node.
 void addOutgoingEdge(GraphEdge edge)
          Adds an edge outgoing from this node.
 void addOutgoingEdges(GraphElementList edges)
          Adds an edges outgoing from this node.
 void clear()
          Clears the contents of caches related to this node.
static void clearId()
          Resets the total number of created nodes.
 void clearIncomingEdges()
          Clears the cache storing incoming edges.
 void clearOutgoingEdges()
          Clears the cache storing outgoing edges.
 boolean equals(GraphElement elem)
          Tests if this node equals to a given node.
 GraphElementSet getDstNodes()
          Returns destination nodes of this node.
 long getId()
          Return the identifier of this node.
 GraphElementSet getIncomingEdges()
          Returns edges incoming to this node.
 GraphElementSet getOutgoingEdges()
          Returns edges outgoing from this node.
 int getSort()
          Returns the sort of this node.
 GraphElementSet getSrcNodes()
          Returns source nodes of this node.
 void print()
          Displays information about this node.
 void print(java.lang.StringBuffer buf)
          Collects information about this node for printing.
 void removeIncomingEdge(GraphEdge edge)
          Removes an edge incoming to this node.
 void removeOutgoingEdge(GraphEdge edge)
          Removes an edge outgoing from this node.
 void setDstNodes()
          Calculates destination nodes of this node.
 void setIncomingEdges(GraphElementSet edges)
          Sets edges incoming to this node.
 void setOutgoingEdges(GraphElementSet edges)
          Sets edges outgoing from this node.
 void setSort(int sort)
          Sets the sort of this node.
 void setSrcNodes()
          Calculates source nodes of this node.
 void write(java.lang.StringBuffer buf)
          Collects information about this node for writing an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeNum

protected static long nodeNum
The total number of created nodes.


sort

protected int sort
The sort of this node which is selected from among GraphNodeSort.


id

protected long id
The identifier of this node.

Constructor Detail

GraphNode

protected GraphNode()
Creates a new, empty node.


GraphNode

public GraphNode(int sort)
Creates a new node.

Parameters:
sort - The sort of this node.

GraphNode

public GraphNode(int sort,
                 long id)
Creates a new node.

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

equals

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

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

setSort

public void setSort(int sort)
Sets the sort of this node.

Parameters:
sort - The sort of this node.

getSort

public int getSort()
Returns the sort of this node.

Returns:
The sort of this node.

getId

public long getId()
Return the identifier of this node.

Returns:
The identifier of this node.

clearId

public static void clearId()
Resets the total number of created nodes.


clear

public void clear()
Clears the contents of caches related to this node.


addIncomingEdge

public void addIncomingEdge(GraphEdge edge)
Adds an edge incoming to this node.

Parameters:
edge - An imcoming edge.ava

addOutgoingEdge

public void addOutgoingEdge(GraphEdge edge)
Adds an edge outgoing from this node.

Parameters:
edge - An outgoing edge.

addIncomingEdges

public void addIncomingEdges(GraphElementSet edges)
Adds an edges incoming to this node.

Parameters:
edges - The collection of incoming edges.

addOutgoingEdges

public void addOutgoingEdges(GraphElementList edges)
Adds an edges outgoing from this node.

Parameters:
edges - The collection of outgoing edges.

removeIncomingEdge

public void removeIncomingEdge(GraphEdge edge)
Removes an edge incoming to this node.

Parameters:
edge - An imcoming edge.

removeOutgoingEdge

public void removeOutgoingEdge(GraphEdge edge)
Removes an edge outgoing from this node.

Parameters:
edge - An outgoing edge.

clearIncomingEdges

public void clearIncomingEdges()
Clears the cache storing incoming edges.


clearOutgoingEdges

public void clearOutgoingEdges()
Clears the cache storing outgoing edges.


getIncomingEdges

public GraphElementSet getIncomingEdges()
Returns edges incoming to this node.

Returns:
The incoming edges.

getOutgoingEdges

public GraphElementSet getOutgoingEdges()
Returns edges outgoing from this node.

Returns:
The outgoing edges.

setIncomingEdges

public void setIncomingEdges(GraphElementSet edges)
Sets edges incoming to this node.

Parameters:
edges - The collection of incoming edges.

setOutgoingEdges

public void setOutgoingEdges(GraphElementSet edges)
Sets edges outgoing from this node.

Parameters:
edges - The collection of outgoing edges.

setSrcNodes

public void setSrcNodes()
Calculates source nodes of this node.


setDstNodes

public void setDstNodes()
Calculates destination nodes of this node.


getSrcNodes

public GraphElementSet getSrcNodes()
Returns source nodes of this node.

Returns:
The source nodes.

getDstNodes

public GraphElementSet getDstNodes()
Returns destination nodes of this node.

Returns:
The destination nodes.

print

public void print()
Displays information about this node.

Specified by:
print in interface GraphElement

print

public void print(java.lang.StringBuffer buf)
Collects information about this node for printing.

Parameters:
buf - The information about the node.

write

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

Parameters:
buf - The information about the node.