de.jstacs.algorithms.graphs
Class Edge

java.lang.Object
  extended by de.jstacs.algorithms.graphs.Edge
All Implemented Interfaces:
Cloneable, Comparable<Edge>

public class Edge
extends Object
implements Comparable<Edge>, Cloneable

This class is a representation of a weighted edge.

Author:
Jens Keilwagen

Field Summary
protected  int source
          The source node.
protected  int target
          The target node.
protected  double weight
          the weight.
 
Constructor Summary
Edge(int s, int t, double w)
           
 
Method Summary
 Edge clone()
           
 int compareTo(Edge e)
           
 int getEndNode()
           
 int getStartNode()
           
 double getWeight()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

source

protected int source
The source node.


target

protected int target
The target node.


weight

protected double weight
the weight.

Constructor Detail

Edge

public Edge(int s,
            int t,
            double w)
     throws IllegalArgumentException
Parameters:
s - the start node
t - the target (=end) node
w - the weight
Throws:
IllegalArgumentException - if the names of the nodes are less than 0
Method Detail

getStartNode

public int getStartNode()
Returns:
the start node

getEndNode

public int getEndNode()
Returns:
the end node

getWeight

public double getWeight()
Returns:
the weight of the edge

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Edge e)
              throws ClassCastException
Specified by:
compareTo in interface Comparable<Edge>
Throws:
ClassCastException

clone

public Edge clone()
Overrides:
clone in class Object