/*
 * JBoss, Home of Professional Open Source
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.util.graph;

/**
 * A directed, weighted edge in a graph
 * 
 * @author Scott.Stark@jboss.org
 * @version $Revision$
 */
public class Edge<T>
{
   private Vertex<T> from;
   private Vertex<T> to;
   private int cost;
   private boolean mark;

   // Create an edge with 0 cost
   public Edge(Vertex<T> one, Vertex<T> two)
   {
      from = one;
      to = two;
      cost = 0;
      mark = false;
   }

   // Create an edge and define the cost
   public Edge(Vertex<T> one, Vertex<T> two, int c)
   {
      from = one;
      to = two;
      cost = c;
      mark = false;
   }

   public Vertex<T> getTo()
   {
      return to;
   }

   public Vertex<T> getFrom()
   {
      return from;
   }

   public int getCost()
   {
      return cost;
   }

   // Mark an edge
   public void mark()
   {
      mark = true;
   }

   // Clear the mark
   public void clearMark()
   {
      mark = false;
   }

   // Test the mark
   public boolean isMarked()
   {
      return mark;
   }

   public String toString()
   {
      StringBuffer tmp = new StringBuffer("Edge[from: ");
      tmp.append(from.getName());
      tmp.append(",to: ");
      tmp.append(to.getName());
      tmp.append(", cost: ");
      tmp.append(cost);
      tmp.append("]");
      return tmp.toString();
   }
}

@@ -1267,25 +1267,32 @@
  mark;%0A%0A   /
-/
+**%0A    *
  Create an e
@@ -1292,26 +1292,123 @@
 te a
-n edge with 0 cost
+ zero cost edge between from and to%0A    * @param from the starting vertex%0A    * @param to the ending vertex %0A    */
 %0A   
@@ -1421,35 +1421,36 @@
  Edge(Vertex%3CT%3E 
-one
+from
 , Vertex%3CT%3E two)
@@ -1446,17 +1446,16 @@
 tex%3CT%3E t
-w
 o)%0A   %7B%0A
@@ -1464,118 +1464,227 @@
     
-from = one;%0A      to = two;%0A      cost = 0;%0A      mark = false;%0A   %7D%0A%0A   // Create an edge and define the cost
+this(from, to, 0);%0A   %7D%0A%0A   /**%0A    * Create an edge between from and to with the given cost.%0A    * %0A    * @param from the starting vertex%0A    * @param to the ending vertex%0A    * @param cost the cost of the edge %0A    */
 %0A   
@@ -1705,19 +1705,20 @@
 rtex%3CT%3E 
-one
+from
 , Vertex
@@ -1726,17 +1726,16 @@
 T%3E t
-w
 o, int c
 )%0A  
@@ -1730,16 +1730,19 @@
 o, int c
+ost
 )%0A   %7B%0A 
@@ -1750,26 +1750,32 @@
     
+this.
 from = 
-one
+from
 ;%0A      
 to =
@@ -1774,15 +1774,19 @@
     
+this.
 to = t
-w
 o;%0A 
@@ -1794,16 +1794,21 @@
     
+this.
 cost = c
 ;%0A  
@@ -1803,16 +1803,19 @@
 cost = c
+ost
 ;%0A      
@@ -1841,120 +1841,340 @@
 %0A   
-public Vertex%3CT%3E getTo()%0A   %7B%0A      return to;%0A   %7D%0A%0A   public Vertex%3CT%3E getFrom()%0A   %7B%0A      return from;%0A   %7D%0A
+/**%0A    * Get the ending vertex%0A    * @return ending vertex%0A    */%0A   public Vertex%3CT%3E getTo()%0A   %7B%0A      return to;%0A   %7D%0A%0A   /**%0A    * Get the starting vertex%0A    * @return starting vertex%0A    */%0A   public Vertex%3CT%3E getFrom()%0A   %7B%0A      return from;%0A   %7D%0A%0A   /**%0A    * Get the cost of the edge%0A    * @return cost of the edge%0A    */
 %0A   
@@ -2232,22 +2232,59 @@
    /
-/ Mark an edge
+**%0A    * Set the mark flag of the edge%0A    *%0A    */
 %0A   
@@ -2336,17 +2336,24 @@
  %7D%0A%0A   /
-/
+**%0A    *
  Clear t
@@ -2351,28 +2351,51 @@
 * Clear the 
-mark
+edge mark flag%0A    *%0A    */
 %0A   public v
@@ -2449,82 +2449,233 @@
    /
-/ Test the mark%0A   public boolean isMarked()%0A   %7B%0A      return mark;%0A   %7D%0A
+**%0A    * Get the edge mark flag%0A    * @return edge mark flag%0A    */%0A   public boolean isMarked()%0A   %7B%0A      return mark;%0A   %7D%0A%0A   /**%0A    * String rep of edge%0A    * @return string rep with from/to vertex names and cost%0A    */
 %0A   

Update javadoc