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 11/*
2- * Copyright 2017 Google Inc.
2+ * Copyright 2025 Google LLC
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16-
17- package com.google.maps.android.data ;
16+ package com.google.maps.android.data
1817
1918/* *
2019 * An abstraction that represents a Geometry object
2120 *
22- * @param <T> the type of Geometry object
21+ * @param T the type of Geometry object
2322 */
24- public interface Geometry <T > {
23+ interface Geometry <T > {
2524 /* *
2625 * Gets the type of geometry
27- *
28- * @return type of geometry
2926 */
30- String getGeometryType();
27+ val geometryType : String
3128
3229 /* *
3330 * Gets the stored KML Geometry object
34- *
35- * @return geometry object
3631 */
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>> {
3535 /* *
3636 * Gets the type of geometry
3737 */
38- override fun getGeometryType () : String = " LineString"
38+ override val geometryType : String = " LineString"
3939
4040 /* *
4141 * Gets the geometry object
4242 */
43- override fun getGeometryObject () : List <LatLng > = _coordinates
43+ override val geometryObject : List <LatLng > = _coordinates
4444
4545 override fun equals (other : Any? ): Boolean {
4646 if (this == = other) return true
@@ -58,4 +58,4 @@ open class LineString(coordinates: List<LatLng>) : Geometry<List<LatLng>> {
5858 override fun toString (): String {
5959 return " LineString(coordinates=$_coordinates )"
6060 }
61- }
61+ }
Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ open class Point(coordinates: LatLng) : Geometry<LatLng> {
3535 /* *
3636 * Gets the type of geometry
3737 */
38- override fun getGeometryType () : String = " Point"
38+ override val geometryType : String = " Point"
3939
4040 /* *
4141 * Gets the geometry object
4242 */
43- override fun getGeometryObject () : LatLng = _coordinates
43+ override val geometryObject : LatLng = _coordinates
4444
4545 override fun equals (other : Any? ): Boolean {
4646 if (this == = other) return true
@@ -58,4 +58,4 @@ open class Point(coordinates: LatLng) : Geometry<LatLng> {
5858 override fun toString (): String {
5959 return " Point(coordinates=$_coordinates )"
6060 }
61- }
61+ }
Original file line number Diff line number Diff line change @@ -35,13 +35,13 @@ class LineStringTest {
3535 }
3636
3737 @Test
38- fun `getType returns correct type` () {
38+ fun `geometryType returns correct type` () {
3939 val lineString = createSimpleLineString()
40- assertThat(lineString.getGeometryType() ).isEqualTo(" LineString" )
40+ assertThat(lineString.geometryType ).isEqualTo(" LineString" )
4141 }
4242
4343 @Test
44- fun `getGeometryObject returns correct coordinates` () {
44+ fun `geometryObject returns correct coordinates` () {
4545 val lineString = createSimpleLineString()
4646 val expectedCoordinates = listOf (
4747 LatLng (90.0 , 60.0 ),
@@ -51,7 +51,7 @@ class LineStringTest {
5151 LatLng (90.0 , 54.0 ),
5252 LatLng (86.0 , 56.0 )
5353 )
54- assertThat(lineString.getGeometryObject() ).containsExactlyElementsIn(expectedCoordinates).inOrder()
54+ assertThat(lineString.geometryObject ).containsExactlyElementsIn(expectedCoordinates).inOrder()
5555 }
5656
5757 @Test
@@ -80,4 +80,4 @@ class LineStringTest {
8080 val lineString = LineString (listOf (LatLng (1.0 , 2.0 )))
8181 assertThat(lineString.toString()).isEqualTo(" LineString(coordinates=[lat/lng: (1.0,2.0)])" )
8282 }
83- }
83+ }
Original file line number Diff line number Diff line change @@ -23,16 +23,16 @@ import java.lang.reflect.InvocationTargetException
2323
2424class PointTest {
2525 @Test
26- fun `getGeometryType returns correct type` () {
26+ fun `geometryType returns correct type` () {
2727 val point = Point (LatLng (0.0 , 50.0 ))
28- assertThat(point.getGeometryType() ).isEqualTo(" Point" )
28+ assertThat(point.geometryType ).isEqualTo(" Point" )
2929 }
3030
3131 @Test
32- fun `getGeometryObject returns correct coordinates` () {
32+ fun `geometryObject returns correct coordinates` () {
3333 val coordinates = LatLng (0.0 , 50.0 )
3434 val point = Point (coordinates)
35- assertThat(point.getGeometryObject() ).isEqualTo(coordinates)
35+ assertThat(point.geometryObject ).isEqualTo(coordinates)
3636 assertThat(point.coordinates).isEqualTo(coordinates)
3737 }
3838
@@ -66,4 +66,4 @@ class PointTest {
6666 val point = Point (LatLng (1.0 , 2.0 ))
6767 assertThat(point.toString()).isEqualTo(" Point(coordinates=lat/lng: (1.0,2.0))" )
6868 }
69- }
69+ }
You can’t perform that action at this time.
0 commit comments