package org.psjava.ds.graph;

import org.psjava.ds.Collection;
import org.psjava.util.DataFilter;
import org.psjava.util.FilteredIterable;

public class EdgeFilteredSubGraph {

	public static <V, E> OldGraph<V, E> wrap(final OldGraph<V, E> original, final DataFilter<E> filter) {
		return new OldGraph<V, E>() {
			@Override
			public Collection<V> getVertices() {
				return original.getVertices();
			}

			@Override
			public Iterable<E> getEdges() {
				return FilteredIterable.create(original.getEdges(), filter);
			}

			@Override
			public String toString() {
				return GraphToString.toString(this);
			}
		};
	}

	private EdgeFilteredSubGraph() {
	}
}

@@ -178,16 +178,30 @@
 ph %7B%0D%0A%0D%0A
+%09@Deprecated%0D%0A
 %09public 
@@ -657,16 +657,476 @@
 %0D%0A%09%7D%0D%0A%0D%0A
+%09public static %3CV, E%3E Graph%3CV, E%3E wrap(final Graph%3CV, E%3E original, final DataFilter%3CE%3E filter) %7B%0D%0A%09%09return new Graph%3CV, E%3E() %7B%0D%0A%09%09%09@Override%0D%0A%09%09%09public Collection%3CV%3E getVertices() %7B%0D%0A%09%09%09%09return original.getVertices();%0D%0A%09%09%09%7D%0D%0A%0D%0A%09%09%09@Override%0D%0A%09%09%09public Iterable%3CE%3E getEdges(V v) %7B%0D%0A%09%09%09%09return FilteredIterable.create(original.getEdges(v), filter);%0D%0A%09%09%09%7D%0D%0A%0D%0A%09%09%09@Override%0D%0A%09%09%09public String toString() %7B%0D%0A%09%09%09%09return GraphToString.toString(this);%0D%0A%09%09%09%7D%0D%0A%09%09%7D;%0D%0A%09%7D%0D%0A%0D%0A
 %09private

add new graph's method for EdgeFilteredSubGraph