|
1 |
| package net.sourceforge.pmd.properties; |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| public class DoubleProperty extends AbstractScalarProperty { |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
117
| public DoubleProperty(String theName, String theDescription, double theDefault, float theUIOrder) {
|
|
19 |
117
| super(theName, theDescription, new Double(theDefault), theUIOrder);
|
|
20 |
| } |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
2
| public DoubleProperty(String theName, String theDescription, double[] defaultValues, float theUIOrder, int theMaxValues) {
|
|
31 |
2
| this(theName, theDescription, asDoubles(defaultValues), theUIOrder, theMaxValues);
|
|
32 |
| } |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
2
| public DoubleProperty(String theName, String theDescription, Double[] defaultValues, float theUIOrder, int theMaxValues) {
|
|
43 |
2
| super(theName, theDescription, defaultValues, theUIOrder);
|
|
44 |
| |
|
45 |
2
| maxValueCount(theMaxValues);
|
|
46 |
| } |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
3
| public Class type() {
|
|
54 |
3
| return Double.class;
|
|
55 |
| } |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
2
| private static final Double[] asDoubles(double[] doubles) {
|
|
63 |
2
| Double[] Doubles = new Double[doubles.length];
|
|
64 |
8
| for (int i=0; i<doubles.length; i++) Doubles[i] = new Double(doubles[i]);
|
|
65 |
2
| return Doubles;
|
|
66 |
| } |
|
67 |
| |
|
68 |
| |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
264
| protected Object createFrom(String value) {
|
|
74 |
264
| return new Double(value);
|
|
75 |
| } |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
1
| protected Object[] arrayFor(int size) {
|
|
83 |
1
| return new Double[size];
|
|
84 |
| } |
|
85 |
| } |