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