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

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 8, 2004
11 */
12 package edu.uci.ics.jung.graph.predicates;
13  
14 import edu.uci.ics.jung.graph.ArchetypeEdge;
15  
16 /**
17  * A predicate that tests to see whether a specified edge is
18  * "simple" (neither parallel to any edge nor a self-loop).
19  * This predicate may be used as an edge constraint; a graph
20  * with this edge constraint will be a simple graph.
21  *
22  * @author Joshua O'Madadhain
23  */
24 public class SimpleEdgePredicate extends EdgePredicate
25 {
26     private static SimpleEdgePredicate instance;
27     private static final String message = "SimpleEdgePredicate";
28  
29     protected SimpleEdgePredicate()
30     {
3167        super();
3267    }
33     
34     /**
35      * Returns an instance of this class.
36      */
37     public static SimpleEdgePredicate getInstance()
38     {
3968        if (instance == null)
4067            instance = new SimpleEdgePredicate();
4168        return instance;
42     }
43  
44     public String toString()
45     {
460        return message;
47     }
48     
49     /**
50      * Returns <code>true</code> if <code>ae</code> is neither a
51      * self-loop nor parallel to an existing edge.
52      */
53     public boolean evaluateEdge(ArchetypeEdge ae)
54     {
556        EdgePredicate parallel = ParallelEdgePredicate.getInstance();
566        EdgePredicate self_loop = SelfLoopEdgePredicate.getInstance();
57         
586        return (!parallel.evaluateEdge(ae) && !self_loop.evaluateEdge(ae));
59     }
60  
61 }

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.