1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
package net.smartlab.web.bean; |
25 |
|
|
26 |
|
import java.util.List; |
27 |
|
import java.util.Locale; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
@author |
33 |
|
|
|
|
| 50% |
Uncovered Elements: 13 (26) |
Complexity: 8 |
Complexity Density: 0,5 |
|
34 |
|
public class DoubleArrayConverter extends ArrayConverter { |
35 |
|
|
36 |
|
private static final double[] model = new double[0]; |
37 |
|
|
38 |
|
|
39 |
|
@see |
40 |
|
|
41 |
|
|
|
|
| 52,2% |
Uncovered Elements: 11 (23) |
Complexity: 7 |
Complexity Density: 0,47 |
|
42 |
1
|
public Object convert(Class type, Object value, Locale locale) throws ConversionException {... |
43 |
|
|
44 |
1
|
if (model.getClass() == value.getClass()) { |
45 |
0
|
return (value); |
46 |
|
} |
47 |
|
|
48 |
|
|
49 |
1
|
if (ArrayConverter.model.getClass() == value.getClass()) { |
50 |
1
|
try { |
51 |
1
|
String values[] = (String[])value; |
52 |
1
|
double results[] = new double[values.length]; |
53 |
4
|
for (int i = 0; i < values.length; i++) { |
54 |
3
|
results[i] = Double.parseDouble(values[i]); |
55 |
|
} |
56 |
1
|
return (results); |
57 |
|
} catch (Exception e) { |
58 |
|
throw new ConversionException(value.toString(), e); |
59 |
|
} |
60 |
|
} |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
0
|
try { |
65 |
0
|
List list = parseElements(value.toString()); |
66 |
0
|
double results[] = new double[list.size()]; |
67 |
0
|
for (int i = 0; i < results.length; i++) { |
68 |
0
|
results[i] = Double.parseDouble((String)list.get(i)); |
69 |
|
} |
70 |
0
|
return (results); |
71 |
|
} catch (Exception e) { |
72 |
|
throw new ConversionException(value.toString(), e); |
73 |
|
} |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
@param |
81 |
|
@return |
82 |
|
@throws |
83 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
84 |
0
|
public String toString(Object value, Locale locale) throws ConversionException {... |
85 |
|
|
86 |
0
|
return null; |
87 |
|
} |
88 |
|
|
89 |
|
} |