| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | * Copyright (c) 2003, the JUNG Project and the Regents of the University | |
| 3 | * of California | |
| 4 | * All rights reserved. | |
| 5 | * | |
| 6 | * This software is open-source under the BSD license; see either | |
| 7 | * "license.txt" or | |
| 8 | * http://jung.sourceforge.net/license.txt for a description. | |
| 9 | * | |
| 10 | * Created on Mar 3, 2004 | |
| 11 | */ | |
| 12 | package edu.uci.ics.jung.graph.predicates; | |
| 13 | ||
| 14 | import edu.uci.ics.jung.graph.ArchetypeEdge; | |
| 15 | import edu.uci.ics.jung.graph.Edge; | |
| 16 | import edu.uci.ics.jung.utils.Pair; | |
| 17 | ||
| 18 | /** | |
| 19 | * A predicate that checks to see whether a specified | |
| 20 | * edge is a self-loop. | |
| 21 | * | |
| 22 | * @author Joshua O'Madadhain | |
| 23 | */ | |
| 24 | public class SelfLoopEdgePredicate extends EdgePredicate | |
| 25 | { | |
| 26 | private static SelfLoopEdgePredicate instance; | |
| 27 | private static final String message = "SelfLoopEdgePredicate"; | |
| 28 | ||
| 29 | protected SelfLoopEdgePredicate() | |
| 30 | { | |
| 31 | 2 | super(); |
| 32 | 2 | } |
| 33 | ||
| 34 | /** | |
| 35 | * Returns an instance of this class. | |
| 36 | */ | |
| 37 | public static SelfLoopEdgePredicate getInstance() | |
| 38 | { | |
| 39 | 8 | if (instance == null) |
| 40 | 2 | instance = new SelfLoopEdgePredicate(); |
| 41 | 8 | return instance; |
| 42 | } | |
| 43 | ||
| 44 | public String toString() | |
| 45 | { | |
| 46 | 0 | return message; |
| 47 | } | |
| 48 | ||
| 49 | /** | |
| 50 | * Returns <code>true</code> if <code>e</code> is an | |
| 51 | * <code>Edge</code> that connects a vertex to itself. | |
| 52 | */ | |
| 53 | public boolean evaluateEdge(ArchetypeEdge e) | |
| 54 | { | |
| 55 | 13 | Pair p = ((Edge)e).getEndpoints(); |
| 56 | 13 | return (p.getFirst().equals(p.getSecond())); |
| 57 | } | |
| 58 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |