Line | Hits | Source |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2003, the JUNG Project and the Regents of the University of | |
3 | * California All rights reserved. | |
4 | * | |
5 | * This software is open-source under the BSD license; see either "license.txt" | |
6 | * or http://jung.sourceforge.net/license.txt for a description. | |
7 | * | |
8 | * Created on Mar 3, 2004 | |
9 | */ | |
10 | package edu.uci.ics.jung.graph.predicates; | |
11 | ||
12 | import edu.uci.ics.jung.graph.ArchetypeVertex; | |
13 | ||
14 | /** | |
15 | * A predicate which tests to see whether a specified | |
16 | * vertex has any neighbors. Not suitable for use | |
17 | * as a constraint. | |
18 | * | |
19 | * @author Joshua O'Madadhain | |
20 | */ | |
21 | public class IsolatedVertexPredicate extends VertexPredicate { | |
22 | ||
23 | private static IsolatedVertexPredicate instance; | |
24 | ||
25 | private static final String message = "IsolatedVertexPredicate"; | |
26 | ||
27 | /** | |
28 | * Returns an instance of this class. | |
29 | */ | |
30 | public static IsolatedVertexPredicate getInstance() { | |
31 | 3 | if (instance == null) instance = new IsolatedVertexPredicate(); |
32 | 3 | return instance; |
33 | } | |
34 | ||
35 | public String toString() { | |
36 | 0 | return message; |
37 | } | |
38 | ||
39 | /** | |
40 | * Returns <code>true</code> if the argument is a <code>Vertex</code> | |
41 | * whose degree is 0. | |
42 | * | |
43 | * @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object) | |
44 | */ | |
45 | public boolean evaluateVertex(ArchetypeVertex v) { | |
46 | 13 | return (v.degree() == 0); |
47 | } | |
48 | ||
49 | /** | |
50 | * This constructor is protected in order to keep equals working by | |
51 | * retaining only one instance. (Currently, since there can only be one | |
52 | * instance, equals trivially returns true. If this class is extended, be | |
53 | * careful to write equals correctly.) | |
54 | */ | |
55 | protected IsolatedVertexPredicate() { | |
56 | 2 | super(); |
57 | 2 | } |
58 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |