| Date | 2007/07/27 |
|---|---|
| Codebase | 5577 |
| Reviews | 10167 |
| DPMO | 1974 |
| Sigma | 4.382 |
| Name | Number | Min | Avg | Max | Total |
|---|---|---|---|---|---|
| Class complexity | 1 | 117.00 | 117.00 | 117.00 | 117.00 |
| Code length | 82 | 0.00 | 5.47 | 128.00 | 449.00 |
| File length | 1 | 523.00 | 523.00 | 523.00 | 523.00 |
| Operation complexity | 81 | 1.00 | 2.28 | 35.00 | 185.00 |
| Work order | 1 | 4.74 | 4.74 | 4.74 | 4.74 |
| # | Line | Column | Name | Severity | Description |
|---|---|---|---|---|---|
| 1 | 23 | 1 | ER-023 | 3 | Packages should begin with [] |
| 2 | 63 | 116 | ER-036 | 3 | Line is too long |
| 3 | 74 | 112 | ER-036 | 3 | Line is too long |
| 4 | 79 | 115 | ER-036 | 3 | Line is too long |
| 5 | 80 | 90 | ER-036 | 3 | Line is too long |
| 6 | 95 | 83 | ER-036 | 3 | Line is too long |
| 7 | 96 | 90 | ER-036 | 3 | Line is too long |
| 8 | 99 | 111 | ER-036 | 3 | Line is too long |
| 9 | 100 | 90 | ER-036 | 3 | Line is too long |
| 10 | 107 | 90 | ER-036 | 3 | Line is too long |
| 11 | 108 | 90 | ER-036 | 3 | Line is too long |
| 12 | 111 | 84 | ER-036 | 3 | Line is too long |
| 13 | 112 | 90 | ER-036 | 3 | Line is too long |
| 14 | 115 | 80 | ER-036 | 3 | Line is too long |
| 15 | 116 | 90 | ER-036 | 3 | Line is too long |
| 16 | 119 | 90 | ER-036 | 3 | Line is too long |
| 17 | 120 | 90 | ER-036 | 3 | Line is too long |
| 18 | 131 | 88 | ER-036 | 3 | Line is too long |
| 19 | 136 | 107 | ER-036 | 3 | Line is too long |
| 20 | 149 | 91 | ER-036 | 3 | Line is too long |
| 21 | 151 | 215 | ER-036 | 3 | Line is too long |
| 22 | 164 | 108 | ER-036 | 3 | Line is too long |
| 23 | 168 | 83 | ER-036 | 3 | Line is too long |
| 24 | 170 | 81 | ER-036 | 3 | Line is too long |
| 25 | 172 | 245 | ER-036 | 3 | Line is too long |
| 26 | 177 | 82 | ER-036 | 3 | Line is too long |
| 27 | 181 | 84 | ER-036 | 3 | Line is too long |
| 28 | 184 | 80 | ER-036 | 3 | Line is too long |
| 29 | 185 | 90 | ER-036 | 3 | Line is too long |
| 30 | 189 | 98 | ER-036 | 3 | Line is too long |
| 31 | 224 | 83 | ER-036 | 3 | Line is too long |
| 32 | 234 | 120 | ER-036 | 3 | Line is too long |
| 33 | 236 | 143 | ER-036 | 3 | Line is too long |
| 34 | 237 | 81 | ER-036 | 3 | Line is too long |
| 35 | 246 | 88 | ER-036 | 3 | Line is too long |
| 36 | 247 | 91 | ER-036 | 3 | Line is too long |
| 37 | 250 | 84 | ER-036 | 3 | Line is too long |
| 38 | 254 | 88 | ER-036 | 3 | Line is too long |
| 39 | 255 | 96 | ER-036 | 3 | Line is too long |
| 40 | 258 | 81 | ER-036 | 3 | Line is too long |
| 41 | 259 | 84 | ER-036 | 3 | Line is too long |
| 42 | 262 | 84 | ER-036 | 3 | Line is too long |
| 43 | 266 | 85 | ER-036 | 3 | Line is too long |
| 44 | 267 | 101 | ER-036 | 3 | Line is too long |
| 45 | 270 | 87 | ER-036 | 3 | Line is too long |
| 46 | 271 | 90 | ER-036 | 3 | Line is too long |
| 47 | 274 | 96 | ER-036 | 3 | Line is too long |
| 48 | 278 | 88 | ER-036 | 3 | Line is too long |
| 49 | 279 | 100 | ER-036 | 3 | Line is too long |
| 50 | 280 | 136 | ER-036 | 3 | Line is too long |
| 51 | 281 | 101 | ER-036 | 3 | Line is too long |
| 52 | 282 | 113 | ER-036 | 3 | Line is too long |
| 53 | 284 | 108 | ER-036 | 3 | Line is too long |
| 54 | 298 | 113 | ER-036 | 3 | Line is too long |
| 55 | 307 | 84 | ER-036 | 3 | Line is too long |
| 56 | 308 | 106 | ER-036 | 3 | Line is too long |
| 57 | 311 | 80 | ER-036 | 3 | Line is too long |
| 58 | 314 | 133 | ER-036 | 3 | Line is too long |
| 59 | 315 | 92 | ER-036 | 3 | Line is too long |
| 60 | 316 | 100 | ER-036 | 3 | Line is too long |
| 61 | 317 | 101 | ER-036 | 3 | Line is too long |
| 62 | 318 | 92 | ER-036 | 3 | Line is too long |
| 63 | 321 | 112 | ER-036 | 3 | Line is too long |
| 64 | 332 | 84 | ER-036 | 3 | Line is too long |
| 65 | 333 | 82 | ER-036 | 3 | Line is too long |
| 66 | 334 | 118 | ER-036 | 3 | Line is too long |
| 67 | 335 | 113 | ER-036 | 3 | Line is too long |
| 68 | 337 | 130 | ER-036 | 3 | Line is too long |
| 69 | 338 | 125 | ER-036 | 3 | Line is too long |
| 70 | 339 | 86 | ER-036 | 3 | Line is too long |
| 71 | 340 | 105 | ER-036 | 3 | Line is too long |
| 72 | 341 | 116 | ER-036 | 3 | Line is too long |
| 73 | 342 | 80 | ER-036 | 3 | Line is too long |
| 74 | 343 | 107 | ER-036 | 3 | Line is too long |
| 75 | 344 | 98 | ER-036 | 3 | Line is too long |
| 76 | 345 | 88 | ER-036 | 3 | Line is too long |
| 77 | 346 | 142 | ER-036 | 3 | Line is too long |
| 78 | 347 | 81 | ER-036 | 3 | Line is too long |
| 79 | 350 | 94 | ER-036 | 3 | Line is too long |
| 80 | 353 | 82 | ER-036 | 3 | Line is too long |
| 81 | 383 | 111 | ER-036 | 3 | Line is too long |
| 82 | 385 | 85 | ER-036 | 3 | Line is too long |
| 83 | 388 | 86 | ER-036 | 3 | Line is too long |
| 84 | 390 | 80 | ER-036 | 3 | Line is too long |
| 85 | 391 | 102 | ER-036 | 3 | Line is too long |
| 86 | 394 | 80 | ER-036 | 3 | Line is too long |
| 87 | 395 | 92 | ER-036 | 3 | Line is too long |
| 88 | 398 | 80 | ER-036 | 3 | Line is too long |
| 89 | 399 | 92 | ER-036 | 3 | Line is too long |
| 90 | 402 | 80 | ER-036 | 3 | Line is too long |
| 91 | 403 | 120 | ER-036 | 3 | Line is too long |
| 92 | 406 | 82 | ER-036 | 3 | Line is too long |
| 93 | 407 | 95 | ER-036 | 3 | Line is too long |
| 94 | 410 | 98 | ER-036 | 3 | Line is too long |
| 95 | 411 | 106 | ER-036 | 3 | Line is too long |
| 96 | 414 | 112 | ER-036 | 3 | Line is too long |
| 97 | 415 | 106 | ER-036 | 3 | Line is too long |
| 98 | 418 | 93 | ER-036 | 3 | Line is too long |
| 99 | 422 | 81 | ER-036 | 3 | Line is too long |
| 100 | 423 | 88 | ER-036 | 3 | Line is too long |
| 101 | 481 | 180 | ER-036 | 3 | Line is too long |
| 102 | 494 | 212 | ER-036 | 3 | Line is too long |
| 103 | 53 | 1 | ER-011 | 1 | Cyclomatic complexity (117) exceeds 100 |
| 104 | 53 | 1 | ER-049 | 2 | Unify logging strategy - define individual logger for class |
| 105 | 63 | 9 | ER-109 | 3 | It is good practice to call in any case super() in a constructor. (see also: UnnecessaryConstructorRule ) |
| 106 | 71 | 9 | ER-011 | 1 | Cyclomatic complexity (35) exceeds 12 |
| 107 | 71 | 9 | ER-041 | 2 | Method is too long |
| 108 | 71 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 109 | 79 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 110 | 83 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 111 | 87 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 112 | 91 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 113 | 95 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 114 | 99 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 115 | 99 | 97 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 116 | 103 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 117 | 107 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 118 | 111 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 119 | 115 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 120 | 119 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 121 | 123 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 122 | 127 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 123 | 131 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 124 | 135 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 125 | 139 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 126 | 143 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 127 | 147 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 128 | 149 | 64 | ER-030 | 3 | Avoid hardwired string literals |
| 129 | 151 | 79 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 130 | 151 | 86 | ER-029 | 3 | Avoid hardwired numeric literals |
| 131 | 151 | 172 | ER-030 | 3 | Avoid hardwired string literals |
| 132 | 151 | 212 | ER-030 | 3 | Avoid hardwired string literals |
| 133 | 155 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 134 | 159 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 135 | 163 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 136 | 164 | 49 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 137 | 166 | 64 | ER-030 | 3 | Avoid hardwired string literals |
| 138 | 168 | 64 | ER-030 | 3 | Avoid hardwired string literals |
| 139 | 170 | 64 | ER-030 | 3 | Avoid hardwired string literals |
| 140 | 172 | 85 | ER-030 | 3 | Avoid hardwired string literals |
| 141 | 172 | 166 | ER-029 | 3 | Avoid hardwired numeric literals |
| 142 | 172 | 202 | ER-030 | 3 | Avoid hardwired string literals |
| 143 | 172 | 242 | ER-030 | 3 | Avoid hardwired string literals |
| 144 | 176 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 145 | 176 | 48 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 146 | 180 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 147 | 181 | 56 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 148 | 184 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 149 | 185 | 56 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 150 | 188 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 151 | 192 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 152 | 202 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 153 | 206 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 154 | 212 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 155 | 216 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 156 | 220 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 157 | 224 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 158 | 230 | 9 | ER-011 | 1 | Cyclomatic complexity (15) exceeds 12 |
| 159 | 230 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 160 | 246 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 161 | 250 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 162 | 254 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 163 | 255 | 72 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 164 | 258 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 165 | 262 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 166 | 263 | 72 | ER-030 | 3 | Avoid hardwired string literals |
| 167 | 266 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 168 | 270 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 169 | 274 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 170 | 278 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 171 | 295 | 9 | ER-011 | 1 | Cyclomatic complexity (20) exceeds 12 |
| 172 | 295 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 173 | 303 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 174 | 307 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 175 | 325 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 176 | 329 | 41 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 177 | 366 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 178 | 370 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 179 | 374 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 180 | 374 | 65 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 181 | 380 | 9 | ER-011 | 1 | Cyclomatic complexity (13) exceeds 12 |
| 182 | 380 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 183 | 390 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 184 | 391 | 72 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 185 | 394 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 186 | 394 | 64 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 187 | 398 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 188 | 398 | 64 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 189 | 402 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 190 | 402 | 64 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 191 | 406 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 192 | 406 | 64 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 193 | 410 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 194 | 410 | 73 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 195 | 414 | 96 | ER-082 | 3 | Avoid using method parameter names that conflict with class member names |
| 196 | 414 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 197 | 418 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 198 | 422 | 57 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 199 | 426 | 29 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 200 | 426 | 36 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 201 | 437 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 202 | 441 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 203 | 445 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 204 | 449 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 205 | 453 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 206 | 457 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 207 | 461 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 208 | 465 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 209 | 469 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 210 | 473 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 211 | 477 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 212 | 479 | 32 | ER-030 | 3 | Avoid hardwired string literals |
| 213 | 481 | 47 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 214 | 481 | 54 | ER-029 | 3 | Avoid hardwired numeric literals |
| 215 | 481 | 137 | ER-030 | 3 | Avoid hardwired string literals |
| 216 | 481 | 177 | ER-030 | 3 | Avoid hardwired string literals |
| 217 | 485 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 218 | 486 | 17 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 219 | 488 | 32 | ER-030 | 3 | Avoid hardwired string literals |
| 220 | 490 | 32 | ER-030 | 3 | Avoid hardwired string literals |
| 221 | 492 | 32 | ER-030 | 3 | Avoid hardwired string literals |
| 222 | 494 | 53 | ER-030 | 3 | Avoid hardwired string literals |
| 223 | 494 | 134 | ER-029 | 3 | Avoid hardwired numeric literals |
| 224 | 494 | 169 | ER-030 | 3 | Avoid hardwired string literals |
| 225 | 494 | 209 | ER-030 | 3 | Avoid hardwired string literals |
| 226 | 498 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 227 | 502 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 228 | 506 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 229 | 506 | 16 | ER-048 | 1 | Use BigDecimal instead of Float or Double for monetary values |
| 230 | 510 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 231 | 511 | 24 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 232 | 514 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
| 233 | 515 | 24 | ER-079 | 2 | Avoid casting primitive data types to lower precision |
| 234 | 518 | 9 | ER-105 | 3 | Document all Interfaces and public methods. Use a Class header. Provide Javadoc |
1/*
2 * Hammurapi
3 * Automated Java code review system.
4 * Copyright (C) 2004 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.org
21 * e-Mail: support@hammurapi.biz
22 */
23package org.hammurapi;
24
25import java.text.MessageFormat;
26import java.util.ArrayList;
27import java.util.Collection;
28import java.util.Date;
29import java.util.Iterator;
30import java.util.List;
31import java.util.Map;
32import java.util.TreeMap;
33
34import org.hammurapi.results.AggregatedResults;
35import org.hammurapi.results.Annotation;
36import org.hammurapi.results.BasicResults;
37import org.hammurapi.results.CompositeResults;
38import org.hammurapi.results.InspectorSummary;
39import org.hammurapi.results.NamedResults;
40import org.hammurapi.results.quick.MetricSummary;
41import org.hammurapi.results.quick.PackageTotal;
42import org.hammurapi.results.quick.Result;
43import org.hammurapi.results.quick.Warning;
44import org.hammurapi.results.simple.SimpleAggregatedResults;
45
46import com.pavelvlasov.review.SimpleSourceMarker;
47import com.pavelvlasov.review.SourceMarker;
48
49/**
50 * @author Pavel Vlasov
51 * @version $Revision: 1.5 $
52 */
53public class QuickPackageResults implements CompositeResults {
54
55 private PackageTotal total;
56 private QuickResultsCollector collector;
57 private InspectorSet inspectorSet;
58
59 /**
60 * @param total
61 * @param collector
62 */
63 public QuickPackageResults(PackageTotal total, QuickResultsCollector collector, InspectorSet inspectorSet) {
64 this.total=total;
65 this.collector=collector;
66 this.inspectorSet=inspectorSet;
67 }
68
69 private List children;
70
71 public Collection getChildren() {
72 if (children==null) {
73 children=new ArrayList();
74 Iterator rit=collector.getEngine().getPackageResults(total.getPackageName()).iterator();
75 while (rit.hasNext()) {
76 final Result result=(Result) rit.next();
77 children.add(new NamedResults() {
78
79 public Waiver addViolation(Violation violation) throws HammurapiException {
80 throw new UnsupportedOperationException();
81 }
82
83 public Map getSeveritySummary() {
84 return null;
85 }
86
87 public Collection getWarnings() {
88 return null;
89 }
90
91 public boolean hasWarnings() {
92 return result.getHasWarnings();
93 }
94
95 public void addWarning(Violation warning) {
96 throw new UnsupportedOperationException();
97 }
98
99 public void addMetric(SourceMarker source, String name, double value) {
100 throw new UnsupportedOperationException();
101 }
102
103 public Map getMetrics() {
104 return null;
105 }
106
107 public void aggregate(AggregatedResults agregee) {
108 throw new UnsupportedOperationException();
109 }
110
111 public void setReviewsNumber(long reviews) {
112 throw new UnsupportedOperationException();
113 }
114
115 public void setCodeBase(long codeBase) {
116 throw new UnsupportedOperationException();
117 }
118
119 public void addAnnotation(Annotation annotation) {
120 throw new UnsupportedOperationException();
121 }
122
123 public Collection getAnnotations() {
124 return null;
125 }
126
127 public WaiverSet getWaiverSet() {
128 return null;
129 }
130
131 public void commit() throws HammurapiException {
132
133 }
134
135 public boolean isNew() {
136 return result.getState()==QuickResultsCollector.RESULT_NEW;
137 }
138
139 public BasicResults getBaseLine() {
140 return null;
141 }
142
143 public long getCodeBase() {
144 return result.getCodebase();
145 }
146
147 public String getDPMO() {
148 if (result.getReviews()==0) {
149 return "Not available, no reviews";
150 } else {
151 return String.valueOf((int) (1000000*result.getViolationLevel()/result.getReviews())) + (result.getHasWarnings() ? " (not accurate because of warnings)" : "");
152 }
153 }
154
155 public Number getMaxSeverity() {
156 return result.getMaxSeverity();
157 }
158
159 public long getReviewsNumber() {
160 return result.getReviews();
161 }
162
163 public String getSigma() {
164 double p=1.0-result.getViolationLevel()/result.getReviews();
165 if (result.getReviews()==0) {
166 return "No results";
167 } else if (p<=0) {
168 return "Full incompliance";
169 } else if (p>=1) {
170 return "Full compliance";
171 } else {
172 return MessageFormat.format("{0,number,#.###}", new Object[] {new Double(SimpleAggregatedResults.normsinv(p)+1.5)}) + (result.getHasWarnings() ? " (not accurate because of warnings)" : "");
173 }
174 }
175
176 public double getViolationLevel() {
177 return result.getViolationLevel();
178 }
179
180 public int getViolationsNumber() {
181 return (int) result.getViolations();
182 }
183
184 public int getWaivedViolationsNumber() {
185 return (int) result.getWaivedViolations();
186 }
187
188 public Date getDate() {
189 return new Date(result.getResultDate().getTime());
190 }
191
192 public String getName() {
193 return result.getName();
194 }
195
196 });
197 }
198 }
199 return children;
200 }
201
202 public void add(AggregatedResults child) {
203 throw new UnsupportedOperationException();
204 }
205
206 public int size() {
207 return total.getResultSize();
208 }
209
210 private Collection violations=new ArrayList();
211
212 public Collection getViolations() {
213 return violations;
214 }
215
216 public Collection getWaivedViolations() {
217 return violations;
218 }
219
220 public String getName() {
221 return total.getPackageName();
222 }
223
224 public Waiver addViolation(Violation violation) throws HammurapiException {
225 throw new UnsupportedOperationException();
226 }
227
228 private Map severitySummary;
229
230 public Map getSeveritySummary() {
231 if (severitySummary==null) {
232 severitySummary=new TreeMap();
233
234 Iterator it=collector.getEngine().getPackageInspectorSummary(total.getPackageName()).iterator();
235 while (it.hasNext()) {
236 final org.hammurapi.results.quick.InspectorSummary ps=(org.hammurapi.results.quick.InspectorSummary) it.next();
237 Integer severity = new Integer(ps.getSeverity());
238 Map imap=(Map) severitySummary.get(severity);
239 if (imap==null) {
240 imap=new TreeMap();
241 severitySummary.put(severity, imap);
242 }
243 imap.put(ps.getName(),
244 new InspectorSummary() {
245
246 public String getDescription() {
247 return ps.getDescription();
248 }
249
250 public List getLocations() {
251 return null;
252 }
253
254 public int getLocationsCount() {
255 return (int) ps.getViolations();
256 }
257
258 public String getName() {
259 return ps.getName();
260 }
261
262 public String getVersion() {
263 return "";
264 }
265
266 public Number getSeverity() {
267 return new Integer(ps.getSeverity());
268 }
269
270 public String getConfigInfo() {
271 return ps.getConfigInfo();
272 }
273
274 public int getBaseLineLocationsCount() {
275 return -1;
276 }
277
278 public int compareTo(Object o) {
279 if (o instanceof InspectorSummary) {
280 return ps.getName().compareTo(((InspectorSummary) o).getName());
281 } else if (o instanceof Comparable) {
282 return -((Comparable) o).compareTo(this);
283 } else {
284 return this.hashCode()-o.hashCode();
285 }
286 }
287 });
288 }
289 }
290 return severitySummary;
291 }
292
293 private Collection warnings;
294
295 public Collection getWarnings() {
296 if (warnings==null) {
297 warnings=new ArrayList();
298 Iterator it=collector.getEngine().getWarningPackageEQ(total.getPackageName()).iterator();
299 while (it.hasNext()) {
300 final Warning warning=(Warning) it.next();
301 warnings.add(new Violation() {
302
303 public String getMessage() {
304 return warning.getMessage();
305 }
306
307 public InspectorDescriptor getDescriptor() {
308 return inspectorSet.getDescriptor(warning.getInspector());
309 }
310
311 private SimpleSourceMarker sourceMarker;
312
313 {
314 if (warning.getSource()!=null && warning.getLine()!=null && warning.getCol()!=null) {
315 sourceMarker=new SimpleSourceMarker(
316 warning.getCol().intValue(),
317 warning.getLine().intValue(),
318 warning.getSource(),
319 null);
320
321 sourceMarker.setSignature(warning.getSourceSignature());
322 }
323 }
324
325 public SourceMarker getSource() {
326 return sourceMarker;
327 }
328
329 public int compareTo(Object o) {
330 if (o==this) {
331 return 0;
332 } else if (o instanceof Violation) {
333 Violation v=(Violation) o;
334 int vline = v.getSource()==null ? 0 : v.getSource().getLine();
335 int line = getSource()==null ? 0 : getSource().getLine();
336 if (vline==line) {
337 int vcolumn = v.getSource()==null ? 0 : v.getSource().getColumn();
338 int column = getSource()==null ? 0 : getSource().getColumn();
339 if (vcolumn==column) {
340 if (warning.getMessage()==null) {
341 return v.getMessage()==null ? 0 : 1;
342 } else {
343 if (v.getMessage()==null) {
344 return -1;
345 } else {
346 return warning.getMessage().compareTo(v.getMessage());
347 }
348 }
349 } else {
350 return column-vcolumn;
351 }
352 } else {
353 return line-vline;
354 }
355 } else {
356 return 1;
357 }
358 }
359
360 });
361 }
362 }
363 return warnings;
364 }
365
366 public boolean hasWarnings() {
367 return total.getHasWarnings();
368 }
369
370 public void addWarning(Violation warning) {
371 throw new UnsupportedOperationException();
372 }
373
374 public void addMetric(SourceMarker source, String name, double value) {
375 throw new UnsupportedOperationException();
376 }
377
378 private Map metrics;
379
380 public Map getMetrics() {
381 if (metrics==null) {
382 metrics=new TreeMap();
383 Iterator it=collector.getEngine().getPackageMetrics(total.getPackageName()).iterator();
384 while (it.hasNext()) {
385 final MetricSummary metric=(MetricSummary) it.next();
386 metrics.put(
387 metric.getName(),
388 new com.pavelvlasov.metrics.Metric() {
389
390 public int getNumber() {
391 return (int) metric.getMeasurements();
392 }
393
394 public double getMin() {
395 return metric.getMinValue();
396 }
397
398 public double getMax() {
399 return metric.getMaxValue();
400 }
401
402 public double getAvg() {
403 return metric.getMetricTotal()/metric.getMeasurements();
404 }
405
406 public double getTotal() {
407 return metric.getMetricTotal();
408 }
409
410 public void add(double value, long time) {
411 throw new UnsupportedOperationException();
412 }
413
414 public void add(com.pavelvlasov.metrics.Metric metric) {
415 throw new UnsupportedOperationException();
416 }
417
418 public Collection getMeasurements() {
419 return null;
420 }
421
422 public String getName() {
423 return metric.getName();
424 }
425
426 public double getDeviation() {
427 // TODO - Calcualte deviation
428 return 0;
429 }
430
431 });
432 }
433 }
434 return metrics;
435 }
436
437 public void aggregate(AggregatedResults agregee) {
438 throw new UnsupportedOperationException();
439 }
440
441 public void setReviewsNumber(long reviews) {
442 throw new UnsupportedOperationException();
443 }
444
445 public void setCodeBase(long codeBase) {
446 throw new UnsupportedOperationException();
447 }
448
449 public void addAnnotation(Annotation annotation) {
450 throw new UnsupportedOperationException();
451 }
452
453 public Collection getAnnotations() {
454 return violations;
455 }
456
457 public WaiverSet getWaiverSet() {
458 throw new UnsupportedOperationException();
459 }
460
461 public void commit() throws HammurapiException {
462
463 }
464
465 public boolean isNew() {
466 return total.getMinState()==QuickResultsCollector.RESULT_NEW;
467 }
468
469 public BasicResults getBaseLine() {
470 return null;
471 }
472
473 public long getCodeBase() {
474 return total.getCodebase();
475 }
476
477 public String getDPMO() {
478 if (total.getReviews()==0) {
479 return "Not available, no reviews";
480 } else {
481 return String.valueOf((int) (1000000*total.getViolationLevel()/total.getReviews())) + (total.getHasWarnings() ? " (not accurate because of warnings)" : "");
482 }
483 }
484
485 public String getSigma() {
486 double p=1.0-total.getViolationLevel()/total.getReviews();
487 if (total.getReviews()==0) {
488 return "No results";
489 } else if (p<=0) {
490 return "Full incompliance";
491 } else if (p>=1) {
492 return "Full compliance";
493 } else {
494 return MessageFormat.format("{0,number,#.###}", new Object[] {new Double(SimpleAggregatedResults.normsinv(p)+1.5)}) + (total.getHasWarnings() ? " (not accurate because of warnings)" : "");
495 }
496 }
497
498 public Number getMaxSeverity() {
499 return total.getMaxSeverity();
500 }
501
502 public long getReviewsNumber() {
503 return total.getReviews();
504 }
505
506 public double getViolationLevel() {
507 return total.getViolationLevel();
508 }
509
510 public int getViolationsNumber() {
511 return (int) total.getViolations();
512 }
513
514 public int getWaivedViolationsNumber() {
515 return (int) total.getWaivedViolations();
516 }
517
518 public Date getDate() {
519 return new Date(total.getResultDate().getTime());
520 }
521
522}
523
524