edu.gwu.algtest
Class GraphVertex

java.lang.Object
  |
  +--edu.gwu.algtest.GraphVertex
All Implemented Interfaces:
edu.gwu.algtest.PriorityQueueNode

public class GraphVertex
extends java.lang.Object
implements edu.gwu.algtest.PriorityQueueNode


Field Summary
 java.util.LinkedList edgeList
          For use in an adjacency-list representation: store GraphEdge's in the list.
 int vertexID
          The vertex number.
 
Constructor Summary
GraphVertex(int vertexID)
          Constructor - takes the ID as parameter.
 
Method Summary
 double getKey()
          getKey returns the locally-stored key that was inserted by the most recently call to setKey.
 int getOptionalIndex()
          Returns the locally-stored index.
 void setKey(double key)
          setKey implements the PriorityQueueNode interface.
 void setOptionalIndex(int index)
          setOptionalIndex is required in the PriorityQueueNode interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vertexID

public int vertexID
The vertex number.

edgeList

public java.util.LinkedList edgeList
For use in an adjacency-list representation: store GraphEdge's in the list. Note: no methods are provided (yet) for this purpose, which is why the variable is exposed.
Constructor Detail

GraphVertex

public GraphVertex(int vertexID)
Constructor - takes the ID as parameter.
Parameters:
vertexID - an int value
Method Detail

setKey

public void setKey(double key)
setKey implements the PriorityQueueNode interface. It simply stores the key locally in a double variable.
Specified by:
setKey in interface edu.gwu.algtest.PriorityQueueNode
Parameters:
key - a double value

getKey

public double getKey()
getKey returns the locally-stored key that was inserted by the most recently call to setKey. Required for the PriorityQueueNode interface.
Specified by:
getKey in interface edu.gwu.algtest.PriorityQueueNode
Returns:
a double value

setOptionalIndex

public void setOptionalIndex(int index)
setOptionalIndex is required in the PriorityQueueNode interface. The integer is simply stored locally. Binary heaps require this because node positions in the array-implementation of a heap need to be recorded.
Specified by:
setOptionalIndex in interface edu.gwu.algtest.PriorityQueueNode
Parameters:
index - an int value

getOptionalIndex

public int getOptionalIndex()
Returns the locally-stored index. Required for implementing PriorityQueueNode.
Specified by:
getOptionalIndex in interface edu.gwu.algtest.PriorityQueueNode
Returns:
an int value