beowulf.model.graph
Interface GraphModel

All Known Implementing Classes:
AbstractGraphModel

public interface GraphModel

This interface provides the basic methods through which a JGraph can access data stored within any Graph object.

Version:
1.0, 6/15/2003
Author:
Andy Scukanec (ags at cs dot cornell dot edu)

Method Summary
 void addGraphListener(GraphListener l)
          This method adds a GraphListener as an interested listener of events to this Graph.
 int getEdgeCount()
          Returns the number of edges in the graph.
 Vector getEdges()
          Returns an enumeration of all edges in the graph.
 Vector getEdgesFrom(Object sourceValue)
          Returns an vector of all edges in the graph coming from the node with the indicated value.
 Vector getEdgesFromTo(Object sourceValue, Object destValue)
          Given the value of the source node and the destination node, this method will return a list of all edges going between the two nodes.
 Vector getEdgesTo(Object destinationValue)
          Returns an vector of all edges in the graph going to the node with the indicated value.
 int getNodeCount()
          Returns the number of nodes in the graph.
 Vector getNodes()
          Returns an enumeration of all nodes in the graph.
 boolean getUseDotEquals()
          Returns true if semantic equivalence is used, and false if reference equality is used.
 boolean isDirected()
          Returns whether or not the graph is directed.
 boolean isSimple()
          Returns whether or not the graph is simple (ie - there are no edges from some node to itself and there is at most one edge between any two different nodes).
 void removeGraphListener(GraphListener l)
          This method removes the GraphListener as an interestd listener of events to this Graph.
 String toString(boolean verbose)
          Returns a verbose description if passed in true.
 

Method Detail

addGraphListener

public void addGraphListener(GraphListener l)
This method adds a GraphListener as an interested listener of events to this Graph.

Parameters:
l - The graph listener to add.

removeGraphListener

public void removeGraphListener(GraphListener l)
This method removes the GraphListener as an interestd listener of events to this Graph.

Parameters:
l - The graph listener to remove.

getNodes

public Vector getNodes()
Returns an enumeration of all nodes in the graph.

Returns:
An enumeration of all nodes in the graph.

getEdges

public Vector getEdges()
Returns an enumeration of all edges in the graph.

Returns:
An enumeration of all edges in the graph.

getEdgesFrom

public Vector getEdgesFrom(Object sourceValue)
Returns an vector of all edges in the graph coming from the node with the indicated value.

Parameters:
sourceValue - The value of the source node.
Returns:
An vector of all edges from the source node.

getEdgesTo

public Vector getEdgesTo(Object destinationValue)
Returns an vector of all edges in the graph going to the node with the indicated value.

Parameters:
destinationValue - The value of the destination node.
Returns:
An vector of all edges to the destination node.

getEdgesFromTo

public Vector getEdgesFromTo(Object sourceValue,
                             Object destValue)
Given the value of the source node and the destination node, this method will return a list of all edges going between the two nodes. If there are no edges going between the two nodes, this method will return an empty Vector. It is highly recommended that you do not modify the Vector returned.

Parameters:
sourceValue - The value of the source node.
destValue - The value of the destination node.
Returns:
A list of all edges going between the two nodes.

getNodeCount

public int getNodeCount()
Returns the number of nodes in the graph.

Returns:
The number of nodes in the graph.

getEdgeCount

public int getEdgeCount()
Returns the number of edges in the graph.

Returns:
The number of edges in the graph.

isDirected

public boolean isDirected()
Returns whether or not the graph is directed.

Returns:
Whether or not the graph is directed.

isSimple

public boolean isSimple()
Returns whether or not the graph is simple (ie - there are no edges from some node to itself and there is at most one edge between any two different nodes).

Returns:
Whether or not the graph is simple.

getUseDotEquals

public boolean getUseDotEquals()
Returns true if semantic equivalence is used, and false if reference equality is used. The distinction is important when a case arises where two objects o1 and o2 should be distinctly objects in the graph, but o1.equals(o2) would be true (causing a number of problems for generic Java data structures).

Returns:
True if and only if .equals() is to be used for equality tests.

toString

public String toString(boolean verbose)
Returns a verbose description if passed in true. Returns a shorter description otherwise.

Parameters:
verbose - Whether or not to return a verbose description.
Returns:
A description like toString(), but possibly more verbose.