1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.util.dialogrunner; |
22 |
|
|
|
|
| 5.2% |
Uncovered Elements: 55 (58) |
Complexity: 21 |
Complexity Density: 0.49 |
|
23 |
|
public class Response |
24 |
|
{ |
25 |
|
int type = 0; |
26 |
|
|
27 |
|
int intresp; |
28 |
|
|
29 |
|
String stringresp; |
30 |
|
|
31 |
|
Object objresp; |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
33 |
11 |
public Response(int response)... |
34 |
|
{ |
35 |
11 |
type = 0; |
36 |
11 |
intresp = response; |
37 |
|
} |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
39 |
0 |
public Response(String response)... |
40 |
|
{ |
41 |
0 |
type = 1; |
42 |
0 |
stringresp = response; |
43 |
|
} |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
45 |
0 |
public Response(Object response)... |
46 |
|
{ |
47 |
0 |
if (response instanceof String) |
48 |
|
{ |
49 |
0 |
type = 1; |
50 |
0 |
stringresp = (String) response; |
51 |
0 |
return; |
52 |
|
} |
53 |
0 |
if (response instanceof Integer) |
54 |
|
{ |
55 |
0 |
type = 0; |
56 |
0 |
intresp = ((Integer) response).intValue(); |
57 |
0 |
return; |
58 |
|
} |
59 |
0 |
objresp = response; |
60 |
0 |
type = 2; |
61 |
|
} |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 7 |
Complexity Density: 0.58 |
|
63 |
0 |
@Override... |
64 |
|
public boolean equals(Object obj) |
65 |
|
{ |
66 |
0 |
if (obj == null || !(obj instanceof Response)) |
67 |
|
{ |
68 |
0 |
return false; |
69 |
|
} |
70 |
0 |
; |
71 |
0 |
if (((Response) obj).type == type) |
72 |
|
{ |
73 |
0 |
switch (type) |
74 |
|
{ |
75 |
0 |
case 0: |
76 |
0 |
return ((((Response) obj).intresp) == intresp); |
77 |
0 |
case 1: |
78 |
0 |
return (((Response) obj).stringresp.equals(stringresp)); |
79 |
0 |
case 2: |
80 |
0 |
return (((Response) obj).objresp).equals(objresp); |
81 |
|
} |
82 |
|
} |
83 |
0 |
return false; |
84 |
|
} |
85 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 4 |
Complexity Density: 0.5 |
|
86 |
0 |
@Override... |
87 |
|
public int hashCode() |
88 |
|
{ |
89 |
0 |
switch (type) |
90 |
|
{ |
91 |
0 |
case 0: |
92 |
0 |
return Integer.valueOf(intresp).hashCode(); |
93 |
0 |
case 1: |
94 |
0 |
return stringresp.hashCode(); |
95 |
0 |
case 2: |
96 |
0 |
return objresp.hashCode(); |
97 |
|
} |
98 |
0 |
return super.hashCode(); |
99 |
|
} |
100 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 4 |
Complexity Density: 0.5 |
|
101 |
0 |
@Override... |
102 |
|
public String toString() |
103 |
|
{ |
104 |
0 |
switch (type) |
105 |
|
{ |
106 |
0 |
case 0: |
107 |
0 |
return "DialogRunner int: " + intresp; |
108 |
0 |
case 1: |
109 |
0 |
return "DialogRunner str: '" + stringresp + "'"; |
110 |
0 |
case 2: |
111 |
0 |
return "DialogRunner obj: " + String.valueOf(objresp); |
112 |
|
} |
113 |
0 |
return "Unconfigured response."; |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
@return |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0 |
public boolean isNull()... |
121 |
|
{ |
122 |
0 |
return (type==2 && objresp==null) || (type==1 && (stringresp==null || stringresp.equals(""))); |
123 |
|
} |
124 |
|
} |