1 package fr.ifremer.tutti.persistence.entities.protocol;
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
29 import java.util.Objects;
30
31 public class CalcifiedPiecesSamplingDefinitionBean extends AbstractCalcifiedPiecesSamplingDefinitionBean {
32
33 @Override
34 public boolean equals(Object o) {
35 if (this == o) return true;
36 if (o == null || getClass() != o.getClass()) return false;
37 CalcifiedPiecesSamplingDefinitionBean that = (CalcifiedPiecesSamplingDefinitionBean) o;
38 return minSize == that.minSize &&
39 Objects.equals(maxSize, that.maxSize) &&
40 Objects.equals(maturity, that.maturity);
41 }
42
43 @Override
44 public int hashCode() {
45 return Objects.hash(minSize, maxSize, maturity);
46 }
47
48 @Override
49 public String toString() {
50 MoreObjects.ToStringHelper toStringHelper =
51 MoreObjects.toStringHelper(CalcifiedPiecesSamplingDefinition.class)
52 .add(PROPERTY_MIN_SIZE, minSize)
53 .add(PROPERTY_MAX_SIZE, maxSize == null ? "∞" : maxSize)
54 .add(PROPERTY_SEX, sex)
55 .add(PROPERTY_SAMPLING_INTERVAL, samplingInterval);
56
57 if (maturity != null) {
58 toStringHelper.add(PROPERTY_MATURITY, maturity);
59 }
60 if (maxByLenghtStep != null && maxByLenghtStep > 0) {
61 toStringHelper.add(PROPERTY_MAX_BY_LENGHT_STEP, maxByLenghtStep);
62 }
63 if (operationLimitation != null && operationLimitation > 0) {
64 toStringHelper.add(PROPERTY_OPERATION_LIMITATION, operationLimitation);
65 }
66 if (zoneLimitation != null && zoneLimitation > 0) {
67 toStringHelper.add(PROPERTY_ZONE_LIMITATION, zoneLimitation);
68 }
69
70 return toStringHelper.toString();
71 }
72 }