1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.creadur.whisker.app.analysis; |
20 | |
|
21 | 0 | public class ResourceDescription implements Comparable<ResourceDescription> { |
22 | |
private final String directory; |
23 | |
private final String resource; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public ResourceDescription(String directoryName, String resourceName) { |
30 | 0 | super(); |
31 | 0 | this.directory = directoryName; |
32 | 0 | this.resource = resourceName; |
33 | 0 | } |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
public String getDirectory() { |
39 | 0 | return directory; |
40 | |
} |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
public String getResource() { |
46 | 0 | return resource; |
47 | |
} |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
@Override |
53 | |
public int hashCode() { |
54 | 0 | final int prime = 31; |
55 | 0 | int result = 1; |
56 | 0 | result = prime * result |
57 | |
+ ((directory == null) ? 0 : directory.hashCode()); |
58 | 0 | result = prime * result |
59 | |
+ ((resource == null) ? 0 : resource.hashCode()); |
60 | 0 | return result; |
61 | |
} |
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
@Override |
67 | |
public boolean equals(Object obj) { |
68 | 0 | if (this == obj) |
69 | 0 | return true; |
70 | 0 | if (obj == null) |
71 | 0 | return false; |
72 | 0 | if (getClass() != obj.getClass()) |
73 | 0 | return false; |
74 | 0 | ResourceDescription other = (ResourceDescription) obj; |
75 | 0 | if (directory == null) { |
76 | 0 | if (other.directory != null) |
77 | 0 | return false; |
78 | 0 | } else if (!directory.equals(other.directory)) |
79 | 0 | return false; |
80 | 0 | if (resource == null) { |
81 | 0 | if (other.resource != null) |
82 | 0 | return false; |
83 | 0 | } else if (!resource.equals(other.resource)) |
84 | 0 | return false; |
85 | 0 | return true; |
86 | |
} |
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
@Override |
92 | |
public String toString() { |
93 | 0 | return "ResourceMissingLicense [directoryName=" + directory |
94 | |
+ ", resourceName=" + resource + "]"; |
95 | |
} |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
public int compareTo(ResourceDescription other) { |
101 | |
final int result; |
102 | 0 | final int compareOnDirectoryName = this.getDirectory().compareTo(other.getDirectory()); |
103 | 0 | if (compareOnDirectoryName == 0) { |
104 | 0 | result = this.getResource().compareTo(other.getResource()); |
105 | |
} else { |
106 | 0 | result = compareOnDirectoryName; |
107 | |
} |
108 | 0 | return result; |
109 | |
} |
110 | |
|
111 | |
|
112 | |
} |