Please send questions to
st10@humboldt.edu .
/* Cs132AdjListNode.java 1.0 */
/* */
/* author: Sharon Tuttle */
/* last modified: 5-2-03 */
/* */
/* a node in an adjacency list graph implementation */
public class Cs132AdjListNode
{
/*------------------------------------
fields
-------------------------------------*/
// item we want to be in a graph: a vertex!
private Cs132Vertex vertex;
// next node in the chain
private Cs132AdjListNode next;
/*--------------------------------------
constructors
---------------------------------------*/
/* create a new node containing the given vertex vert */
/* but not leading to any other node */
public Cs132AdjListNode (Cs132Vertex vert)
{
this.vertex = vert;
this.next = null;
}
/*-------------------------------------------------------
accessors
-------------------------------------------------------*/
public Cs132Vertex getVertex()
{
return this.vertex;
}
public Cs132AdjListNode getNext()
{
return this.next;
}
/*-------------------------------------------------------
modifiers
-------------------------------------------------------*/
public void setVertex(Cs132Vertex newVertex)
{
this.vertex = newVertex;
}
public void setNext(Cs132AdjListNode newNext)
{
this.next = newNext;
}
/*------------------------------------------
overridden methods
-------------------------------------------*/
public String toString()
{
/* hmm; I don't think I'll print next in chain... */
return "Cs132AdjListNode[" + this.vertex + "]";
}
} // end of class Cs132ChainNode