nick.graph
Class GraphElement<E>

java.lang.Object
  extended by nick.graph.GraphElement<E>
Direct Known Subclasses:
Edge, Vertex

public abstract class GraphElement<E>
extends java.lang.Object

This abstract class is designed to be extended by classes that are elements of a graph. Vertices and edges are two obvious graph elements. Some basic accessor and mutator methods are provided. Note that in a generic graph element that the data is listed before the name in a constructor. Children may or may not follow this convention.

Version:
March 13, 2009
Author:
Nick Aschenbach

Constructor Summary
GraphElement(E the_data)
          Construct a new GraphElement object.
GraphElement(E the_data, java.lang.String the_name)
          Construct a new GraphElement object.
 
Method Summary
 E data()
           
 java.lang.String name()
           
 void setData(E the_data)
          Change the data associated with this GraphElement.
 void setName(java.lang.String the_name)
          Rename this GraphElement.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphElement

public GraphElement(E the_data)
Construct a new GraphElement object.

Parameters:
the_data - Set the data of this GraphElement.

GraphElement

public GraphElement(E the_data,
                    java.lang.String the_name)
Construct a new GraphElement object.

Parameters:
the_data - Set the data of this GraphElement.
the_name - Set the name of this GraphElement.
Method Detail

setName

public void setName(java.lang.String the_name)
Rename this GraphElement.

Parameters:
the_name - The name to use to replace the old name.

setData

public void setData(E the_data)
Change the data associated with this GraphElement.

Parameters:
the_data - Reset the data associated with this object.

name

public java.lang.String name()
Returns:
The name associated with this GraphElement.

data

public E data()
Returns:
The data associated with this GraphElement.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object