1 package uk.ac.ebi.intenz.domain.enzyme;
2
3 import java.util.List;
4
5
6
7
8
9
10
11
12
13 public class EnzymeSubclass implements Comparable<EnzymeSubclass> {
14 private EnzymeCommissionNumber ec;
15
16 private String className;
17
18 private String name;
19
20 private String description;
21
22 private List<EnzymeSubSubclass> subSubclasses;
23
24
25
26
27
28
29
30
31
32
33
34
35 public EnzymeSubclass(EnzymeCommissionNumber ec, String className, String name, String description,
36 List<EnzymeSubSubclass> subSubclasses) {
37 if (ec == null || className == null || name == null || description == null)
38 throw new NullPointerException("Only parameter 'subSubclasses' can be 'null'.");
39 this.ec = ec;
40 this.className = className;
41 this.name = name;
42 this.description = description;
43 this.subSubclasses = subSubclasses;
44 }
45
46
47
48
49
50
51
52 public int compareTo(EnzymeSubclass enzymeSubclass) {
53 return ec.compareTo(enzymeSubclass.getEc());
54 }
55
56
57
58
59
60
61
62 public boolean equals(Object o) {
63 if (this == o) return true;
64 if (!(o instanceof EnzymeSubclass)) return false;
65
66 final EnzymeSubclass enzymeSubclass = (EnzymeSubclass) o;
67
68 if (className != null ? !className.equals(enzymeSubclass.className) : enzymeSubclass.className != null) return false;
69 if (description != null ? !description.equals(enzymeSubclass.description) : enzymeSubclass.description != null) return false;
70 if (ec != null ? !ec.equals(enzymeSubclass.ec) : enzymeSubclass.ec != null) return false;
71 if (name != null ? !name.equals(enzymeSubclass.name) : enzymeSubclass.name != null) return false;
72 if (subSubclasses != null ? !subSubclasses.equals(enzymeSubclass.subSubclasses) : enzymeSubclass.subSubclasses != null) return false;
73
74 return true;
75 }
76
77
78
79
80
81
82 public int hashCode() {
83 int result;
84 result = (ec != null ? ec.hashCode() : 0);
85 result = 29 * result + (className != null ? className.hashCode() : 0);
86 result = 29 * result + (name != null ? name.hashCode() : 0);
87 result = 29 * result + (description != null ? description.hashCode() : 0);
88 result = 29 * result + (subSubclasses != null ? subSubclasses.hashCode() : 0);
89 return result;
90 }
91
92
93
94
95 public EnzymeCommissionNumber getEc() {
96 return ec;
97 }
98
99 public String getClassName() {
100 return className;
101 }
102
103 public String getName() {
104 return name;
105 }
106
107 public String getDescription() {
108 return description;
109 }
110
111 public List<EnzymeSubSubclass> getSubSubclasses() {
112 return subSubclasses;
113 }
114 }