@@ -9,32 +9,52 @@ public class Position {
99 private final double latitude ;
1010 private final double altitude ;
1111
12- /*
13- * Private constructor
12+ /**
13+ * Private Constructor
14+ *
15+ * @param longitude double value with position's longitude.
16+ * @param latitude double value with position's latitude.
17+ * @param altitude double value with position's altitude.
1418 */
15-
1619 private Position (double longitude , double latitude , double altitude ) {
1720 this .longitude = longitude ;
1821 this .latitude = latitude ;
1922 this .altitude = altitude ;
2023 }
2124
22- /*
23- * Getters
25+ /**
26+ * Gets the position's longitude.
27+ *
28+ * @return double value with positions longitude.
2429 */
25-
2630 public double getLongitude () {
2731 return longitude ;
2832 }
2933
34+ /**
35+ * Gets the position's latitude.
36+ *
37+ * @return double value with positions latitude.
38+ */
3039 public double getLatitude () {
3140 return latitude ;
3241 }
3342
43+ /**
44+ * Gets the position's altitude.
45+ *
46+ * @return double value with positions altitude.
47+ */
3448 public double getAltitude () {
3549 return altitude ;
3650 }
3751
52+ /**
53+ * Gets the position coordinates in a double array. Altitude will be included in the array
54+ * if a value is present.
55+ *
56+ * @return double[] array with longitude, latitude, and altitude (if present).
57+ */
3858 public double [] getCoordinates () {
3959 if (hasAltitude ()) {
4060 return new double []{getLongitude (), getLatitude (), getAltitude ()};
@@ -43,22 +63,32 @@ public double[] getCoordinates() {
4363 }
4464 }
4565
46- /*
47- * Factories
66+ /**
67+ * Builds a {@link Position} from a double longitude, latitude and an altitude.
68+ *
69+ * @param longitude double longitude value.
70+ * @param latitude double latitude value.
71+ * @param altitude double altitude value.
4872 */
49-
5073 public static Position fromCoordinates (double longitude , double latitude , double altitude ) {
5174 return new Position (longitude , latitude , altitude );
5275 }
5376
77+ /**
78+ * Builds a {@link Position} from a double longitude and latitude.
79+ *
80+ * @param longitude double longitude value.
81+ * @param latitude double latitude value.
82+ */
5483 public static Position fromCoordinates (double longitude , double latitude ) {
5584 return new Position (longitude , latitude , Double .NaN );
5685 }
5786
58- /*
59- * Altitude related
87+ /**
88+ * Checks if a position has an altitude value.
89+ *
90+ * @return true if position contains altitude data.
6091 */
61-
6292 public boolean hasAltitude () {
6393 return !Double .isNaN (altitude );
6494 }
0 commit comments