fi.joensuu.cs.tra
Class Edge

java.lang.Object
  extended by fi.joensuu.cs.tra.Edge
All Implemented Interfaces:
Comparable

public class Edge
extends Object
implements Comparable

Edges are objects that connect Vertices to form a graph.

See Also:
Vertex, Graph, DiGraph

Method Summary
 int compareTo(Object o)
          Defined in Comparable.
 int getColor()
          Gets the color of this Edge.
 Vertex getEndPoint()
          Returns the end point of this Edge.
 Vertex getEndPoint(Vertex vertex)
          Returns the Vertex on the other end of the specified Edge.
 String getLabel()
          Gets the label of this Edge.
 Vertex getStartPoint()
          Returns the starting point of this Edge.
 float getWeight()
          Gets the weight of this Edge.
 boolean goesOut(Vertex vertex)
          Determines whether this Edge goes out from the specified Vertex.
 int setColor(int color)
          Sets the color of this Edge.
 String setLabel(String label)
          Sets the label of this Edge.
 float setWeight(float weight)
          Sets the weight of this Edge.
 String toString()
          Produces a String representation of this Edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getEndPoint

public Vertex getEndPoint(Vertex vertex)
Returns the Vertex on the other end of the specified Edge. leads to.

Parameters:
vertex - the Vertex to start tracing from
Returns:
the Vertex on the other end of this Edge or null if this Edge is not connected to the specified Vertex

getEndPoint

public Vertex getEndPoint()
Returns the end point of this Edge.

Returns:
the end point of this Edge

getStartPoint

public Vertex getStartPoint()
Returns the starting point of this Edge.

Returns:
the starting point of this Edge

goesOut

public boolean goesOut(Vertex vertex)
Determines whether this Edge goes out from the specified Vertex. Mainly useful with DiGraphs.

Parameters:
vertex - the Vertex that is to be tested for being the origin Vertex of this Edge.
Returns:
true if vertex is the starting point of this Edge

getColor

public int getColor()
Gets the color of this Edge.

Returns:
the color of this Edge

setColor

public int setColor(int color)
Sets the color of this Edge.

Parameters:
color - the new color for this Edge
Returns:
the old color of this Edge.

getWeight

public float getWeight()
Gets the weight of this Edge.

Returns:
the weight of this Edge

setWeight

public float setWeight(float weight)
Sets the weight of this Edge.

Parameters:
weight - the new weight for this Edge
Returns:
the old weight of this Edge.

getLabel

public String getLabel()
Gets the label of this Edge.

Returns:
the label of this Edge

setLabel

public String setLabel(String label)
Sets the label of this Edge.

Parameters:
label - the new label for this Edge
Returns:
the old label of this Edge.

compareTo

public int compareTo(Object o)
Defined in Comparable.

Specified by:
compareTo in interface Comparable

toString

public String toString()
Produces a String representation of this Edge.

Overrides:
toString in class Object
Returns:
this Edge as a String