1 |
| package photospace.space; |
2 |
| |
3 |
| import org.apache.commons.lang.builder.*; |
4 |
| |
5 |
| public class Position |
6 |
| implements java.io.Serializable, Cloneable |
7 |
| { |
8 |
| |
9 |
| private Double latitude; |
10 |
| private Double longitude; |
11 |
| private Double altitude; |
12 |
| |
13 |
154
| public Position() {}
|
14 |
| |
15 |
2
| public Position(Double latitude, Double longitude, Double altitude)
|
16 |
| { |
17 |
2
| this.latitude = latitude;
|
18 |
2
| this.longitude = longitude;
|
19 |
2
| this.altitude = altitude;
|
20 |
| } |
21 |
| |
22 |
15
| public boolean hasData()
|
23 |
| { |
24 |
15
| return latitude != null || longitude != null || altitude != null;
|
25 |
| } |
26 |
| |
27 |
74
| public Double getLatitude() { return latitude; }
|
28 |
38
| public void setLatitude(Double latitude) { this.latitude = latitude; }
|
29 |
| |
30 |
66
| public Double getLongitude() { return longitude; }
|
31 |
20
| public void setLongitude(Double longitude) { this.longitude = longitude; }
|
32 |
| |
33 |
51
| public Double getAltitude() { return altitude; }
|
34 |
0
| public void setAltitude(Double altitude) { this.altitude = altitude; }
|
35 |
| |
36 |
0
| public boolean equals(Object o)
|
37 |
| { |
38 |
0
| if (! (o instanceof Position)) return false;
|
39 |
0
| Position other = (Position) o;
|
40 |
0
| return new EqualsBuilder().append(latitude, other.getLatitude())
|
41 |
| .append(longitude, other.getLongitude()) |
42 |
| .append(altitude, other.getAltitude()).isEquals(); |
43 |
| } |
44 |
| |
45 |
0
| public int hashCode()
|
46 |
| { |
47 |
0
| return new HashCodeBuilder().append(latitude)
|
48 |
| .append(longitude) |
49 |
| .append(altitude).toHashCode(); |
50 |
| } |
51 |
| |
52 |
0
| public Object clone() throws CloneNotSupportedException
|
53 |
| { |
54 |
0
| return super.clone();
|
55 |
| } |
56 |
| |
57 |
0
| public String toString()
|
58 |
| { |
59 |
0
| return "Position[" + latitude + "," + longitude + "]";
|
60 |
| } |
61 |
| } |