JBoss Common Classes 2.2.17.GA

org.jboss.util.graph
Class Edge<T>

java.lang.Object
  extended by org.jboss.util.graph.Edge<T>
Type Parameters:
T -

public class Edge<T>
extends Object

A directed, weighted edge in a graph

Version:
$Revision$
Author:
Scott.Stark@jboss.org

Constructor Summary
Edge(Vertex<T> from, Vertex<T> to)
          Create a zero cost edge between from and to
Edge(Vertex<T> from, Vertex<T> to, int cost)
          Create an edge between from and to with the given cost.
 
Method Summary
 void clearMark()
          Clear the edge mark flag
 int getCost()
          Get the cost of the edge
 Vertex<T> getFrom()
          Get the starting vertex
 Vertex<T> getTo()
          Get the ending vertex
 boolean isMarked()
          Get the edge mark flag
 void mark()
          Set the mark flag of the edge
 String toString()
          String rep of edge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Edge

public Edge(Vertex<T> from,
            Vertex<T> to)
Create a zero cost edge between from and to

Parameters:
from - the starting vertex
to - the ending vertex

Edge

public Edge(Vertex<T> from,
            Vertex<T> to,
            int cost)
Create an edge between from and to with the given cost.

Parameters:
from - the starting vertex
to - the ending vertex
cost - the cost of the edge
Method Detail

getTo

public Vertex<T> getTo()
Get the ending vertex

Returns:
ending vertex

getFrom

public Vertex<T> getFrom()
Get the starting vertex

Returns:
starting vertex

getCost

public int getCost()
Get the cost of the edge

Returns:
cost of the edge

mark

public void mark()
Set the mark flag of the edge


clearMark

public void clearMark()
Clear the edge mark flag


isMarked

public boolean isMarked()
Get the edge mark flag

Returns:
edge mark flag

toString

public String toString()
String rep of edge

Overrides:
toString in class Object
Returns:
string rep with from/to vertex names and cost

JBoss Common Classes 2.2.17.GA

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.