Coverage details for edu.uci.ics.jung.graph.filters.impl.DropSoloNodesFilter

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 package edu.uci.ics.jung.graph.filters.impl;
11  
12 import edu.uci.ics.jung.graph.Vertex;
13 import edu.uci.ics.jung.graph.filters.Filter;
14 import edu.uci.ics.jung.graph.filters.GeneralVertexAcceptFilter;
15  
16 /**
17  * Accepts only nodes that have at least one edge--that is, nodes that
18  * are connected to one other node. This removes isolates, usually in order
19  * to clean up visualizations. This is NOT an EfficientFilter.
20  * <p>Because there
21  * are no settable parameters, this is set as a factory method--to
22  * get a <tt>DropSoloNodesFilter<tt>, just invoke
23  * <pre>
24  * Filter f = DropSoloNodesFilter.getInstance();
25  * </pre>
26  * @author danyelf
27  */
28 public class DropSoloNodesFilter extends GeneralVertexAcceptFilter {
29  
30     public boolean acceptVertex(Vertex vert) {
3127        boolean b = (vert.getIncidentEdges().size() > 0);
32 // if (vert.getIncidentEdges().size() == 1) {
33 // if (vert.getNeighbors().contains( vert )) {
34 // System.out.println("loop!");
35 // }
36 // }
37 // if ( !b ) {
38 // System.out.println( "Drop " + vert.toString() );
39 // }
4027        return b;
41     }
42     
43     public String getName() {
443        return "DropSoloNodes";
45     }
46  
47     
481    static DropSoloNodesFilter dsn = null;
49  
50     public static Filter getInstance() {
514        if ( dsn == null )
521            dsn = new DropSoloNodesFilter();
534        return dsn;
54     }
55     
561    protected DropSoloNodesFilter() {
571    }
58  
59 }

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.