Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 64 |  | Methods: | 7
| NCLOC: | 39 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
SourceType.java | 66.7% | 75% | 85.7% | 76% |

1 |  |
2 |  | package net.sourceforge.pmd;
3 |  |
4 |  | /**
5 |  | * Enumeration of the types of source code.
6 |  | *
7 |  | * @author Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
8 |  | */
9 |  | public final class SourceType implements Comparable {
10 |  | public static final SourceType JAVA_13 = new SourceType("java 1.3");
11 |  | public static final SourceType JAVA_14 = new SourceType("java 1.4");
12 |  | public static final SourceType JAVA_15 = new SourceType("java 1.5");
13 |  | public static final SourceType JAVA_16 = new SourceType("java 1.6");
14 |  | public static final SourceType JSP = new SourceType("jsp");
15 |  |
16 |  | private static SourceType[] sourceTypes = new SourceType[]{JAVA_13, JAVA_14, JAVA_15, JAVA_16, JSP};
17 |  |
18 |  | private String id;
19 |  |
20 |  | /**
21 |  | * Private constructor.
22 |  | */
23 | 1130 | private SourceType(String id) {
24 | 1130 | this.id = id;
25 |  | }
26 |  |
27 | 6217 | public String getId() {
28 | 6217 | return id;
29 |  | }
30 |  |
31 |  | /**
32 |  | * Get the SourceType for a certain Id. Case insensitive.
33 |  | *
34 |  | * @return null if not found
35 |  | */
36 | 40 | public static SourceType getSourceTypeForId(String id) {
37 | 163 | for (int i = 0; i < sourceTypes.length; i++) {
38 | 163 | if (sourceTypes[i].getId().equalsIgnoreCase(id)) {
39 | 40 | return sourceTypes[i];
40 |  | }
41 |  | }
42 | 0 | return null;
43 |  | }
44 |  |
45 | 3 | public boolean equals(Object other) {
46 | 3 | if (other instanceof SourceType) {
47 | 3 | return ((SourceType) other).getId().equals(getId());
48 |  | }
49 |  |
50 | 0 | return false;
51 |  | }
52 |  |
53 | 6006 | public int hashCode() {
54 | 6006 | return getId().hashCode();
55 |  | }
56 |  |
57 | 21 | public int compareTo(Object other) {
58 | 21 | return getId().compareTo(((SourceType) other).getId());
59 |  | }
60 |  |
61 | 0 | public String toString() {
62 | 0 | return "SourceType [" + getId() + "]";
63 |  | }
64 |  | }