JML

org.multijava.util.jperf
Class Node

java.lang.Object
  extended byorg.multijava.util.jperf.Node

class Node
extends Object

Node is an object class representing nodes in GGPerf's intermediate graph.

Author:
Jiejun KONG

Field Summary
private  Hashtable adjacency
          Adjancency list of the node.
private  long gValue
          g-value of the node.
private  long label
          Label of the node.
private  boolean visited
          Flag indicating whether the node has been visited during the current cyclicity checking process.
 
Constructor Summary
Node(long l)
          Creates a new node labelled as the argument in the intermediate graph.
 
Method Summary
 void addAdjacency(Node node, long edge)
          Add an adjacent node with its edge to the adjacency list of this node.
 void assignGValue(long val, int max)
          Recursively assigns g_value for all nodes that could be reached from this node.
 long getGValue()
          Return the G value of the node.
 long getLabel()
          Return the label of the node.
 boolean getVisited()
          Return the current status of the node.
 boolean reaches(Node target)
          Checks wheter there is a path from this node to the target node.
 void setVisited(boolean b)
          During a cyclicity checking process, set the status to be the argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

private final long label
Label of the node.


gValue

private long gValue
g-value of the node.


adjacency

private Hashtable adjacency
Adjancency list of the node. All adjacent nodes with correspondent edges are stored in this list. For any undirected graph, if A<->B, then A appears in B's adjacency list while B is in A's adjacency list.


visited

private boolean visited
Flag indicating whether the node has been visited during the current cyclicity checking process. Since there are indefinite number of passes to check cyclicity of a graph. I can't define a flag for each pass, therefore this flag needs to be cleared before every checking pass to decide reachability.

Constructor Detail

Node

public Node(long l)
Creates a new node labelled as the argument in the intermediate graph.

Parameters:
l - The label.
Method Detail

getLabel

public long getLabel()
Return the label of the node.

Returns:
The label as a long value.

getGValue

public long getGValue()
Return the G value of the node.

Returns:
The G value as a long value.

addAdjacency

public void addAdjacency(Node node,
                         long edge)
Add an adjacent node with its edge to the adjacency list of this node.

Parameters:
node - The adjacent node.
edge - The edge between this node and the adjacent node.

getVisited

public boolean getVisited()
Return the current status of the node.

Returns:
the status as a boolean value. True means having been visited.

setVisited

public void setVisited(boolean b)
During a cyclicity checking process, set the status to be the argument.

Parameters:
b - the status. True mean having been visited.

reaches

public boolean reaches(Node target)
Checks wheter there is a path from this node to the target node. Uses Depth First Search and marks visited nodes on the path

Parameters:
target - the target node
Returns:
true iff the target node is reachable

assignGValue

public void assignGValue(long val,
                         int max)
Recursively assigns g_value for all nodes that could be reached from this node.

Parameters:
val - the value to assign to this node
max - the maximum value (= # of keywords)

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.