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

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