# Coverage details for edu.uci.ics.jung.graph.predicates.ThresholdPredicate

Line | Hits | Source
--- | --- | ---
1 |  | `/*`
2 |  | `* Copyright (c) 2004, 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 Aug 9, 2004`
9 |  | `*/`
10 |  | `package edu.uci.ics.jung.graph.predicates;`
11 |  | ``
12 |  | `import org.apache.commons.collections.Predicate;`
13 |  | ``
14 |  | `/**`
15 |  | `* A predicate which passes Numbers whose value satisfies a threshold requirement.`
16 |  | `*`
17 |  | `* @author Joshua O'Madadhain`
18 |  | `*/`
19 |  | `public class ThresholdPredicate implements Predicate`
20 |  | `{`
21 |  | `protected double threshold;`
22 |  | `protected boolean greater_equal;`
23 |  | ``
24 |  | `/**`
25 |  | `* Creates a ThresholdPredicate with the specified threshold value.`
26 |  | `* If <code>greater_equal</code> is true, only objects whose double`
27 |  | `* values are greater than or equal to <code>threshold</code> will evaluate to`
28 |  | `* <code>true</code>; otherwise, only objects whose values are less`
29 |  | `* than or equal will evaluate to true.`
30 |  | `*`
31 |  | `* @param threshold the threshold value`
32 |  | `* @param greater_equal`
33 |  | `*/`
34 |  | `public ThresholdPredicate(double threshold, boolean greater_equal)`
35 | 0 | `{`
36 | 0 | `this.threshold = threshold;`
37 | 0 | `this.greater_equal = greater_equal;`
38 | 0 | `}`
39 |  | ``
40 |  | `/**`
41 |  | `* @see org.apache.commons.collections.Predicate#evaluate(java.lang.Object)`
42 |  | `*/`
43 |  | `public boolean evaluate(Object arg0)`
44 |  | `{`
45 | 0 | `double value = ((Number)arg0).doubleValue();`
46 | 0 | `if (greater_equal && value >= threshold)`
47 | 0 | `return true;`
48 | 0 | `if (!greater_equal && value <= threshold)`
49 | 0 | `return true;`
50 | 0 | `return false;`
51 |  | `}`
52 |  | `}`

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.