1 package edu.uci.ics.jung.algorithms.util;
2
3 import com.google.common.base.Predicate;
4
5 import edu.uci.ics.jung.graph.Graph;
6 import edu.uci.ics.jung.graph.util.Context;
7 import edu.uci.ics.jung.graph.util.Pair;
8
9
10
11
12
13
14
15
16
17 public class SelfLoopEdgePredicate<V,E> implements Predicate<Context<Graph<V,E>,E>> {
18
19 public boolean apply(Context<Graph<V,E>,E> context) {
20 Pair<V> endpoints = context.graph.getEndpoints(context.element);
21 return endpoints.getFirst().equals(endpoints.getSecond());
22 }
23 }