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

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 /*
11  * Created on Apr 23, 2003
12  */
13 package edu.uci.ics.jung.graph.filters.impl;
14  
15 import edu.uci.ics.jung.graph.Edge;
16 import edu.uci.ics.jung.graph.decorators.EdgeWeightLabeller;
17 import edu.uci.ics.jung.graph.filters.EfficientFilter;
18 import edu.uci.ics.jung.graph.filters.GeneralEdgeAcceptFilter;
19 import edu.uci.ics.jung.graph.filters.LevelFilter;
20  
21 /**
22  * This simple filter accepts Edges if their EdgeWeightLabeller turns out
23  * to be greater than the input value.
24  * @author danyelf
25  */
26 public class WeightedEdgeGraphFilter
27     extends GeneralEdgeAcceptFilter
28     implements LevelFilter, EfficientFilter {
29  
3030    public WeightedEdgeGraphFilter(int threshold, EdgeWeightLabeller el) {
3130        setValue(threshold);
3230        this.labels = el;
3330    }
34  
35     /** (non-Javadoc)
36      * @see edu.uci.ics.jung.graph.filters.Filter#getName()
37      */
38     public String getName() {
3946        return "WeightedGraph(" + threshold + ")";
40     }
41  
42     private int threshold;
43     private EdgeWeightLabeller labels;
44  
45     public void setValue(int threshold) {
4669        this.threshold = threshold;
4769    }
48  
49     public int getValue() {
5010        return threshold;
51     }
52  
53     public boolean acceptEdge(Edge e) {
54 // Edge edge = GraphUtils.getCorrespondingEdge( labels.getGraph(), e );
55368        Edge edge = (Edge)e.getEqualEdge(labels.getGraph());
56368        int val = labels.getWeight( edge );
57         // ((Integer) e.getUserDatum(WEIGHT_KEY)).intValue();
58368        if (val < threshold) {
59             // System.out.println("Rejected something!");
60         }
61368        return (val >= threshold);
62     }
63  
64 }

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.