Merge "Bug 2347: DOMConcurrentDataCommitCoordinator uses wrong phase name"
[controller.git] / third-party / net.sf.jung2 / src / main / java / edu / uci / ics / jung / algorithms / util / SelfLoopEdgePredicate.java
1 package edu.uci.ics.jung.algorithms.util;
2
3 import org.apache.commons.collections15.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  * A <code>Predicate</code> that returns <code>true</code> if the input edge's 
11  * endpoints in the input graph are identical.  (Thus, an edge which connects
12  * its sole incident vertex to itself).
13  *
14  * @param <V>
15  * @param <E>
16  */
17 public class SelfLoopEdgePredicate<V,E> implements Predicate<Context<Graph<V,E>,E>> {
18
19     public boolean evaluate(Context<Graph<V,E>,E> context) {
20         Pair<V> endpoints = context.graph.getEndpoints(context.element);
21         return endpoints.getFirst().equals(endpoints.getSecond());
22     }
23 }