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 | 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.GeneralVertexAcceptFilter; | |
14 | ||
15 | /** | |
16 | * This simple filter accepts vertices if their UserData at the given key is | |
17 | * over a threshold value. Note that this depends on user data that | |
18 | * is attached to the vertex. | |
19 | * | |
20 | * @author Scott White | |
21 | */ | |
22 | 0 | public class NumericDecorationFilter extends GeneralVertexAcceptFilter { |
23 | private double mThreshold; | |
24 | private String mDecorationKey; | |
25 | ||
26 | public boolean acceptVertex(Vertex vertex) { | |
27 | 0 | Number n = (Number) vertex.getUserDatum(mDecorationKey); |
28 | ||
29 | 0 | if (n.doubleValue() > mThreshold) { |
30 | 0 | return true; |
31 | } | |
32 | 0 | return false; |
33 | } | |
34 | ||
35 | public String getName() { | |
36 | 0 | return "NumericDecoration"; |
37 | } | |
38 | ||
39 | public String getDecorationKey() { | |
40 | 0 | return mDecorationKey; |
41 | } | |
42 | ||
43 | public void setDecorationKey(String decorationKey) { | |
44 | 0 | this.mDecorationKey = decorationKey; |
45 | 0 | } |
46 | ||
47 | public double getThreshold() { | |
48 | 0 | return mThreshold; |
49 | } | |
50 | ||
51 | public void setThreshold(double threshold) { | |
52 | 0 | this.mThreshold = threshold; |
53 | 0 | } |
54 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |