1 package fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency;
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 import com.google.common.base.MoreObjects;
28 import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
29
30 import java.util.Objects;
31
32
33
34
35
36
37
38
39
40 public class IndividualObservationBatchRowState {
41
42 private final Float size;
43 private final Float weight;
44 private final CaracteristicQualitativeValue maturity;
45 private final CaracteristicQualitativeValue gender;
46 private final String samplingCode;
47 private final boolean valid;
48
49 public IndividualObservationBatchRowState(Float size,
50 Float weight,
51 CaracteristicQualitativeValue maturity,
52 CaracteristicQualitativeValue gender,
53 String samplingCode,
54 boolean valid) {
55 this.size = size;
56 this.weight = weight;
57 this.maturity = maturity;
58 this.gender = gender;
59 this.samplingCode = samplingCode;
60 this.valid = valid;
61 }
62
63 public boolean isValid() {
64 return valid;
65 }
66
67 public Float getSize() {
68 return size;
69 }
70
71 public Float getWeight() {
72 return weight;
73 }
74
75 public CaracteristicQualitativeValue getMaturity() {
76 return maturity;
77 }
78
79 public CaracteristicQualitativeValue getGender() {
80 return gender;
81 }
82
83 public String getSamplingCode() {
84 return samplingCode;
85 }
86
87 public boolean withSamplingCode() {
88 return samplingCode != null;
89 }
90
91 @Override
92 public boolean equals(Object o) {
93 if (this == o) return true;
94 if (o == null || getClass() != o.getClass()) return false;
95 IndividualObservationBatchRowState that = (IndividualObservationBatchRowState) o;
96 return Objects.equals(size, that.size) &&
97 Objects.equals(weight, that.weight) &&
98 Objects.equals(maturity, that.maturity) &&
99 Objects.equals(gender, that.gender) &&
100 Objects.equals(samplingCode, that.samplingCode);
101 }
102
103 @Override
104 public int hashCode() {
105 return Objects.hash(size, weight);
106 }
107
108 @Override
109 public String toString() {
110 return MoreObjects.toStringHelper(this)
111 .add("size", size)
112 .add("weight", weight)
113 .add("maturity", maturity)
114 .add("gender", gender)
115 .add("samplingCode", samplingCode)
116 .add("valid", valid)
117 .toString();
118 }
119 }