File tree Expand file tree Collapse file tree 5 files changed +23
-29
lines changed
main/java/com/google/maps/android/data
test/java/com/google/maps/android/data Expand file tree Collapse file tree 5 files changed +23
-29
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2017 Google Inc.
2
+ * Copyright 2025 Google LLC
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
13
13
* See the License for the specific language governing permissions and
14
14
* limitations under the License.
15
15
*/
16
-
17
- package com.google.maps.android.data ;
16
+ package com.google.maps.android.data
18
17
19
18
/* *
20
19
* An abstraction that represents a Geometry object
21
20
*
22
- * @param <T> the type of Geometry object
21
+ * @param T the type of Geometry object
23
22
*/
24
- public interface Geometry <T > {
23
+ interface Geometry <T > {
25
24
/* *
26
25
* Gets the type of geometry
27
- *
28
- * @return type of geometry
29
26
*/
30
- String getGeometryType();
27
+ val geometryType : String
31
28
32
29
/* *
33
30
* Gets the stored KML Geometry object
34
- *
35
- * @return geometry object
36
31
*/
37
- T getGeometryObject();
38
-
39
- }
32
+ val geometryObject: T
33
+ }
Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ open class LineString(coordinates: List<LatLng>) : Geometry<List<LatLng>> {
35
35
/* *
36
36
* Gets the type of geometry
37
37
*/
38
- override fun getGeometryType () : String = " LineString"
38
+ override val geometryType : String = " LineString"
39
39
40
40
/* *
41
41
* Gets the geometry object
42
42
*/
43
- override fun getGeometryObject () : List <LatLng > = _coordinates
43
+ override val geometryObject : List <LatLng > = _coordinates
44
44
45
45
override fun equals (other : Any? ): Boolean {
46
46
if (this == = other) return true
@@ -58,4 +58,4 @@ open class LineString(coordinates: List<LatLng>) : Geometry<List<LatLng>> {
58
58
override fun toString (): String {
59
59
return " LineString(coordinates=$_coordinates )"
60
60
}
61
- }
61
+ }
Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ open class Point(coordinates: LatLng) : Geometry<LatLng> {
35
35
/* *
36
36
* Gets the type of geometry
37
37
*/
38
- override fun getGeometryType () : String = " Point"
38
+ override val geometryType : String = " Point"
39
39
40
40
/* *
41
41
* Gets the geometry object
42
42
*/
43
- override fun getGeometryObject () : LatLng = _coordinates
43
+ override val geometryObject : LatLng = _coordinates
44
44
45
45
override fun equals (other : Any? ): Boolean {
46
46
if (this == = other) return true
@@ -58,4 +58,4 @@ open class Point(coordinates: LatLng) : Geometry<LatLng> {
58
58
override fun toString (): String {
59
59
return " Point(coordinates=$_coordinates )"
60
60
}
61
- }
61
+ }
Original file line number Diff line number Diff line change @@ -35,13 +35,13 @@ class LineStringTest {
35
35
}
36
36
37
37
@Test
38
- fun `getType returns correct type` () {
38
+ fun `geometryType returns correct type` () {
39
39
val lineString = createSimpleLineString()
40
- assertThat(lineString.getGeometryType() ).isEqualTo(" LineString" )
40
+ assertThat(lineString.geometryType ).isEqualTo(" LineString" )
41
41
}
42
42
43
43
@Test
44
- fun `getGeometryObject returns correct coordinates` () {
44
+ fun `geometryObject returns correct coordinates` () {
45
45
val lineString = createSimpleLineString()
46
46
val expectedCoordinates = listOf (
47
47
LatLng (90.0 , 60.0 ),
@@ -51,7 +51,7 @@ class LineStringTest {
51
51
LatLng (90.0 , 54.0 ),
52
52
LatLng (86.0 , 56.0 )
53
53
)
54
- assertThat(lineString.getGeometryObject() ).containsExactlyElementsIn(expectedCoordinates).inOrder()
54
+ assertThat(lineString.geometryObject ).containsExactlyElementsIn(expectedCoordinates).inOrder()
55
55
}
56
56
57
57
@Test
@@ -80,4 +80,4 @@ class LineStringTest {
80
80
val lineString = LineString (listOf (LatLng (1.0 , 2.0 )))
81
81
assertThat(lineString.toString()).isEqualTo(" LineString(coordinates=[lat/lng: (1.0,2.0)])" )
82
82
}
83
- }
83
+ }
Original file line number Diff line number Diff line change @@ -23,16 +23,16 @@ import java.lang.reflect.InvocationTargetException
23
23
24
24
class PointTest {
25
25
@Test
26
- fun `getGeometryType returns correct type` () {
26
+ fun `geometryType returns correct type` () {
27
27
val point = Point (LatLng (0.0 , 50.0 ))
28
- assertThat(point.getGeometryType() ).isEqualTo(" Point" )
28
+ assertThat(point.geometryType ).isEqualTo(" Point" )
29
29
}
30
30
31
31
@Test
32
- fun `getGeometryObject returns correct coordinates` () {
32
+ fun `geometryObject returns correct coordinates` () {
33
33
val coordinates = LatLng (0.0 , 50.0 )
34
34
val point = Point (coordinates)
35
- assertThat(point.getGeometryObject() ).isEqualTo(coordinates)
35
+ assertThat(point.geometryObject ).isEqualTo(coordinates)
36
36
assertThat(point.coordinates).isEqualTo(coordinates)
37
37
}
38
38
@@ -66,4 +66,4 @@ class PointTest {
66
66
val point = Point (LatLng (1.0 , 2.0 ))
67
67
assertThat(point.toString()).isEqualTo(" Point(coordinates=lat/lng: (1.0,2.0))" )
68
68
}
69
- }
69
+ }
You can’t perform that action at this time.
0 commit comments