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 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 | { | |
31 | 67 | super(); |
32 | 67 | } |
33 | ||
34 | /** | |
35 | * Returns an instance of this class. | |
36 | */ | |
37 | public static SimpleEdgePredicate getInstance() | |
38 | { | |
39 | 68 | if (instance == null) |
40 | 67 | instance = new SimpleEdgePredicate(); |
41 | 68 | return instance; |
42 | } | |
43 | ||
44 | public String toString() | |
45 | { | |
46 | 0 | 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 | { | |
55 | 6 | EdgePredicate parallel = ParallelEdgePredicate.getInstance(); |
56 | 6 | EdgePredicate self_loop = SelfLoopEdgePredicate.getInstance(); |
57 | ||
58 | 6 | return (!parallel.evaluateEdge(ae) && !self_loop.evaluateEdge(ae)); |
59 | } | |
60 | ||
61 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |