Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 87 |  | Methods: | 7
| NCLOC: | 27 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
BooleanProperty.java | 100% | 100% | 100% | 100% |

1 |  | package net.sourceforge.pmd.properties;
2 |  |
3 |  |
4 |  | /**
5 |  | * Defines a property type that supports Boolean values.
6 |  | *
7 |  | * @author Brian Remedios
8 |  | * @version $Revision$
9 |  | */
10 |  | public class BooleanProperty extends AbstractScalarProperty {
11 |  |
12 |  | /**
13 |  | * Constructor for BooleanProperty.
14 |  | * @param theName String
15 |  | * @param theDescription String
16 |  | * @param defaultValue boolean
17 |  | * @param theUIOrder float
18 |  | */
19 | 121 | public BooleanProperty(String theName, String theDescription, boolean defaultValue, float theUIOrder) {
20 | 121 | super(theName, theDescription, Boolean.valueOf(defaultValue), theUIOrder);
21 |  | }
22 |  |
23 |  | /**
24 |  | * Constructor for BooleanProperty.
25 |  | * @param theName String
26 |  | * @param theDescription String
27 |  | * @param defaultValues boolean[]
28 |  | * @param theUIOrder float
29 |  | * @param theMaxValues int
30 |  | */
31 | 3 | public BooleanProperty(String theName, String theDescription, boolean[] defaultValues, float theUIOrder, int theMaxValues) {
32 | 3 | this(theName, theDescription, asBooleans(defaultValues), theUIOrder, theMaxValues);
33 |  |
34 |  | }
35 |  |
36 |  | /**
37 |  | * Constructor for BooleanProperty.
38 |  | * @param theName String
39 |  | * @param theDescription String
40 |  | * @param defaultValues Boolean[]
41 |  | * @param theUIOrder float
42 |  | * @param theMaxValues int
43 |  | */
44 | 3 | public BooleanProperty(String theName, String theDescription, Boolean[] defaultValues, float theUIOrder, int theMaxValues) {
45 | 3 | super(theName, theDescription, defaultValues, theUIOrder);
46 |  |
47 | 3 | maxValueCount(theMaxValues);
48 |  | }
49 |  |
50 |  | /**
51 |  | * Method asBooleans.
52 |  | * @param bools boolean[]
53 |  | * @return Boolean[]
54 |  | */
55 | 3 | private static final Boolean[] asBooleans(boolean[] bools) {
56 | 3 | Boolean[] booleans = new Boolean[bools.length];
57 | 4 | for (int i=0; i<bools.length; i++) booleans[i] = Boolean.valueOf(bools[i]);
58 | 3 | return booleans;
59 |  | }
60 |  |
61 |  | /**
62 |  | * Method type.
63 |  | * @return Class
64 |  | * @see net.sourceforge.pmd.PropertyDescriptor#type()
65 |  | */
66 | 3 | public Class type() {
67 | 3 | return Boolean.class;
68 |  | }
69 |  |
70 |  | /**
71 |  | * Method createFrom.
72 |  | * @param value String
73 |  | * @return Object
74 |  | */
75 | 31 | protected Object createFrom(String value) {
76 | 31 | return Boolean.valueOf(value);
77 |  | }
78 |  |
79 |  | /**
80 |  | * Method arrayFor.
81 |  | * @param size int
82 |  | * @return Object[]
83 |  | */
84 | 2 | protected Object[] arrayFor(int size) {
85 | 2 | return new Boolean[size];
86 |  | }
87 |  | }