package org.psjava.ds.graph;

import org.psjava.ds.graph.DirectedWeightedEdge;

public class DirectedWeightedEdgeFactory {

	public static <W> DirectedWeightedEdge<W> create(final Object from, final Object to, final W weight) {
		return new DirectedWeightedEdge<W>() {

			@Override
			public Object from() {
				return from;
			}

			@Override
			public Object to() {
				return to;
			}

			@Override
			public W weight() {
				return weight;
			}

			@Override
			public String toString() {
				if (weight != null)
					return to + "(" + weight + ")";
				else
					return to + "";
			}
		};
	}

}
@@ -495,92 +495,51 @@
 %09%09%09%09
-if (weight != null)%0A%09%09%09%09%09return to + %22(%22 + weight + %22)%22;%0A%09%09%09%09else%0A%09%09%09%09%09return to + %22
+return from + %22-%3E%22 + to + %22(%22 + weight + %22)
 %22;%0A%09

improve debug string