net.spy.util
Class SPVertex<N extends SPNode<N>>

java.lang.Object
  extended by net.spy.util.SPVertex<N>
All Implemented Interfaces:
java.lang.Comparable<SPVertex<N>>

public class SPVertex<N extends SPNode<N>>
extends java.lang.Object
implements java.lang.Comparable<SPVertex<N>>

A weighted connection to a SPNode.

See Also:
ShortestPathFinder

Field Summary
static int DEFAULT_COST
           
 
Constructor Summary
SPVertex(N destination)
          Get an instance of SPVertex linking the two nodes with the default cost.
SPVertex(N destination, int theCost)
          Get an instance of SPVertex.
 
Method Summary
 int compareTo(SPVertex<N> other)
          Compare this vertex to another vertex.
 int getCost()
          Get the cost of this vertex.
 N getTo()
          Get the destination node.
 java.lang.String toString()
          String me.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_COST

public static final int DEFAULT_COST
See Also:
Constant Field Values
Constructor Detail

SPVertex

public SPVertex(N destination,
                int theCost)
Get an instance of SPVertex.

Parameters:
destination - the destination node
theCost - the cost

SPVertex

public SPVertex(N destination)
Get an instance of SPVertex linking the two nodes with the default cost.

Parameters:
destination - the destination node
Method Detail

toString

public java.lang.String toString()
String me.

Overrides:
toString in class java.lang.Object

getTo

public N getTo()
Get the destination node.


getCost

public int getCost()
Get the cost of this vertex.


compareTo

public int compareTo(SPVertex<N> other)
Compare this vertex to another vertex. Weight will be considered first. If vertices are at the same weight, the destination nodes will be compared.

Specified by:
compareTo in interface java.lang.Comparable<SPVertex<N extends SPNode<N>>>


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.