Coverage details for edu.uci.ics.jung.graph.predicates.SelfLoopEdgePredicate

LineHitsSource
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     {
312        super();
322    }
33     
34     /**
35      * Returns an instance of this class.
36      */
37     public static SelfLoopEdgePredicate getInstance()
38     {
398        if (instance == null)
402            instance = new SelfLoopEdgePredicate();
418        return instance;
42     }
43  
44     public String toString()
45     {
460        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     {
5513        Pair p = ((Edge)e).getEndpoints();
5613        return (p.getFirst().equals(p.getSecond()));
57     }
58 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.