-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProductType.java
More file actions
46 lines (33 loc) · 918 Bytes
/
ProductType.java
File metadata and controls
46 lines (33 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package hashcode.model;
public class ProductType {
public static int PRODUCT_TYPE_COUNT;
public static ProductType[] productTypes;
public int id;
public int weight;
public ProductType() {}
public ProductType(int id, int weight) {
this.id = id;
this.weight = weight;
}
@Override
public String toString() {
return "ProductType{" +
"id=" + id +
", weight=" + weight +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProductType that = (ProductType) o;
if (id != that.id) return false;
return weight == that.weight;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + weight;
return result;
}
}