1
2
3
4
5
6 package fr.ifremer.quadrige3.core.dao.system;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 import java.io.Serializable;
29
30
31
32
33
34 public abstract class LocPoint
35 implements Serializable, Comparable<LocPoint>
36 {
37
38
39
40 private static final long serialVersionUID = -6826121409237791723L;
41
42
43 private Integer locId;
44
45
46
47
48
49 public Integer getLocId()
50 {
51 return this.locId;
52 }
53
54
55
56
57
58 public void setLocId(Integer locIdIn)
59 {
60 this.locId = locIdIn;
61 }
62
63 private String locPosition;
64
65
66
67
68
69 public String getLocPosition()
70 {
71 return this.locPosition;
72 }
73
74
75
76
77
78 public void setLocPosition(String locPositionIn)
79 {
80 this.locPosition = locPositionIn;
81 }
82
83
84 private Location location;
85
86
87
88
89
90 public Location getLocation()
91 {
92 return this.location;
93 }
94
95
96
97
98
99 public void setLocation(Location locationIn)
100 {
101 this.location = locationIn;
102 }
103
104
105
106
107
108 @Override
109 public boolean equals(Object object)
110 {
111 if (this == object)
112 {
113 return true;
114 }
115 if (!(object instanceof LocPoint))
116 {
117 return false;
118 }
119 final LocPoint that = (LocPoint)object;
120 if (this.locId == null || that.getLocId() == null || !this.locId.equals(that.getLocId()))
121 {
122 return false;
123 }
124 return true;
125 }
126
127
128
129
130 @Override
131 public int hashCode()
132 {
133 int hashCode = 0;
134 hashCode = 29 * hashCode + (this.locId == null ? 0 : this.locId.hashCode());
135
136 return hashCode;
137 }
138
139
140
141
142 public static final class Factory
143 {
144
145
146
147
148 public static LocPoint newInstance()
149 {
150 return new LocPointImpl();
151 }
152
153
154
155
156
157
158
159
160
161 public static LocPoint newInstance(String locPosition, Location location)
162 {
163 final LocPoint entity = new LocPointImpl();
164 entity.setLocPosition(locPosition);
165 entity.setLocation(location);
166 return entity;
167 }
168 }
169
170
171
172
173 public int compareTo(LocPoint o)
174 {
175 int cmp = 0;
176 if (this.getLocId() != null)
177 {
178 cmp = this.getLocId().compareTo(o.getLocId());
179 }
180 else
181 {
182 if (this.getLocPosition() != null)
183 {
184 cmp = (cmp != 0 ? cmp : this.getLocPosition().compareTo(o.getLocPosition()));
185 }
186 }
187 return cmp;
188 }
189
190
191 }