org.jscience.computing.graph.edges
Class DirectedWeightedEdge

java.lang.Object
  extended by org.jscience.computing.graph.edges.DefaultEdge
      extended by org.jscience.computing.graph.edges.DirectedEdge
          extended by org.jscience.computing.graph.edges.DirectedWeightedEdge
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Edge

public class DirectedWeightedEdge
extends DirectedEdge

An implementation of directed weighted edge.

Since:
Jul 14, 2003
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jscience.computing.graph.Edge
DEFAULT_EDGE_WEIGHT
 
Constructor Summary
DirectedWeightedEdge(java.lang.Object sourceVertex, java.lang.Object targetVertex)
           
DirectedWeightedEdge(java.lang.Object sourceVertex, java.lang.Object targetVertex, double weight)
          Constructor for DirectedWeightedEdge.
 
Method Summary
 double getWeight()
          Returns the weight of this edge.
 void setWeight(double weight)
          Sets the weight of this edge.
 
Methods inherited from class org.jscience.computing.graph.edges.DirectedEdge
toString
 
Methods inherited from class org.jscience.computing.graph.edges.DefaultEdge
clone, containsVertex, getSource, getTarget, oppositeVertex
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectedWeightedEdge

public DirectedWeightedEdge(java.lang.Object sourceVertex,
                            java.lang.Object targetVertex)
See Also:
DirectedEdge.DirectedEdge(Object,Object)

DirectedWeightedEdge

public DirectedWeightedEdge(java.lang.Object sourceVertex,
                            java.lang.Object targetVertex,
                            double weight)
Constructor for DirectedWeightedEdge.

Parameters:
sourceVertex - source vertex of the new edge.
targetVertex - target vertex of the new edge.
weight - the weight of the new edge.
Method Detail

setWeight

public void setWeight(double weight)
Description copied from interface: Edge
Sets the weight of this edge. If this edge is unweighted an UnsupportedOperationException is thrown.

Specified by:
setWeight in interface Edge
Overrides:
setWeight in class DefaultEdge
Parameters:
weight - new weight.
See Also:
Edge.setWeight(double)

getWeight

public double getWeight()
Description copied from interface: Edge
Returns the weight of this edge. If this edge is unweighted the value 1.0 is returned.

Specified by:
getWeight in interface Edge
Overrides:
getWeight in class DefaultEdge
Returns:
the weight of this element.
See Also:
Edge.getWeight()